Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Matrix.Shear method

Applies to: desktop apps only

The Matrix::Shear method updates this matrix with the product of itself and a shearing matrix.

Syntax

Status Shear(
  [in]  REAL shearX,
  [in]  REAL shearY,
  [in]  REAL order
);

Parameters

shearX [in]

Type: REAL

Real number that specifies the horizontal shear factor.

shearY [in]

Type: REAL

Real number that specifies the vertical shear factor.

order [in]

Type: REAL

Optional. Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the shearing matrix is on the left, and MatrixOrderAppend specifies that the shearing 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 creates a Matrix object and calls the Matrix::Scale method to set the elements of that matrix to a scaling transformation. Then the code calls the Matrix::Shear method to update the matrix with the product of itself and a shearing matrix. At that point, the matrix represents a composite transformation: first scale, then shear. The code uses the matrix to set the world transformation of a Graphics object and then draws a rectangle that is transformed according to the composite transformation.

In the call to Matrix::Shear, the shearX parameter is 3 and the shearY parameter is 0. That particular shearing transformation slides the bottom edge of the rectangle to the right. The distance that the bottom edge slides is shearX multiplied by the height of the rectangle after it is stretched by the scaling transformation.


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

   Matrix matrix;
   matrix.Scale(2.0f, 2.0f);                     // first a scaling
   matrix.Shear(3.0f, 0.0f, MatrixOrderAppend);  // then a shear

   graphics.SetTransform(&matrix);
   graphics.DrawRectangle(&pen, 0, 0, 100, 50);  
}

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
MatrixOrder
Matrix::Multiply
Matrix::Rotate
Matrix::RotateAt
Matrix::Scale
Matrix::Translate
Transformations
Global and Local Transformations
Matrix Representation of Transformations

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.