GdipFlattenPathfunction
Applies a transformation to this path and converts each curve in the path to a sequence of connected lines.
Syntax
FUNCTION GdipFlattenPath (BYVAL path AS GpPath PTR, BYVAL matrix AS GpMatrix PTR, BYVAL flatness AS REAL) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
path | [in] Pointer to the GraphicsPath object. | |
matrix | [in] Pointer to a Matrix object that specifies the transformation to be applied to the path's data points. The default value is NULL, which specifies that no transformation is to be applied. | |
flatness | [in] Simple precision value that specifies the maximum error between the path and its flattened approximation. Reducing the flatness increases the number of line segments in the approximation. The default value is FlatnessDefault. |
Description
Applies a transformation to this path and converts each curve in the path to a sequence of connected lines.
Example
' ======================================================================================== ' This example flattens a path containing a Bézier curve using GdipFlattenPath. ' ======================================================================================== SUB Example_FlattenPath (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)
' // Create GraphicsPath DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)
' // Add a Bézier curve hStatus = GdipAddPathBezier(path, 50, 150, 100, 50, 200, 250, 250, 150)
' // Flatten the path (convert curve to lines) hStatus = GdipFlattenPath(path, NULL, 0.25)
' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_ORANGE, 2, UnitWorld, @pen)
' // Draw flattened path hStatus = GdipDrawPath(graphics, pen, path)
' // Cleanup IF pen THEN GdipDeleteBrush(pen) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:2049
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions