Function Reference


_GDIPlus_PenSetCompound

Sets the compound array for a Pen object

#include <GDIPlus.au3>
_GDIPlus_PenSetCompound ( $hPen, $aCompounds )

Parameters

$hPen A pointer to a Pen object.
$aCompounds An array of compound values:
    [0] - Number of compound values
    [1] - Compound value 1
    [2] - Compound value 2
    [n] - Compound value n

Return Value

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

Remarks

The elements in the array must be in increasing order, not less than 0, and not greater than 1.
Suppose you want a pen to draw two parallel lines where the width of the first line is 20 percent of the pen's width,
the width of the space that separates the two lines is 50 percent of the pen' s width,
and the width of the second line is 30 percent of the pen's width.
Start by creating a Pen object and an array of compound values.
You can then set the compound array by passing the array with the values 0.0, 0.2, 0.7, and 1.0 to the _GDIPlus_PenSetCompound function.

Related

_GDIPlus_PenCreate

See Also

Search GdipSetPenCompoundArray in MSDN Library.

Example

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

Example()

Func Example()
        Local $hGUI = GUICreate("GDI+", 800, 360)
        GUISetState(@SW_SHOW)

        _GDIPlus_Startup()
        Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
        _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
        _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)

        Local $hPath = _GDIPlus_PathCreate()
        Local $hFamily = _GDIPlus_FontFamilyCreate("Arial Black")
        _GDIPlus_PathAddString($hPath, "AutoIt", _GDIPlus_RectFCreate(10, 25), $hFamily, 0, 205, 0)

        Local $hBrush = _GDIPlus_BrushCreateSolid(0xF0FFFFFF)
        Local $hPen = _GDIPlus_PenCreate(0xFF4488FF, 12)
        _GDIPlus_PenSetLineJoin($hPen, 2)

        Local $aCompounds[7]
        $aCompounds[0] = 6 ;number of elements in the compound array

        $aCompounds[1] = 0 ;
        $aCompounds[2] = 0.3 ;first line [0 to 0.3] * PenWidth

        $aCompounds[3] = 0.55 ;
        $aCompounds[4] = 0.7 ;second line [0.55 to 0.7] * PenWidth

        $aCompounds[5] = 0.9 ;
        $aCompounds[6] = 1 ;third line [0.9 to 1] * PenWidth

        _GDIPlus_PenSetCompound($hPen, $aCompounds)

        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen)

        _GDIPlus_PenSetColor($hPen, 0xFFFF66FF)
        _GDIPlus_GraphicsDrawRect($hGraphic, 20, 20, 760, 320, $hPen)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_PenDispose($hPen)
        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_GraphicsDispose($hGraphic)
        _GDIPlus_Shutdown()
EndFunc   ;==>Example