#include <GDIP.au3>

$iWidth = 1150
$iHeight = Sqrt($iWidth ^ 2 - ($iWidth / 2) ^ 2)
$iIterations = 5 ;Bitte vorsichtig erhöhen, da ALLE Koordinaten des Fraktals zum selben Zeitpunkt im Speicher sind.

$hWnd = GUICreate("GDI+ Sierpinski-Triangle | Iterations: " & $iIterations, $iWidth, $iHeight)
GUISetState()

_GDIPlus_Startup()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
$hBitmap2 = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
$hBuffer1 = _GDIPlus_ImageGetGraphicsContext($hBitmap1)
$hBuffer2 = _GDIPlus_ImageGetGraphicsContext($hBitmap2)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer1, 2)
_GDIPlus_GraphicsSetInterpolationMode($hBuffer1, 2)
_GDIPlus_GraphicsSetInterpolationMode($hBuffer2, 2)
_GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF)

;~ Dim $aPoints[4][2] = [[3],[0, 0],[$iWidth, 0],[$iWidth / 2, $iHeight]]
;~ _GDIPlus_GraphicsFillPolygon($hBuffer1, $aPoints)
_GDIPlus_GraphicsFillEllipse($hBuffer1, $iWidth / 2 - $iHeight / 2, 0, $iHeight, $iHeight) ;Durch beliebige geometrische Figur ersetzen. Bilder sind auch möglich.

For $iI = 1 To $iIterations
	If Mod($iI, 2) Then
		$hBuffer = $hBuffer2
		$hBitmap = $hBitmap1
	Else
		$hBuffer = $hBuffer1
		$hBitmap = $hBitmap2
	EndIf
	_GDIPlus_GraphicsClear($hBuffer, 0)
	_GDIPlus_GraphicsDrawImageRect($hBuffer, $hBitmap, 0, 0, $iWidth / 2, $iHeight / 2)
	_GDIPlus_GraphicsDrawImageRect($hBuffer, $hBitmap, $iWidth / 2, 0, $iWidth / 2, $iHeight / 2)
	_GDIPlus_GraphicsDrawImageRect($hBuffer, $hBitmap, $iWidth / 4, $iHeight / 2, $iWidth / 2, $iHeight / 2)
Next

If Mod($iIterations + 1, 2) Then
	$hBuffer = $hBuffer2
	$hBitmap = $hBitmap1
Else
	$hBuffer = $hBuffer1
	$hBitmap = $hBitmap2
EndIf
_GDIPlus_GraphicsTranslateTransform($hGraphics, $iWidth / 2, $iHeight / 2)
_GDIPlus_GraphicsRotateTransform($hGraphics, 180)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, -$iWidth / 2, -$iHeight / 2, $iWidth, $iHeight)

_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hBuffer1)
_GDIPlus_GraphicsDispose($hBuffer2)
_GDIPlus_BitmapDispose($hBitmap1)
_GDIPlus_BitmapDispose($hBitmap2)
_GDIPlus_Shutdown()

While GUIGetMsg() <> -3
WEnd
