GdipGetPathWorldBoundsIfunction
Gets a bounding rectangle for this path.
Syntax
FUNCTION GdipGetPathWorldBoundsI (BYVAL path AS GpPath PTR, BYVAL bounds AS GpRect PTR, BYVAL matrix AS CONST GpMatrix PTR, BYVAL pen AS CONST GpPen PTR) AS GpStatus
GdipGetPathWorldBounds — one description covers them all.Parameters
| Name | Description | |
|---|---|---|
path | [in] Pointer to the GraphicsPath object. | |
bounds | [out] Pointer to a GpRectF structure that receives the bounding rectangle. | |
matrix | [in] Pointer to a Matrix object that specifies a transformation to be applied to this path before the bounding rectangle is calculated. This path is not permanently transformed; the transformation is used only during the process of calculating the bounding rectangle. The default value is NULL. | |
pen | [in] Pointer to a Pen object that influences the size of the bounding rectangle. The bounding rectangle received in bounds will be large enough to enclose this path when the path is drawn with the pen specified by this parameter. This ensures that the path is enclosed by the bounding rectangle even if the path is drawn with a wide pen. The default value is NULL. |
Description
Gets a bounding rectangle for this path.
Remarks
The rectangle returned by this method might be larger than necessary to enclose the path as drawn by the specified pen. The rectangle is calculated to allow for the pen's miter limit at sharp corners and to allow for the pen's end caps.
Example
' ======================================================================================== ' This example retrieves the bounding rectangle of a GraphicsPath using GdipGetPathWorldBounds. ' ======================================================================================== SUB Example_GetWorldBounds (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 shape hStatus = GdipAddPathEllipse(path, 100, 80, 150, 100)
' // Get world bounds DIM bounds AS GpRectF hStatus = GdipGetPathWorldBounds(path, @bounds, NULL, NULL)
' // Display bounds OutputDebugStringW("Bounding box:") OutputDebugStringW("X = " & WSTR(bounds.x)) OutputDebugStringW("Y = " & WSTR(bounds.y)) OutputDebugStringW("Width = " & WSTR(bounds.Width)) OutputDebugStringW("Height = " & WSTR(bounds.Height))
' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_ORANGE, 2, UnitWorld, @pen)
' // Draw the 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:2057
- Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
- Topic: GraphicsPath Functions