I couldn't leave it alone 😀 There was a bug that caused different offsets to change the overall size of the image, this fixes that.
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
$main = GUICreate(" ", 300, 300, -1, -1)
GUICtrlCreatePic("", 15, 15, 256, 256)
CreateBG(-1, 250, 0XFFFF9000)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
;Main Process Loop ======================================================================================
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
;== Graphic Functions ======================================
Func CreateBG($control, $gw, $color)
_GDIPlus_Startup()
Local $ghandle = _GDIPlus_GraphicsCreateFromHWND($main)
Local $hImage = _GDIPlus_BitmapCreateFromGraphics($gw, $gw, $ghandle)
Local $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
Local $hBrush = _GDIPlus_BrushCreateSolid($color)
Local $hBrush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
Local $hPath = _GDIPlus_PathCreate()
Local $nBorderSize = 100
$gw -= $nBorderSize; ;Offset to allow for scaling
Local $nOffset = $nBorderSize/2
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 5)
;Path used instead of Graphic
_GDIPlus_PathAddEllipse($hPath, 0+$nOffset, ($gw/8)+$nOffset, ($gw/4), ($gw*0.75))
_GDIPlus_PathAddEllipse($hPath, ($gw/8)+$nOffset, 0+$nOffset, ($gw*0.75), ($gw/4))
_GDIPlus_PathAddEllipse($hPath, ($gw-($gw/4))+$nOffset, ($gw/8)+$nOffset, ($gw/4), ($gw*0.75))
_GDIPlus_PathAddEllipse($hPath, ($gw/8)+$nOffset, ($gw-($gw/4))+$nOffset, ($gw*0.75), ($gw/4))
_GDIPlus_PathAddEllipse($hPath, ($gw/18)+$nOffset, ($gw/18)+$nOffset, ($gw*0.375), ($gw*0.375))
_GDIPlus_PathAddEllipse($hPath, ($gw-($gw*0.43))+$nOffset, ($gw/18)+$nOffset, ($gw*0.375), ($gw*0.375))
_GDIPlus_PathAddEllipse($hPath, ($gw-($gw*0.43))+$nOffset, ($gw-($gw*0.43))+$nOffset, ($gw*0.375), ($gw*0.375))
_GDIPlus_PathAddEllipse($hPath, ($gw/18)+$nOffset, ($gw-($gw*0.43))+$nOffset, ($gw*0.375), ($gw*0.375))
_GDIPlus_PathAddEllipse($hPath, ($gw/8)+$nOffset, ($gw/8)+$nOffset, ($gw*.75), ($gw*.75))
_GDIPlus_PathCloseFigure($hPath)
_GDIPlus_PathSetFillMode($hPath, 1) ;Set fill mode to union
Local $hPath2 = _GDIPlus_PathClone($hPath) ;Clone the first path
Local $hPen_Widen = _GDIPlus_PenCreate(0, $nBorderSize)
_GDIPlus_PenSetLineJoin($hPen_Widen, $GDIP_PENSETLINEJOIN_ROUND)
_GDIPlus_PathWiden($hPath2, $hPen_Widen) ;Widen second path
_GDIPlus_GraphicsFillPath($hGraphic, $hPath2, $hBrush2) ; IMPORTANT Fill second path to graphic first
_GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Then first path on top
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_WinAPI_DeleteObject(GUICtrlSendMsg($control, $STM_SETIMAGE, $IMAGE_BITMAP, $hbitmap))
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_PathDispose($hPath)
_GDIPlus_PathDispose($hPath2)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Endfunc