Help Center

GdipTransformMatrixPointsfunction

Multiplies each point in an array by a matrix. Each point is treated as a row matrix. The multiplication is performed with the row matrix on the left and a matrix on the right.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipTransformMatrixPoints (BYVAL matrix AS GpMatrix PTR, BYVAL pts AS GpPointF PTR, BYVAL count AS INT_) AS GpStatus
Also documented as GdipTransformMatrixPointsI — one description covers them all.

Parameters

NameDescription
matrix[in] Pointer to the Matrix object.
matrix[in, out] Pointer to an array of GpPointF structures that, on input, contains the points to be transformed and, on output, receives the transformed points. Each point in the array is transformed (multiplied by a matrix) and updated with the result of the transformation.
count[in] Long integer value that specifies the number of points to be transformed. The default value is 1.

Description

Multiplies each point in an array by a matrix. Each point is treated as a row matrix. The multiplication is performed with the row matrix on the left and a matrix on the right.

Example

' ======================================================================================== ' The following example creates an array of five points and then transforms those points ' by calling the GdipTransformMatrixPoints function. The code passes the array of points ' to the GdipDrawCurve function before the transformation and again after the transformation. ' ======================================================================================== SUB Example_TransformMatrixPoints (BYVAL hdc AS HDC)

DIM hStatus AS LONG

' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)

' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)

' // Create identity matrix DIM matrix AS GpMatrix PTR hStatus = GdipCreateMatrix2(1, 0, 0, 2, 0, 0, @matrix)

' // Array of points DIM rgPoints(0 TO 4) AS GpPointF = {(50, 100), (100, 50), _

(160, 125), (200, 100), (250, 150)}

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_BLUE, 1 * rxRatio, UnitPixel, @pen)

' // Draw the curve hStatus = GdipDrawCurve(graphics, pen, @rgPoints(0), 5) ' // Transform the points hStatus = GdipTransformMatrixPoints(matrix, @rgPoints(0), 5) ' // Draw the curve after the transformation hStatus = GdipDrawCurve(graphics, pen, @rgPoints(0), 5)

' // Cleanup IF pen THEN GdipDeletePen(pen) IF matrix THEN GdipDeleteMatrix(matrix) IF graphics THEN GdipDeleteGraphics(graphics)

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

Reference

  • Defined in AfxNova/AfxGdiPlus.bi:2210
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusMatrix.md
  • Topic: GdiPlusMatrix