5,530
社区成员
发帖
与我相关
我的任务
分享
Matrix::Rotate Method
--------------------------------------------------------------------------------
The Rotate method updates this matrix with the product of itself and a rotation matrix.
Syntax
Status Rotate( REAL angle,
MatrixOrder order
);
Parameters
angle
[in] Real number that specifies the angle of rotation in degrees. Positive values specify clockwise rotation.
order
[in] Optional. Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the rotation matrix is on the left, and MatrixOrderAppend specifies that the rotation matrix is on the right. The default value is MatrixOrderPrepend.
Return Value
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Example
The following example creates a Matrix object and calls the Translate method to set the elements of that matrix to a translation. Then the code calls the Rotate method to update the matrix with the product of itself and a rotation matrix. At that point, the matrix represents a composite transformation: first translate, then rotate. The code uses the matrix to set the world transformation of a Graphics object and then draws an ellipse that is transformed according to the composite transformation.
VOID Example_Rotate(HDC hdc)
{
Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255));
Matrix matrix;
matrix.Translate(40.0f, 0.0f); // first a translation
matrix.Rotate(30.0f, MatrixOrderAppend); // then a rotation
graphics.SetTransform(&matrix);
graphics.DrawEllipse(&pen, 0, 0, 100, 50);
}
Method Information
Stock Implementation gdiplus.dll
Header Declared in Gdiplusmatrix.h, include gdiplus.h
Import library gdiplus.lib
Minimum availability GDI+ 1.0
Minimum operating systems Windows 98/Me, Windows XP, Windows 2000, Windows NT 4.0 SP6
See Also
MatrixOrder, Multiply, RotateAt, Scale, Shear, Translate, Transformations, Global and Local Transformations, Matrix Representation of Transformations
--------------------------------------------------------------------------------
DrawString Methods
--------------------------------------------------------------------------------
This topic lists the DrawString methods of the Graphics class. For a complete list of methods for the Graphics class, see Graphics.
Graphics::DrawString(WCHAR*,INT,Font*,RectF&,StringFormat*,Brush*)
Graphics::DrawString(WCHAR*,INT,Font*,PointF&,Brush*)
Graphics::DrawString(WCHAR*,INT,Font*,PointF&,StringFormat*,Brush*)
--------------------------------------------------------------------------------