Matrix.OffsetY method

Applies to: desktop apps only

The Matrix::OffsetY method gets the vertical translation value of this matrix, which is the element in row 3, column 2.

Syntax

REAL OffsetY();

Parameters

This method has no parameters.

Return value

Type:

Type: REAL

This method returns the vertical translation value of this matrix, which is the element in row 3, column 2.

Examples

The following example creates a Matrix object with a horizontal translation value of 50 and a vertical translation value of 30. The code calls the Matrix::OffsetX and Matrix::OffsetY methods of the Matrix object to obtain those translation values. The code draws a line from (0, 0) to the point whose coordinates are the retrieved translation values. The code also uses the matrix to set the world transformation of a Graphics object and then draws a rectangle that is transformed according to that world transformation.


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

   Matrix matrix(1.0f, 0.0f, 0.0f, 1.0f, 50.0f, 30.0f);
   REAL xTranslation = matrix.OffsetX();
   REAL yTranslation = matrix.OffsetY();

   graphics.DrawLine(&pen, 0.0f, 0.0f, xTranslation, yTranslation);
   graphics.SetTransform(&matrix);
   graphics.DrawRectangle(&pen, 0, 0, 20, 20); 
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusmatrix.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Matrix
Matrix::OffsetX
Matrix::Translate
Transformations
Global and Local Transformations
Matrix Representation of Transformations

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: