GdipTransformPathfunction
Multiplies each of this path's data points by a specified matrix.
Syntax
FUNCTION GdipTransformPath (BYVAL path AS GpPath PTR, BYVAL matrix AS GpMatrix PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
path | [in] Pointer to the GraphicsPath object. | |
matrix | [in] Pointer to a Matrix object that specifies the transformation. |
Description
Multiplies each of this path's data points by a specified matrix.
Example
' ======================================================================================== ' This example moves and rotates a GraphicsPath using GdipTransformPath. ' ======================================================================================== SUB Example_TransformPath (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 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)
DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path) hStatus = GdipAddPathRectangle(path, 100, 10, 200, 50)
' // Draw the path in blue before applying a transformation. DIM bluePen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_BLUE, 1, UnitWorld, bluePen) hStatus = GdipDrawPath(graphics, bluePen, path)
' // Transform the path. DIM matrix AS GpMatrix PTR hStatus = GdipCreateMatrix(@matrix) hStatus = GdipRotateMatrix(matrix, 30, MatrixOrderPrepend) hStatus = GdipTransformPath(path, matrix) DIM redPen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_RED, 1, UnitWorld, @redPen) hStatus = GdipDrawPath(graphics, redPen, path)
' // Cleanup IF bluePen THEN GdipDeletePen(bluePen) IF redPen THEN GdipDeletePen(redPen) IF matrix THEN GdipDeleteMatrix(matrix) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:2055
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions