Graphics.RotateTransform method

Applies to: desktop apps only

The Graphics::RotateTransform method updates the world transformation matrix of this Graphics object with the product of itself and a rotation matrix.

Syntax

Status RotateTransform(
  [in]  REAL angle,
  [in]  MatrixOrder order
);

Parameters

angle [in]

Type: REAL

Real number that specifies the angle, in degrees, of rotation.

order [in]

Type: MatrixOrder

Optional. Element of the MatrixOrder enumeration that specifies the order of 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

Type:

Type: Status

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.

Examples

The following example sets the world transformation of a Graphics object to a translation. The call to Graphics::RotateTransform multiplies the Graphics object's existing world transformation matrix (translation) by a rotation matrix. The MatrixOrderAppend argument specifies that the multiplication is done with the rotation matrix on the right. At that point, the world transformation matrix of the Graphics object represents a composite transformation: first translate, then rotate. The call to DrawEllipse draws a translated and rotated ellipse.


VOID Example_RotateTransform(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 255, 0, 0));

   graphics.TranslateTransform(100.0f, 0.0f);           // first translate
   graphics.RotateTransform(30.0f, MatrixOrderAppend);  // then rotate
   graphics.DrawEllipse(&pen, 0, 0, 200, 80);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
Graphics::GetTransform
Matrix
MatrixOrder
Graphics::MultiplyTransform
Graphics::ResetTransform
Graphics::ScaleTransform
Graphics::SetTransform
Graphics::TransformPoints
Graphics::TranslateTransform
Transformations
Coordinate Systems and Transformations

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: