Function Reference


Sets the miter limit of a Pen object

#include <GDIPlus.au3>
_GDIPlus_PenSetMiterLimit ( $hPen, $fMiterLimit )


$hPen Pointer to a Pen object
$fMiterLimit Real number that specifies the miter limit of the Pen object.
A real number value that is less than 1.0 will be replaced with 1.0.

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).


The miter length is the distance from the intersection of the line walls on the inside of the join to the intersection of the line walls outside of the join.
The miter length can be large when the angle between two lines is small.
The miter limit is the maximum allowed ratio of miter length to stroke width. The default value is 10.0.
If the miter length of the join of the intersection exceeds the limit of the join, then the join will be beveled to keep it within the limit of the join of the intersection.



See Also

Search GdipSetPenMiterLimit in MSDN Library.


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


Func Example()
        Local $hGUI, $hGraphic, $hPen, $fPenWidth, $hPath

        ; Create GUI
        $hGUI = GUICreate("GDI+", 800, 600)

        $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, 0xFFFFFFFF)

        $hPath = _GDIPlus_PathCreate() ;Create new path object
        _GDIPlus_PathAddLine($hPath, 30, 550, 70, 200)
        _GDIPlus_PathAddLine($hPath, 70, 200, 110, 550)

        $fPenWidth = 32

        Local $hPen1 = _GDIPlus_PenCreate(0xFF00FF00, 1)
        For $i = 0 To 6
                _GDIPlus_GraphicsDrawLine($hGraphic, 0, 200 - $fPenWidth * 0.5 * $i, 800, 200 - $fPenWidth * 0.5 * $i, $hPen1)

        $hPen = _GDIPlus_PenCreate(0xFF8800AA, $fPenWidth)
        For $i = 1 To 6
                _GDIPlus_PenSetMiterLimit($hPen, $i)
                _GDIPlus_GraphicsDrawString($hGraphic, "MiterLimit: " & StringFormat("%.1f", _GDIPlus_PenGetMiterLimit($hPen)), 10, 10)
                _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen)
                _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1)
                _GDIPlus_GraphicsTranslateTransform($hGraphic, 130, 0)

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

        ; Clean up resources
EndFunc   ;==>Example