GdipResetPathGradientTransformfunction
Resets the transformation matrix of this path gradient brush to the identity matrix. This means that no transformation will take place.
Syntax
FUNCTION GdipResetPathGradientTransform (BYVAL brush AS GpPathGradient PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
brush | [in] Pointer to the PathGradientBrush object. |
Description
Resets the transformation matrix of this path gradient brush to the identity matrix. This means that no transformation will take place.
Example
' ======================================================================================== ' The following example creates a PathGradientBrush object based on a triangular path. The ' code calls the GdipScalePathGradientTransform function to fill the brush's transformation ' matrix with the elements that represent a horizontal scaling by a factor of 3. The brush ' is transformed using a horizontal scale followed by a translation (100 units right, ' 50 units down), resulting in a composite transformation. The transformed brush is used to ' fill a rectangle, showing the effect of the transformation. Then, the transformation ' matrix of the brush is reset to the identity matrix using GdipResetPathGradientTransform, ' effectively removing all transformations. The same rectangle is filled again, this time ' using the untransformed brush, allowing a visual comparison between the transformed and ' original states. This technique is useful for restoring a brush to its default state after ' applying temporary transformations during rendering. ' ======================================================================================== SUB Example_ResetPathGradientTransform (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)
' // Define triangle points DIM points(0 TO 2) AS GpPointF = {(0, 0), (50, 0), (50, 50)}
' // Create PathGradientBrush DIM brush AS GpPathGradient PTR hStatus = GdipCreatePathGradient(@points(0), 3, WrapModeClamp, @brush)
' // Apply horizontal scale transform to brush hStatus = GdipScalePathGradientTransform(brush, 3.0, 1.0, MatrixOrderPrepend)
' // Apply translation transform (100 right, 50 down) hStatus = GdipTranslatePathGradientTransform(brush, 100.0, 50.0, MatrixOrderAppend)
' // Fill rectangle using transformed brush hStatus = GdipFillRectangle(graphics, brush, 0, 0, 400, 400)
' // Reset the transformation hStatus = GdipResetPathGradientTransform(brush)
' // Fill the same area with the path gradient brush (no transformation). hStatus = GdipFillRectangle(graphics, brush, 0, 0, 400, 400)
' // Cleanup IF brush THEN GdipDeleteBrush(brush) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:2267
- Documented in Graphics/GdiPlus Flat Api/GdiPlusPathGradientBrush.md
- Topic: GdiPlusPathGradientBrush