Function Reference


_GDIPlus_PathWarp

Applies a warp transformation to a path. The function also flattens (converts to a sequence of straight lines) the path

#include <GDIPlus.au3>
_GDIPlus_PathWarp ( $hPath, $hMatrix, $aPoints, $nX, $nY, $nWidth, $nHeight [, $iWarpMode = 0 [, $fFlatness = 0.25]] )

Parameters

$hPath Pointer to a GraphicsPath object
$hMatrix Pointer to a Matrix object that represents a transformation to be applied along with the warp.
$aPoints Array of parallelogram points that, along with the rectangle parameters, define the wrap mode:
    [0][0] - Number of points. This number must be 3 or 4
    [1][0] - Point 1 X coordinate
    [1][1] - Point 1 Y coordinate
    [2][0] - Point 2 X coordinate
    [2][1] - Point 2 Y coordinate
    [n][0] - Point n X coordinate
    [n][1] - Point n Y coordinate
$nX X coordinate of the upper left corner of the rectangle to be transformed into a parallelogram defined by $aPoints
$nY Y coordinate of the upper left corner of the rectangle to be transformed into a parallelogram defined by $aPoints
$nWidth Width of the rectangle to be transformed into a parallelogram defined by $aPoints
$nHeight Height of the rectangle to be transformed into a parallelogram defined by $aPoints
$iWarpMode [optional] Kind of warp to be applied:
    0 - Specifies the perspective warp mode
    1 - Specifies the bilinear warp mode
$fFlatness [optional] Real number that influences the number of line segments that are used to approximate the original path.
Small values specify that many line segments are used, and large values specify that few line segments are used.

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).

Related

_GDIPlus_PathFlatten

See Also

Search GdipWarpPath in MSDN Library.

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPath, $hFormat, $hFamily, $tLayout

    ; Create GUI
    $iW = 600
    $iH = 300
    $hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
    _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00)

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1) ;Set alignment to center

    $hFamily = _GDIPlus_FontFamilyCreate("Arial Black") ;Create font family object
    $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) ;Create string bounding rectangle
    _GDIPlus_PathAddString($hPath, "AutoIt rulez!" & @LF & "and so does" & @LF & "STAR WARS ;)", $tLayout, $hFamily, 0, 64, $hFormat) ;Add the outline of the string to the path

    Local $aPoints[5][2]
    $aPoints[0][0] = 4
    $aPoints[1][0] = $iW * 0.3
    $aPoints[1][1] = $iH * 0.3
    $aPoints[2][0] = $iW * 0.7
    $aPoints[2][1] = $iH * 0.3
    $aPoints[3][0] = 0
    $aPoints[3][1] = $iH
    $aPoints[4][0] = $iW
    $aPoints[4][1] = $iH

    _GDIPlus_PathWarp($hPath, 0, $aPoints, 0, 0, $iW, $iH) ;Warp path

    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Draw path to graphics handle (GUI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example