Jump to content

Shape2Polygon


wakillon
 Share

Recommended Posts

Great work again wakillon. :thumbsup:

 

A small example how to use the generated array data would be great!

 

Example modified from the help file:

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hMatrix

    ; Code Generated by Shape2Polygon, Polygon Size=512x246 (reduction level=8) from C:\...\Shape2Polygon\Sample Shapes\Shape_08.png
    Local $aPoints = [[215,0],[1,126],[1,128],[0,135],[1,142],[2,149],[3,156],[5,163],[8,170],[11,177],[15,184],[20,191],[25,198],[32,205],[39,212],[46,218],[53,223],[60,227],[67,231],[74,234],[81,237],[88,240],[95,241],[101,240],[97,233],[94,226],[91,219],[89,212],[89,201],[92,194],[99,187],[106,184],[122,184],[129,185],[136,187],[143,189],[150,192],[157,197],[164,204],[167,203],[173,196],[180,190],[187,186],[201,186],[208,188],[215,192],[222,197],[229,204],[235,211],[240,218],[245,225],[249,232],[252,239],[256,245],[260,238],[263,231],[267,224],[271,217],[277,210],[284,203],[291,196],[298,191],[305,188],[312,185],[320,185],[327,186],[334,191],[341,198],[345,205],[349,204],[356,198],[363,193],[370,189],[377,186],[384,184],[396,184],[403,185],[410,187],[417,192],[422,199],[422,213],[420,220],[418,227],[414,234],[409,241],[410,244],[417,242],[424,240],[431,238],[438,234],[445,231],[452,227],[459,222],[466,217],[473,210],[480,203],[486,196],[492,189],[496,182],[501,175],[504,168],[507,161],[509,154],[510,147],[511,140],[510,133],[510,120],[508,113],[506,106],[503,99],[499,92],[494,85],[488,78],[481,71],[474,65],[467,59],[460,54],[453,49],[446,45],[439,41],[432,37],[425,33],[418,30],[411,26],[404,23],[397,21],[390,18],[383,16],[376,13],[370,16],[374,23],[377,30],[379,37],[379,55],[377,62],[374,69],[369,76],[362,83],[355,88],[348,91],[341,93],[333,93],[326,91],[319,88],[312,82],[305,75],[301,68],[297,61],[295,54],[292,47],[291,40],[289,33],[288,26],[287,19],[287,7],[286,0],[281,7],[277,14],[273,21],[271,28],[259,28],[252,29],[245,28],[238,21],[235,14],[231,7],[224,0],[224,17],[223,24],[223,33],[222,40],[220,47],[218,54],[216,61],[213,68],[208,75],[201,82],[194,87],[187,90],[180,92],[171,92],[164,91],[157,89],[150,85],[143,78],[138,71],[134,64],[132,57],[132,40],[134,33],[136,26],[139,19],[137,13],[130,15],[123,18],[116,20],[109,23],[102,26],[95,29],[88,32],[81,35],[74,39],[67,43],[60,47],[53,52],[46,57],[39,63],[32,70],[26,77],[20,84],[15,91],[11,98],[8,105],[5,112],[3,119],[1,126]]

    ; Create GUI
    $hGUI = GUICreate("GDI+ Example for Shape2Polygon by UEZ", _ArrayMax($aPoints) + 100, _ArrayMax($aPoints, 0, -1, -1, 1) + 100)
    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, 0xFFFFFFFF)

    $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
    $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
    _GDIPlus_PenSetMiterLimit($hPen, 32)
    _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

    $hMatrix = _GDIPlus_MatrixCreate()

    $hPath = _GDIPlus_PathCreate() ;Create new path object

;~     _GDIPlus_PathAddPolygon($hPath, $aPoints)
    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

    ; move coordinates 50 pixels on x/y axis
    _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
    _GDIPlus_PathTransform($hPath, $hMatrix)

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

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

    ; Clean up resources
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

 

Edited by UEZ
Small update to the drawing style ;-)

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thanks  

You are right, here is one who was used for Trump campaign ! :D

#Region    ;************ Includes ************
#Include <Array.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#EndRegion ;************ Includes ************

_GDIPlus_Startup()

Opt ( 'GUIOnEventMode', 1 )

Global $hGUI, $hGraphic, $hBmp_Buffer, $hGfx_Buffer, $aDim, $aPosCenter, $x, $y

; Code Generated by Shape2Polygon, Polygon Size=328x309 (reduction level=4) from D:\Shape2Polygon\Shapes\Hypnosis-spiral-800px.png
Local $aPoints = [[717,0],[164,307],[168,308],[172,308],[190,308],[193,308],[197,307],[202,307],[206,306],[210,305],[214,304],[218,303],[222,302],[226,301],[229,300],[232,298],[236,297],[239,295],[243,294],[246,291],[250,290],[254,288],[258,285],[262,283],[265,281],[269,277],[273,274],[277,271],[281,267],[285,263],[289,259],[292,256],[295,252],[298,248],[300,244],[303,241],[305,237],[308,233],[310,229],[312,225],[313,221],[315,217],[316,214],[318,210],[320,206],[321,202],[322,198],[322,194],[323,190],[324,187],[325,183],[325,179],[325,174],[326,171],[327,168],[327,155],[326,151],[326,147],[325,145],[325,138],[325,135],[324,131],[323,127],[322,124],[322,120],[321,117],[320,113],[318,109],[316,105],[316,101],[313,97],[312,93],[310,90],[308,86],[306,82],[304,79],[301,75],[299,71],[296,67],[293,64],[291,60],[287,56],[284,52],[280,48],[276,44],[272,41],[269,38],[265,34],[261,32],[257,29],[253,26],[249,23],[245,21],[241,19],[237,17],[234,15],[231,14],[227,12],[224,11],[221,9],[217,8],[213,7],[209,6],[205,5],[201,4],[198,3],[195,2],[191,2],[187,1],[182,1],[178,0],[174,0],[171,0],[168,0],[162,0],[159,0],[153,0],[150,0],[146,0],[142,1],[138,2],[135,2],[132,2],[128,3],[125,4],[121,6],[117,6],[114,7],[110,8],[106,10],[102,11],[99,12],[96,14],[92,15],[88,18],[84,19],[82,21],[78,23],[74,25],[71,28],[67,30],[63,32],[59,36],[55,39],[51,42],[47,45],[43,49],[40,53],[36,57],[33,61],[30,65],[27,69],[23,73],[20,77],[18,81],[15,84],[13,88],[12,92],[10,95],[8,99],[6,102],[4,106],[3,110],[2,113],[0,117],[0,120],[0,124],[2,128],[4,131],[8,135],[12,136],[16,136],[20,136],[24,134],[28,130],[29,126],[31,122],[33,118],[34,115],[36,111],[38,108],[40,104],[42,100],[44,97],[47,93],[50,89],[54,85],[56,81],[59,77],[63,73],[66,70],[70,67],[74,64],[78,61],[82,58],[85,56],[88,54],[91,51],[95,49],[99,47],[102,45],[106,43],[110,42],[113,41],[117,39],[121,38],[125,37],[129,36],[133,34],[137,33],[141,33],[145,33],[148,32],[152,31],[161,31],[165,30],[167,31],[179,31],[183,32],[187,33],[191,33],[195,34],[196,34],[200,35],[204,37],[207,38],[211,39],[214,40],[217,42],[221,43],[225,45],[228,48],[232,50],[236,51],[239,54],[243,57],[247,59],[250,63],[254,66],[258,70],[262,74],[266,78],[268,82],[272,86],[274,90],[276,93],[279,96],[281,100],[282,104],[284,108],[285,111],[287,115],[289,119],[289,122],[290,126],[291,129],[292,133],[293,137],[294,140],[295,144],[295,147],[295,151],[295,167],[295,171],[295,174],[294,178],[294,182],[293,185],[292,189],[291,192],[290,196],[289,200],[288,203],[286,207],[284,210],[283,212],[281,215],[280,219],[277,223],[275,227],[272,231],[270,235],[266,239],[262,243],[258,246],[254,249],[251,252],[247,255],[243,258],[239,260],[235,263],[231,265],[227,267],[223,268],[219,270],[216,271],[213,272],[209,273],[205,274],[201,275],[198,275],[195,276],[191,277],[182,277],[179,277],[175,277],[165,277],[162,276],[159,275],[155,275],[152,274],[150,273],[146,272],[143,271],[139,269],[135,268],[132,266],[128,263],[124,261],[121,259],[117,256],[114,254],[110,251],[106,247],[103,243],[100,240],[97,236],[94,232],[92,228],[90,225],[88,222],[86,218],[84,215],[82,212],[81,208],[80,204],[79,200],[78,196],[78,192],[77,189],[76,186],[76,165],[77,162],[77,158],[78,154],[79,151],[80,147],[82,144],[82,140],[84,136],[87,132],[88,128],[92,124],[94,120],[97,117],[100,113],[104,110],[108,106],[111,103],[115,101],[118,98],[122,96],[126,95],[129,92],[133,91],[137,90],[141,88],[145,88],[149,86],[153,86],[158,86],[162,84],[166,84],[169,86],[173,86],[177,86],[180,87],[184,88],[187,88],[191,90],[195,91],[198,93],[202,95],[206,97],[210,100],[214,103],[218,106],[221,110],[224,114],[227,118],[230,122],[232,126],[234,129],[236,133],[237,137],[238,140],[239,144],[240,147],[241,151],[241,167],[240,171],[239,174],[239,178],[237,182],[236,185],[235,189],[232,192],[230,196],[226,200],[223,204],[219,207],[217,210],[213,213],[209,215],[205,217],[201,218],[198,220],[195,221],[191,222],[188,222],[184,223],[178,223],[174,222],[171,222],[168,222],[164,221],[161,219],[157,217],[153,216],[150,213], _
[147,211],[143,207],[140,203],[137,200],[135,196],[134,192],[132,189],[132,185],[130,181],[130,170],[131,166],[132,162],[134,158],[136,154],[140,150],[144,147],[147,143],[151,141],[155,141],[159,139],[166,139],[170,140],[174,141],[178,144],[181,146],[183,149],[186,153],[186,156],[186,160],[183,156],[179,154],[175,152],[167,152],[163,153],[160,155],[156,158],[154,162],[152,165],[150,169],[150,176],[151,180],[152,183],[154,187],[156,191],[160,194],[164,196],[167,198],[171,200],[174,201],[175,201],[184,201],[187,200],[191,199],[195,198],[199,196],[203,192],[207,189],[210,185],[213,182],[214,178],[216,174],[217,171],[218,167],[219,164],[219,154],[218,151],[217,147],[217,144],[215,140],[213,136],[210,133],[208,129],[204,125],[200,121],[197,118],[193,115],[189,114],[186,112],[182,110],[178,110],[174,109],[171,108],[168,108],[160,108],[156,108],[154,109],[150,109],[146,110],[143,111],[139,113],[135,114],[132,117],[128,119],[124,122],[120,126],[117,129],[114,133],[111,137],[108,141],[106,145],[104,149],[103,153],[101,156],[101,160],[100,164],[99,168],[99,185],[100,189],[101,192],[101,196],[103,199],[104,203],[105,207],[108,210],[110,213],[112,217],[114,221],[117,225],[120,228],[123,231],[127,234],[130,237],[133,240],[137,242],[141,244],[145,246],[147,248],[151,249],[155,250],[158,251],[162,253],[166,253],[167,253],[171,254],[188,254],[192,253],[196,253],[200,253],[204,251],[208,250],[211,249],[214,247],[218,246],[220,245],[224,243],[228,240],[231,238],[235,236],[239,232],[243,229],[246,225],[249,222],[252,219],[255,215],[258,211],[260,207],[262,203],[264,200],[265,196],[267,192],[268,188],[270,184],[270,180],[271,176],[272,173],[272,169],[272,165],[272,153],[272,150],[272,145],[271,142],[270,138],[270,134],[268,130],[267,126],[266,123],[264,119],[262,115],[261,111],[259,108],[257,105],[254,101],[251,97],[249,93],[246,90],[242,86],[238,82],[235,79],[231,76],[227,74],[224,72],[221,69],[217,67],[213,65],[210,63],[206,63],[202,60],[198,59],[195,59],[191,57],[188,56],[184,55],[180,55],[177,55],[174,54],[155,54],[152,55],[147,55],[144,55],[141,56],[137,57],[133,57],[129,59],[126,60],[123,61],[119,63],[115,65],[111,67],[108,69],[104,72],[100,74],[96,76],[92,78],[89,81],[85,84],[81,88],[78,91],[74,95],[72,99],[69,102],[66,106],[64,110],[61,114],[59,118],[57,122],[55,126],[54,129],[52,133],[51,137],[50,140],[49,144],[48,147],[47,150],[46,154],[46,158],[46,162],[45,165],[45,185],[46,189],[46,192],[46,196],[47,200],[48,203],[48,207],[50,210],[51,214],[51,218],[53,221],[55,224],[56,228],[57,230],[59,234],[60,237],[63,241],[65,245],[67,248],[69,250],[72,253],[73,255],[74,258],[78,262],[80,264],[84,268],[84,270],[88,272],[92,276],[96,279],[100,282],[103,285],[107,287],[111,290],[114,291],[118,293],[121,295],[125,297],[129,298],[146,304],[159,307]]

; Set Position.
$x = 20
$y = 20
$aDim = _PolygonGetSize ( $aPoints )
$hGUI = GUICreate ( 'Vote for Trump !', $aDim[0] +$x*2, $aDim[1] +$y*2 )
GUISetOnEvent ( $GUI_EVENT_CLOSE, '_Exit' )
GUISetState()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ( $hGUI )
$hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics ( $aDim[0] +$x*2, $aDim[1] +$y*2, $hGraphic )
$hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext ( $hBmp_Buffer )
$aPoints = _PolygonSetPos ( $aPoints, $x, $y )
Dim $aPosCenter[2][2] = [[1]]
$aPosCenter[1][0] = $aDim[0]/2 +$x
$aPosCenter[1][1] = $aDim[1]/2 +$y

While 1
    _GDIPlus_GraphicsClear ( $hGfx_Buffer, 0xFFFFFFFF )
    _GDIPlus_GraphicsFillPolygon ( $hGfx_Buffer, $aPoints )
    _GDIPlus_GraphicsTransformPoints ( $hGfx_Buffer, $aPosCenter )
    _GDIPlus_GraphicsTranslateTransform ( $hGfx_Buffer, $aPosCenter[1][0], $aPosCenter[1][1] )
    _GDIPlus_GraphicsRotateTransform ( $hGfx_Buffer, 5 )
    _GDIPlus_GraphicsTranslateTransform ( $hGfx_Buffer, -$aPosCenter[1][0], -$aPosCenter[1][1] )
    _GDIPlus_GraphicsDrawImage ( $hGraphic, $hBmp_Buffer, 0, 0 )
    Sleep ( 10 )
WEnd

_GDIPlus_GraphicsDispose ( $hGfx_Buffer )
_GDIPlus_BitmapDispose ( $hBmp_Buffer )
_GDIPlus_GraphicsDispose ( $hGraphic )
_GDIPlus_Shutdown()
Exit

Func _PolygonGetSize ( $aPoints )
    If UBound ( $aPoints, 2 ) <> 2 Then Return SetError ( 1, 0, '' )
    Local $aRet[2]
    Local $iXMin = _ArrayMin ( $aPoints, 1, 1, -1, 0 )
    Local $iYMin = _ArrayMin ( $aPoints, 1, 1, -1, 1 )
    Local $iXMax = _ArrayMax ( $aPoints, 1, 1, -1, 0 )
    Local $iYMax = _ArrayMax ( $aPoints, 1, 1, -1, 1 )
    $aRet[0] = $iXMax - $iXMin +1 ; width
    $aRet[1] = $iYMax - $iYMin +1 ; height
    $aPoints = 0
    Return $aRet
EndFunc ;==> _PolygonGetSize()

Func _PolygonSetPos ( $aPoints, $x=0, $y=0 )
    If UBound ( $aPoints, 2 ) <> 2 Then Return SetError ( 1, 0, '' )
    Local $iXMin = _ArrayMin ( $aPoints, 1, 1, -1, 0 )
    Local $iYMin = _ArrayMin ( $aPoints, 1, 1, -1, 1 )
    For $i = 1 To UBound ( $aPoints ) -1
        $aPoints[$i][0] = $x + $aPoints[$i][0] - $iXMin
        $aPoints[$i][1] = $y + $aPoints[$i][1] - $iYMin
    Next
    Return $aPoints
EndFunc ;==> _PolygonSetPos()

Func _Exit()
    Exit
EndFunc ;==> _Exit()

Edited cause $aPoints Coordinates disapear when posting with AutoIt format.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

a pinch of Shape2Polygon + a pinch of UEZ + a pinch of that post = :D

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <Array.au3>

Local $aPoints = [[215,0],[1,126],[1,128],[0,135],[1,142],[2,149],[3,156],[5,163],[8,170],[11,177],[15,184],[20,191],[25,198],[32,205],[39,212],[46,218],[53,223],[60,227],[67,231],[74,234],[81,237],[88,240],[95,241],[101,240],[97,233],[94,226],[91,219],[89,212],[89,201],[92,194],[99,187],[106,184],[122,184],[129,185],[136,187],[143,189],[150,192],[157,197],[164,204],[167,203],[173,196],[180,190],[187,186],[201,186],[208,188],[215,192],[222,197],[229,204],[235,211],[240,218],[245,225],[249,232],[252,239],[256,245],[260,238],[263,231],[267,224],[271,217],[277,210],[284,203],[291,196],[298,191],[305,188],[312,185],[320,185],[327,186],[334,191],[341,198],[345,205],[349,204],[356,198],[363,193],[370,189],[377,186],[384,184],[396,184],[403,185],[410,187],[417,192],[422,199],[422,213],[420,220],[418,227],[414,234],[409,241],[410,244],[417,242],[424,240],[431,238],[438,234],[445,231],[452,227],[459,222],[466,217],[473,210],[480,203],[486,196],[492,189],[496,182],[501,175],[504,168],[507,161],[509,154],[510,147],[511,140],[510,133],[510,120],[508,113],[506,106],[503,99],[499,92],[494,85],[488,78],[481,71],[474,65],[467,59],[460,54],[453,49],[446,45],[439,41],[432,37],[425,33],[418,30],[411,26],[404,23],[397,21],[390,18],[383,16],[376,13],[370,16],[374,23],[377,30],[379,37],[379,55],[377,62],[374,69],[369,76],[362,83],[355,88],[348,91],[341,93],[333,93],[326,91],[319,88],[312,82],[305,75],[301,68],[297,61],[295,54],[292,47],[291,40],[289,33],[288,26],[287,19],[287,7],[286,0],[281,7],[277,14],[273,21],[271,28],[259,28],[252,29],[245,28],[238,21],[235,14],[231,7],[224,0],[224,17],[223,24],[223,33],[222,40],[220,47],[218,54],[216,61],[213,68],[208,75],[201,82],[194,87],[187,90],[180,92],[171,92],[164,91],[157,89],[150,85],[143,78],[138,71],[134,64],[132,57],[132,40],[134,33],[136,26],[139,19],[137,13],[130,15],[123,18],[116,20],[109,23],[102,26],[95,29],[88,32],[81,35],[74,39],[67,43],[60,47],[53,52],[46,57],[39,63],[32,70],[26,77],[20,84],[15,91],[11,98],[8,105],[5,112],[3,119],[1,126]]

Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] ;would be used in two functions therefore declared as global.
Global $iTheme = 0

Local $hPen, $hPath

$Version = 1; 1 or 2

Example()

$Version = 2; 1 or 2

Example()

Func Example()

    ; Create GUI
    $hGUI = GUICreate("GDI+", _ArrayMax($aPoints) + 100, _ArrayMax($aPoints, 0, -1, -1, 1) + 100)

    ; Fill a rectangle
    _GDIPlus_Startup()
    $tRect_Coords[0] = 0
    $tRect_Coords[1] = 0
    $tRect_Coords[2] = _ArrayMax($aPoints) + 100
    $tRect_Coords[3] = _ArrayMax($aPoints, 0, -1, -1, 1) + 100

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

    $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
    $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
    _GDIPlus_PenSetMiterLimit($hPen, 32)
    _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

    $hMatrix = _GDIPlus_MatrixCreate()

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

    ; move coordinates 50 pixels on x/y axis
    _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
    _GDIPlus_PathTransform($hPath, $hMatrix)

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

    ;Register for painting
    GUIRegisterMsg($WM_PAINT, "WM_PAINT") ;$WM_PAINT

    GUISetState()

    ; Loop until the user exits.

    If $Version = 1 Then

        Do
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop

                Case $GUI_EVENT_PRIMARYDOWN
                    If CheckPointer($tRect_Coords) Then SetThemev1(1)

                Case $GUI_EVENT_PRIMARYUP

                    If CheckPointer($tRect_Coords) Then
                        SetThemev1(2)
                    Else
                        SetThemev1(0)
                    EndIf



                Case $GUI_EVENT_MOUSEMOVE

                    If GetTheme() = 1 Then ContinueLoop

                    If CheckPointer($tRect_Coords) Then
                        SetThemev1(2)
                    Else
                        SetThemev1(0)
                    EndIf

            EndSwitch

        Until 0

    Else

        Do
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop

                Case $GUI_EVENT_PRIMARYDOWN
                    If CheckPointer($tRect_Coords) Then SetThemev2(1)

                Case $GUI_EVENT_PRIMARYUP

                    If CheckPointer($tRect_Coords) Then
                        SetThemev2(2)
                    Else
                        SetThemev2(0)
                    EndIf



                Case $GUI_EVENT_MOUSEMOVE

                    If GetTheme() = 1 Then ContinueLoop

                    If CheckPointer($tRect_Coords) Then
                        SetThemev2(2)
                    Else
                        SetThemev2(0)
                    EndIf

            EndSwitch

        Until 0

    EndIf

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

Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam)

    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)

    ;Your Code must lie below
    ;Paint the string

    _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)

    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)

    Return 0;'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT

Func CheckPointer(ByRef $aiCoords_ClientRel)
    Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[2] + $aiCoords_ClientRel[0], $aiCoords_ClientRel[3] + $aiCoords_ClientRel[1])
EndFunc   ;==>CheckPointer

Func GetTheme()
    Return $iTheme
EndFunc   ;==>GetTheme

Func SetThemev1($Theme, $f_Redraw = true)

    If GetTheme() = $Theme Then Return 1

    If $Theme = 0 Then ;Idle

   $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
    $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
    _GDIPlus_PenSetMiterLimit($hPen, 32)
    _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

    $hMatrix = _GDIPlus_MatrixCreate()

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

    ; move coordinates 50 pixels on x/y axis
    _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
    _GDIPlus_PathTransform($hPath, $hMatrix)

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

    ElseIf $Theme = 1 Then ;MouseDown

        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFF6060, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
        _GDIPlus_PenSetMiterLimit($hPen, 32)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

        $hMatrix = _GDIPlus_MatrixCreate()

        $hPath = _GDIPlus_PathCreate() ;Create new path object

        _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)

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

;~      msgbox(0,"","pressed")

    ElseIf $Theme = 2 Then ;MouseOver

        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFFFF60, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
        _GDIPlus_PenSetMiterLimit($hPen, 32)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

        $hMatrix = _GDIPlus_MatrixCreate()

        $hPath = _GDIPlus_PathCreate() ;Create new path object

        _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)

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

    Else
        Return SetError(1, 0, 0)
    EndIf

    $iTheme = $Theme

    ConsoleWrite("CurTheme: " & $iTheme & @CRLF)
    If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE))

endfunc   ;==>SetTheme

Func SetThemev2($Theme, $f_Redraw = true)

    If GetTheme() = $Theme Then Return 1

    If $Theme = 0 Then ;Idle

   $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
    $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
    _GDIPlus_PenSetMiterLimit($hPen, 32)
    _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

    $hMatrix = _GDIPlus_MatrixCreate()

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

    ; move coordinates 50 pixels on x/y axis
    _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
    _GDIPlus_PathTransform($hPath, $hMatrix)

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

    ElseIf $Theme = 1 Then ;MouseDown

        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFF6060, 0xFFFF6060)
        $hPen = _GDIPlus_PenCreate(0xFFFF6060, 3)
        _GDIPlus_PenSetMiterLimit($hPen, 32)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

        $hMatrix = _GDIPlus_MatrixCreate()

        $hPath = _GDIPlus_PathCreate() ;Create new path object

        _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)

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

;~      msgbox(0,"","pressed")

    ElseIf $Theme = 2 Then ;MouseOver

        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFFFF60, 0xFFFFFF60)
        $hPen = _GDIPlus_PenCreate(0xFFFFFF60, 3)
        _GDIPlus_PenSetMiterLimit($hPen, 32)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)

        $hMatrix = _GDIPlus_MatrixCreate()

        $hPath = _GDIPlus_PathCreate() ;Create new path object

        _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)

        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)

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

    Else
        Return SetError(1, 0, 0)
    EndIf

    $iTheme = $Theme

    ConsoleWrite("CurTheme: " & $iTheme & @CRLF)
    If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE))

endfunc   ;==>SetTheme

any people who improve that have my eternal gratitude ^^

Edited by Synapsee
code update
Link to comment
Share on other sites

Don't know if it's what you want...

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <Array.au3>

Local $aPoints = [[215,0],[1,126],[1,128],[0,135],[1,142],[2,149],[3,156],[5,163],[8,170],[11,177],[15,184],[20,191],[25,198],[32,205],[39,212],[46,218],[53,223],[60,227],[67,231],[74,234],[81,237],[88,240],[95,241],[101,240],[97,233],[94,226],[91,219],[89,212],[89,201],[92,194],[99,187],[106,184],[122,184],[129,185],[136,187],[143,189],[150,192],[157,197],[164,204],[167,203],[173,196],[180,190],[187,186],[201,186],[208,188],[215,192],[222,197],[229,204],[235,211],[240,218],[245,225],[249,232],[252,239],[256,245],[260,238],[263,231],[267,224],[271,217],[277,210],[284,203],[291,196],[298,191],[305,188],[312,185],[320,185],[327,186],[334,191],[341,198],[345,205],[349,204],[356,198],[363,193],[370,189],[377,186],[384,184],[396,184],[403,185],[410,187],[417,192],[422,199],[422,213],[420,220],[418,227],[414,234],[409,241],[410,244],[417,242],[424,240],[431,238],[438,234],[445,231],[452,227],[459,222],[466,217],[473,210],[480,203],[486,196],[492,189],[496,182],[501,175],[504,168],[507,161],[509,154],[510,147],[511,140],[510,133],[510,120],[508,113],[506,106],[503,99],[499,92],[494,85],[488,78],[481,71],[474,65],[467,59],[460,54],[453,49],[446,45],[439,41],[432,37],[425,33],[418,30],[411,26],[404,23],[397,21],[390,18],[383,16],[376,13],[370,16],[374,23],[377,30],[379,37],[379,55],[377,62],[374,69],[369,76],[362,83],[355,88],[348,91],[341,93],[333,93],[326,91],[319,88],[312,82],[305,75],[301,68],[297,61],[295,54],[292,47],[291,40],[289,33],[288,26],[287,19],[287,7],[286,0],[281,7],[277,14],[273,21],[271,28],[259,28],[252,29],[245,28],[238,21],[235,14],[231,7],[224,0],[224,17],[223,24],[223,33],[222,40],[220,47],[218,54],[216,61],[213,68],[208,75],[201,82],[194,87],[187,90],[180,92],[171,92],[164,91],[157,89],[150,85],[143,78],[138,71],[134,64],[132,57],[132,40],[134,33],[136,26],[139,19],[137,13],[130,15],[123,18],[116,20],[109,23],[102,26],[95,29],[88,32],[81,35],[74,39],[67,43],[60,47],[53,52],[46,57],[39,63],[32,70],[26,77],[20,84],[15,91],[11,98],[8,105],[5,112],[3,119],[1,126]]

Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] ;would be used in two functions therefore declared as global.
Global $iTheme = 0

Local $hPen, $hPath
$Version = 1; 1 or 2
Example()
$Version = 2; 1 or 2
Example()

Func Example()
    ; Create GUI
    $hGUI = GUICreate("GDI+", _ArrayMax($aPoints) + 100, _ArrayMax($aPoints, 0, -1, -1, 1) + 100)
    ; Fill a rectangle
    _GDIPlus_Startup()
    $tRect_Coords[0] = 0
    $tRect_Coords[1] = 0
    $tRect_Coords[2] = _ArrayMax($aPoints) + 100
    $tRect_Coords[3] = _ArrayMax($aPoints, 0, -1, -1, 1) + 100
    $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)
    $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
    $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
    ;_GDIPlus_PenSetMiterLimit($hPen, 10)
    _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
    $hMatrix = _GDIPlus_MatrixCreate()
    $hPath = _GDIPlus_PathCreate() ;Create new path object
;~     _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
    _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
    ; move coordinates 50 pixels on x/y axis
    _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
    _GDIPlus_PathTransform($hPath, $hMatrix)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    ;Register for painting
    GUIRegisterMsg($WM_PAINT, "WM_PAINT") ;$WM_PAINT
    GUISetState()
    ; Loop until the user exits.
    If $Version = 1 Then
        Do
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $GUI_EVENT_PRIMARYDOWN
                    If CheckPointer($tRect_Coords) Then SetThemev1(1)
                Case $GUI_EVENT_PRIMARYUP
                    If CheckPointer($tRect_Coords) Then
                        SetThemev1(2)
                    Else
                        SetThemev1(0)
                    EndIf
                Case $GUI_EVENT_MOUSEMOVE
                    If GetTheme() = 1 Then ContinueLoop
                    If CheckPointer($tRect_Coords) Then
                        SetThemev1(2)
                    Else
                        SetThemev1(0)
                    EndIf
            EndSwitch
        Until 0
    Else
        Do
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $GUI_EVENT_PRIMARYDOWN
                    If CheckPointer($tRect_Coords) Then SetThemev2(1)
                Case $GUI_EVENT_PRIMARYUP
                    If CheckPointer($tRect_Coords) Then
                        SetThemev2(2)
                    Else
                        SetThemev2(0)
                    EndIf
                Case $GUI_EVENT_MOUSEMOVE
                    If GetTheme() = 1 Then ContinueLoop
                    If CheckPointer($tRect_Coords) Then
                        SetThemev2(2)
                    Else
                        SetThemev2(0)
                    EndIf
            EndSwitch
        Until 0
    EndIf
    ; Clean up resources
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrushFont)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)
    ;Your Code must lie below
    ;Paint the string
    _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)
    Return 0;'GUI_RUNDEFMSG'
EndFunc   ;==>WM_PAINT

Func CheckPointer(ByRef $aiCoords_ClientRel)
    Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[2] + $aiCoords_ClientRel[0], $aiCoords_ClientRel[3] + $aiCoords_ClientRel[1])
EndFunc   ;==>CheckPointer

Func GetTheme()
    Return $iTheme
EndFunc   ;==>GetTheme

Func SetThemev1($Theme, $f_Redraw = true)
    If GetTheme() = $Theme Then Return 1
    If $Theme = 0 Then ;Idle
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    ElseIf $Theme = 1 Then ;MouseDown
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFF6060, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
;~      msgbox(0,"","pressed")
    ElseIf $Theme = 2 Then ;MouseOver
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFFFF60, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3 )
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    Else
        Return SetError(1, 0, 0)
    EndIf
    $iTheme = $Theme
    ConsoleWrite("CurTheme: " & $iTheme & @CRLF)
    If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE))
endfunc   ;==>SetTheme

Func SetThemev2($Theme, $f_Redraw = true)
    If GetTheme() = $Theme Then Return 1
    If $Theme = 0 Then ;Idle
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFF606060, 0xFF000000)
        $hPen = _GDIPlus_PenCreate(0xFF202020, 3)
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    ElseIf $Theme = 1 Then ;MouseDown
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFF6060, 0xFFFF6060)
        $hPen = _GDIPlus_PenCreate(0xFFFF6060, 3)
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
;~      msgbox(0,"","pressed")
    ElseIf $Theme = 2 Then ;MouseOver
        $hBrush = _GDIPlus_HatchBrushCreate(35, 0xFFFFFF60, 0xFFFFFF60)
        $hPen = _GDIPlus_PenCreate(0xFFFFFF60, 3)
        ;_GDIPlus_PenSetMiterLimit($hPen, 10)
        _GDIPlus_PenSetDashCap($hPen,  $GDIP_DASHCAPROUND)
        $hMatrix = _GDIPlus_MatrixCreate()
        $hPath = _GDIPlus_PathCreate() ;Create new path object
;~         _GDIPlus_PathAddClosedCurve2($hPath, $aPoints, 7.5)
        _GDIPlus_PathAddPolygon ( $hPath, $aPoints )
        ; move coordinates 50 pixels on x/y axis
        _GDIPlus_MatrixTranslate($hMatrix, 50, 50)
        _GDIPlus_PathTransform($hPath, $hMatrix)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)
    Else
        Return SetError(1, 0, 0)
    EndIf
    $iTheme = $Theme
    ConsoleWrite("CurTheme: " & $iTheme & @CRLF)
    If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE))
endfunc   ;==>SetTheme

 

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...