GDI+ 的Matrix::TransformPoints的作用?
这是msdn中的例子:
VOID Example_TransPoints(HDC hdc){ Graphics graphics(hdc); Pen pen(Color(255, 0, 0, 255)); Point points[5] = { Point(50, 100), Point(100, 50), Point(150, 125), Point(200, 100), Point(250, 150)}; Matrix matrix(1.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f); graphics.DrawCurve(&pen, points, 5); matrix.TransformPoints(points, 5); graphics.DrawCurve(&pen, points, 5); }VOID Example_TransPoints(HDC hdc)//以设备上下文句柄为参数{ Graphics graphics(hdc);//实例化绘图对象 Pen pen(Color(255, 0, 0, 255));//定义画笔并着色为蓝 Point points[5] = { //定义点集 Point(50, 100), Point(100, 50), Point(150, 125), Point(200, 100), Point(250, 150)}; Matrix matrix(1.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f);//生成仿射变换矩阵 graphics.DrawCurve(&pen, points, 5);//绘制基数样条(就是连接这5个点的平滑曲线) matrix.TransformPoints(points, 5);//做仿射变换// [1.0 0.0 0.0] [x] 2矩阵相乘,然后得到新的x'=x,y'=2y,这就是将纵坐标乘2就可以了 [2.0 0.0 0.0] [y] [0.0 0.0 1.0] [1] graphics.DrawCurve(&pen, points, 5); //再绘制曲线}