Help Center

CGpGraphics.MultiplyTransformmethod

Updates this **Graphics** object's world transformation matrix with the product of itself and another matrix.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION MultiplyTransform (BYVAL pMatrix AS CGpMatrix PTR, BYVAL order AS MatrixOrder = MatrixOrderPrepend) AS GpStatus

Parameters

NameDescription
pMatrixPointer to a matrix that will be multiplied by the world transformation matrix of this Graphics object.
orderOptional. Element of the MatrixOrder enumeration that specifies the order of multiplication. MatrixOrderPrepend specifies that the passed matrix is on the left, and MatrixOrderAppend specifies that the passed matrix is on the right. The default value is MatrixOrderPrepend.

Return value

If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Updates this Graphics object's world transformation matrix with the product of itself and another matrix.

Example

' ======================================================================================== ' The following example calls the Graphics.RotateTransform method of a Graphics object to ' fill its world transformation matrix with the elements that represent a 30-degree rotation. ' Then the code calls the MultiplyTransform method to replace the world transformation matrix ' (which represents the 30-degree rotation) of the Graphics object with the product of itself ' and a translation matrix. At that point, the world transformation matrix of the Graphics ' object represents a composite transformation: first rotate, then translate. Finally, the ' code calls the DrawEllipse method to draw an ellipse that is rotated and translated. ' ======================================================================================== SUB Example_MultiplyTransform (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Get the DPI scaling ratio DIM rxRatio AS SINGLE = graphics.GetDpiX / 96 DIM ryRatio AS SINGLE = graphics.GetDpiY / 96 ' // Set the scale transform graphics.ScaleTransform(rxRatio, ryRatio)

DIM matrix AS CGpMatrix matrix.Translate(150 * rxRatio, 100 * rxRatio)

graphics.RotateTransform(30) ' // first rotate graphics.MultiplyTransform(@matrix, MatrixOrderAppend) ' // then translate

DIM bluePen AS CGpPen = ARGB_BLUE graphics.DrawEllipse(@bluePen, -80, -40, 160, 80)

END SUB ' ========================================================================================

Reference

  • Include file CGpGraphics.inc
  • Defined in AfxNova/CGpGraphics.inc:289
  • Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
  • Topic: CGpGraphics Class