So, ein Beispiel:
Spoiler anzeigen
#include <GDIPlus.au3>
#include <GUIConstants.au3>
$iGUIWidth = 400
$iGUIHeight = 400
$GUIColorBG = 0xFF000000
$iAngle = 1
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Test", $iGUIWidth, $iGUIHeight)
GUISetState()
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
$hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
_GDIPlus_GraphicsClear($hGraphic, $GUIColorBG)
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test.png")
$hTextureBrush = _GDIPlus_TextureCreate2($hImage, 0, 0, 300, 300)
AdlibRegister("_Draw", 20)
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
AdlibUnRegister()
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_BrushDispose($hTextureBrush)
_GDIPlus_Shutdown()
Exit
EndSwitch
WEnd
Func _Draw()
$iAngle += 1
_GDIPlus_GraphicsClear($hBuffer, $GUIColorBG)
_GDIPlus_GraphicsFillPie($hBuffer, 50, 50, 100, 100, 90, $iAngle, $hTextureBrush)
_GDIPlus_GraphicsFillEllipse($hBuffer, 83, 83, 36, 36)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)
EndFunc
;Die Funktionen sind nicht von mir!!
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_TextureCreate
; Description ...: Creates a TextureBrush object based on an image and a wrap mode
; Syntax.........: _GDIPlus_TextureCreate($hImage[, $iWrapMode = 0])
; Parameters ....: $hImage - Pointer to an Image object
; $iWrapMode - Wrap mode that specifies how repeated copies of an image are used to tile an area when it is
; +painted with the texture brush:
; |0 - Tiling without flipping
; |1 - Tiles are flipped horizontally as you move from one tile to the next in a row
; |2 - Tiles are flipped vertically as you move from one tile to the next in a column
; |3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column
; |4 - No tiling takes place
; Return values .: Success - Pointer to a new TextureBrush object
; Failure - 0 and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: The size of the brush defaults to the size of the image, so the entire image is used by the brush
; After you are done with the object, call _GDIPlus_BrushDispose to release the object resources
; Related .......: _GDIPlus_BrushDispose
; Link ..........; @@MsdnLink@@ GdipCreateTexture
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_TextureCreate($hImage, $iWrapMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "hwnd", $hImage, "int", $iWrapMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[3]
EndFunc ;==>_GDIPlus_TextureCreate
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_TextureCreate2
; Description ...: Creates a TextureBrush object based on an image, a wrap mode and a defining rectangle
; Syntax.........: _GDIPlus_TextureCreate2($hImage, $nX, $nY, $nWidth, $nHeight[, $iWrapMode = 0])
; Parameters ....: $hImage - Pointer to an Image object
; $nX - Leftmost coordinate of the image portion to be used by this brush
; $nY - Uppermost coordinate of the image portion to be used by this brush
; $nWidth - Width of the brush and width of the image portion to be used by the brush
; $nHeight - Height of the brush and height of the image portion to be used by the brush
; $iWrapMode - Wrap mode that specifies how repeated copies of an image are used to tile an area when it is
; +painted with the texture brush:
; |0 - Tiling without flipping
; |1 - Tiles are flipped horizontally as you move from one tile to the next in a row
; |2 - Tiles are flipped vertically as you move from one tile to the next in a column
; |3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column
; |4 - No tiling takes place
; Return values .: Success - Pointer to a new TextureBrush object
; Failure - 0 and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: After you are done with the object, call _GDIPlus_BrushDispose to release the object resources
; Related .......: _GDIPlus_BrushDispose
; Link ..........; @@MsdnLink@@ GdipCreateTexture2
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_TextureCreate2($hImage, $nX, $nY, $nWidth, $nHeight, $iWrapMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture2", "hwnd", $hImage, "int", $iWrapMode, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[7]
EndFunc ;==>_GDIPlus_TextureCreate2
Müsste genau das machen was du gesagt hast. ![]()
Wofür ist das ganze? Vielleicht geht es auch einfacher. ![]()