der code is der von eukalyptus, ich habe ihn mir 1 zu 1 kopiert nur um ihn zu testen, doch er funktioniert bei mir ja nicht, ich habe an dem Code nichts verändert, ausser dass ich die UDF GDIP.au3 included habe mehr nicht
Eigener GDIPlus Button Style
-
- [ offen ]
-
Facemix -
20. Dezember 2013 um 19:06 -
Geschlossen -
Erledigt
-
-
Dann lade die Beta doch einfach herunter und installiere sie. Ansonsten warte bis die Finale Version veröffentlicht wird (bald ist Weihnachten )
Gruß,
UEZ -
wenn ich die Beta Lade, muss ich dann meine ganzen Scripte umschreiben, damit sie in der Beta funktionieren? oder kann ich sie dann einfach in der beta genauso übernehmen?
-
"Probieren geht über studieren".
Dazu kann ich nichts sagen, da ich deine Skripte nicht kenne, aber einige "Script Breaking Changes" gibt es schon.
Die Beta ersetzt nicht die aktuelle Version, sondern sie wird parallel installiert und du kannst die Beta mit Alt+F5 aufrufen.
Gruß,
UEZ -
Also ich habe jetzt die Beta geladen habe aber auch noch meine Vorherige Version drauf, jetzt kann ich auswählen, in welcher Version ich das Script laufen lasse, so funktioniert jetzt auch das Script von eukalytus (ohne GDIP.au3) aber wäre es nicht möglich das Script so umzuschreiben, dass die Beta ncht notwendig ist? ausserdem bin ich mit den Funktionen nicht vertraut die er da benutzt, daher kann ich nicht erkennen, mit welcher er die Buttons tatsächlich zeichnet, denn diese brauche ich
-
Du kannst die Funktionen aus der Beta inkludieren, entweder manuell oder per Wrapper.
[autoit]
[/autoit]
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/SODu benötigst die SciTE Vollversion (separate Datei).
Nach dem Kompilieren solltest du eine <Dein_Skript>_Obfuscated.au3 in dem gleichen Verzeichnis finden. In diesem Skript sind alle Variablen / Funktionen aus den Include Dateien integriert. Du kannst nun die entsprechenden Funktionen und Variablen in dein Skript kopieren, so dass dein Skript auch mit der aktuellen finalen Version läuft.
Gruß,
UEZ -
Da war ich wohl zu langsam. Ich habe das Script von eukalyptus kurz umgeschrieben um es unter der aktuellen stable zum Funktionieren zu bringen.
Spoiler anzeigen
[autoit]#include <GDIP.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>Opt("MustDeclareVars", 1)
[/autoit] [autoit][/autoit] [autoit]
Opt("GUIOnEventMode", 1)Global $iWidth = 610
[/autoit] [autoit][/autoit] [autoit]
Global $iHeight = 200
Global $hGui = GUICreate("GDI+ Path Tutorial", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
_GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)
GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT")GUISetState()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_DrawButton("Button", 10, 30, 160, 100, 0xFFDD3030)
[/autoit] [autoit][/autoit] [autoit]
_DrawButton("Text", 210, 30, 160, 100, 0xFF30AA30)
_DrawButton("Abcdefg", 410, 30, 190, 100, 0xFF3040DD)_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While Sleep(10)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
WEndFunc _DrawButton($sText, $fX, $fY, $fW, $fH, $iColor, $fRadius = 40)
[/autoit] [autoit][/autoit] [autoit]
Local $hPath = _GDIPlus_PathCreate()_GDIPlus_PathAddArc($hPath, $fX, $fY, $fRadius, $fRadius, 180, 90)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius, $fY, $fRadius, $fRadius, 270, 90)
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius, $fY + $fH - $fRadius, $fRadius, $fRadius, 0, 90)
_GDIPlus_PathAddArc($hPath, $fX, $fY + $fH - $fRadius, $fRadius, $fRadius, 90, 90)Local $hMatrix = _GDIPlus_MatrixCreate()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_MatrixTranslate($hMatrix, 0, $fH * 0.1)
_GDIPlus_PathTransform($hPath, $hMatrix)Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY)
_GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000)_GDIPlus_PathBrushSetSurroundColor($hBrush, 0x00000000)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 1)
_GDIPlus_PathBrushSetFocusScales($hBrush, 0.85, 0.85)_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($hBrush)_GDIPlus_MatrixTranslate($hMatrix, 0, -$fH * 0.2)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathTransform($hPath, $hMatrix)$hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY)
_GDIPlus_PathBrushSetCenterColor($hBrush, $iColor)
Local $iR = Int(BitAND(BitShift($iColor, 16), 0xFF) * 0.3)
Local $iG = Int(BitAND(BitShift($iColor, 8), 0xFF) * 0.3)
Local $iB = Int(BitAND($iColor, 0xFF) * 0.3)
Local $iColor2 = BitOR(BitShift($iR, -16), BitShift($iG, -8), $iB)
_GDIPlus_PathBrushSetSurroundColor($hBrush, BitOR(0xFF000000, $iColor2))_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 1)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetFocusScales($hBrush, 0.97, 0.3)_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($hBrush)$fRadius *= 0.6
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathReset($hPath)
_GDIPlus_PathAddArc($hPath, $fX + $fRadius * 0.2, $fY, $fRadius, $fRadius, 90, 180)
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius * 1.2, $fY, $fRadius, $fRadius, 270, 180)$hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY + $fRadius * 0.2)
_GDIPlus_PathBrushSetCenterColor($hBrush, 0xDDFFFFFF)
_GDIPlus_PathBrushSetSurroundColor($hBrush, 0x00000000)_GDIPlus_PathBrushSetFocusScales($hBrush, 0.8, 0.2)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 0.9)_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_BrushDispose($hBrush)_GDIPlus_PathReset($hPath)
[/autoit] [autoit][/autoit] [autoit]
Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
Local $hFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hFormat, 1)
DllCall($ghGDIPDll, "int", "GdipSetStringFormatLineAlign", "handle", $hFormat, "int", 1)Local $tLayout = _GDIPlus_RectFCreate($fX, $fY, $fW, $fH)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, 32, $hFormat)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0)
_GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2) + $fX + $fW / 2, -($aBounds[1] + $aBounds[3] / 2) + $fY + $fH * 0.48)
;_GDIPlus_PathTransform($hPath, $hMatrix)
_GDIPlus_MatrixDispose($hMatrix)$aBounds = _GDIPlus_PathGetWorldBounds($hPath)
[/autoit] [autoit][/autoit] [autoit]
$hBrush = _GDIPlus_LineBrushCreate(0, $aBounds[1] - 4, 0, $aBounds[1] + $aBounds[3] + 4, BitOR(0x40000000, $iColor2), 0x40FFFFFF)
Local $hPen = _GDIPlus_PenCreate2($hBrush, 4)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
_GDIPlus_PenDispose($hPen)$hPen = _GDIPlus_PenCreate(BitOR(0x70000000, $iColor2), 2)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
_GDIPlus_PenDispose($hPen)$hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
_GDIPlus_BrushDispose($hBrush)_GDIPlus_PathDispose($hPath)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>_DrawButtonFunc _GDIPlus_PathBrushSetSurroundColor($hPathGradientBrush, $iARGB)
[/autoit] [autoit][/autoit] [autoit]
;Quickly put together by name22. No error handling whatsoever.
Local $iPointCount = _GDIPlus_PathBrushGetPointCount($hPathGradientBrush)
Local $aSurroundColors[$iPointCount + 1] = [$iPointCount]For $i = 1 To $aSurroundColors[0]
[/autoit] [autoit][/autoit] [autoit]
$aSurroundColors[$i] = $iARGB
NextReturn _GDIPlus_PathBrushSetSurroundColorsWithCount($hPathGradientBrush, $aSurroundColors)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
EndFuncFunc WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_PAINTFunc _Exit()
[/autoit]
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Das ist aber alles andere als sauber, daher empfehle ich UEZs Vorschlag. -
muss jetzt allerdings sagen, dass die Funktion von name22 besser funktioniert als die von UEZ weis nicht was ich falsch gemacht habe. name22 kann man da noch ein return einbauen?
-
Ich weiß leider nicht wie im Moment dein Script aussieht. Die sauberste Lösung wäre vermutlich die Beta zu verwenden. Aber für dieses Script sollte meine Lösung genauso gut funktionieren es ist bloß nicht für den breiten Markt geeignet.
Was meinst mit Return einbauen? -
Ich habe doch keine Version gepostet!
Egal, hier die konvertierte Version mittels Wrapper und habe die Ternary Anweisung durch If/Then ersetzt:
Spoiler anzeigen
[autoit]
[/autoit]
Global Const $GDIP_PXF32ARGB = 0x0026200A
Global Const $GDIP_SMOOTHINGMODE_DEFAULT = 0
Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS8X8 = 5
Global Const $tagRECT = "struct;long Left;long Top;long Right;long Bottom;endstruct"
Global Const $tagGDIPRECTF = "struct;float X;float Y;float Width;float Height;endstruct"
Global Const $tagGDIPSTARTUPINPUT = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
Global $tagREBARBANDINFO = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader"
If (@OSVersion <> "WIN_XP") Then $tagREBARBANDINFO &= ";" & $tagRECT & ";uint uChevronState"
Global Const $HGDI_ERROR = Ptr(-1)
Global Const $INVALID_HANDLE_VALUE = Ptr(-1)
Global Const $KF_EXTENDED = 0x0100
Global Const $KF_ALTDOWN = 0x2000
Global Const $KF_UP = 0x8000
Global Const $LLKHF_EXTENDED = BitShift($KF_EXTENDED,
Global Const $LLKHF_ALTDOWN = BitShift($KF_ALTDOWN,
Global Const $LLKHF_UP = BitShift($KF_UP,
Global Const $tagOSVERSIONINFO = 'struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct'
Global Const $__WINVER = __WINVER()
Func __WINVER()
Local $tOSVI = DllStructCreate($tagOSVERSIONINFO)
DllStructSetData($tOSVI, 1, DllStructGetSize($tOSVI))
Local $Ret = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVI)
If @error Or Not $Ret[0] Then Return SetError(@error, @extended, 0)
Return BitOR(BitShift(DllStructGetData($tOSVI, 2), -8), DllStructGetData($tOSVI, 3))
EndFunc ;==>__WINVER
Global $ghGDIPBrush = 0
Global $ghGDIPDll = 0
Global $ghGDIPPen = 0
Global $giGDIPRef = 0
Global $giGDIPToken = 0
Global $gbGDIP_V1_0 = True
Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iPixelFormat = $GDIP_PXF32ARGB, $iStride = 0, $pScan0 = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[6]
EndFunc ;==>_GDIPlus_BitmapCreateFromScan0
Func _GDIPlus_BitmapDispose($hBitmap)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $hBitmap)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_BitmapDispose
Func _GDIPlus_BrushCreateSolid($iARGB = 0xFF000000)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateSolidFill", "int", $iARGB, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[2]
EndFunc ;==>_GDIPlus_BrushCreateSolid
Func _GDIPlus_BrushDispose($hBrush)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeleteBrush", "handle", $hBrush)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_BrushDispose
Func _GDIPlus_FontFamilyCreate($sFamily, $pCollection = 0)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateFontFamilyFromName", "wstr", $sFamily, "ptr", $pCollection, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[3]
EndFunc ;==>_GDIPlus_FontFamilyCreate
Func _GDIPlus_FontFamilyDispose($hFamily)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeleteFontFamily", "handle", $hFamily)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_FontFamilyDispose
Func _GDIPlus_GraphicsClear($hGraphics, $iARGB = 0xFF000000)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipGraphicsClear", "handle", $hGraphics, "dword", $iARGB)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsClear
Func _GDIPlus_GraphicsCreateFromHWND($hWnd)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateFromHWND", "hwnd", $hWnd, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[2]
EndFunc ;==>_GDIPlus_GraphicsCreateFromHWND
Func _GDIPlus_GraphicsDispose($hGraphics)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeleteGraphics", "handle", $hGraphics)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsDispose
Func _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, $nX, $nY)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImage", "handle", $hGraphics, "handle", $hImage, "float", $nX, "float", $nY)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsDrawImage
Func _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen = 0)
__GDIPlus_PenDefCreate($hPen)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawPath", "handle", $hGraphics, "handle", $hPen, "handle", $hPath)
__GDIPlus_PenDefDispose()
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsDrawPath
Func _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush = 0)
__GDIPlus_BrushDefCreate($hBrush)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hGraphics, "handle", $hBrush, "handle", $hPath)
__GDIPlus_BrushDefDispose()
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsFillPath
Func _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $iSmooth)
If $iSmooth < $GDIP_SMOOTHINGMODE_DEFAULT Or $iSmooth > $GDIP_SMOOTHINGMODE_ANTIALIAS8X8 Then $iSmooth = $GDIP_SMOOTHINGMODE_DEFAULT
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "handle", $hGraphics, "int", $iSmooth)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_GraphicsSetSmoothingMode
Func _GDIPlus_ImageGetGraphicsContext($hImage)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageGraphicsContext", "handle", $hImage, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[2]
EndFunc ;==>_GDIPlus_ImageGetGraphicsContext
Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0)
Local $tPointF1, $tPointF2, $aResult
$tPointF1 = DllStructCreate("float;float")
$tPointF2 = DllStructCreate("float;float")
DllStructSetData($tPointF1, 1, $nX1)
DllStructSetData($tPointF1, 2, $nY1)
DllStructSetData($tPointF2, 1, $nX2)
DllStructSetData($tPointF2, 2, $nY2)
$aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[6]
EndFunc ;==>_GDIPlus_LineBrushCreate
Func _GDIPlus_MatrixCreate()
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateMatrix", "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[1]
EndFunc ;==>_GDIPlus_MatrixCreate
Func _GDIPlus_MatrixDispose($hMatrix)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeleteMatrix", "handle", $hMatrix)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_MatrixDispose
Func _GDIPlus_MatrixSetElements($hMatrix, $nM11 = 1, $nM12 = 0, $nM21 = 0, $nM22 = 1, $nDX = 0, $nDY = 0)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetMatrixElements", "handle", $hMatrix, "float", $nM11, "float", $nM12, "float", $nM21, "float", $nM22, "float", $nDX, "float", $nDY)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_MatrixSetElements
Func _GDIPlus_MatrixTranslate($hMatrix, $fOffsetX, $fOffsetY, $bAppend = False)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipTranslateMatrix", "handle", $hMatrix, "float", $fOffsetX, "float", $fOffsetY, "int", $bAppend)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_MatrixTranslate
Func _GDIPlus_PathAddArc($hPath, $nX, $nY, $nWidth, $nHeight, $fStartAngle, $fSweepAngle)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "float", $fStartAngle, "float", $fSweepAngle)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathAddArc
Func _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, $iStyle = 0, $fSize = 8.5, $hFormat = 0)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathString", "handle", $hPath, "wstr", $sString, "int", -1, "handle", $hFamily, "int", $iStyle, "float", $fSize, "struct*", $tLayout, "handle", $hFormat)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathAddString
Func _GDIPlus_PathBrushCreateFromPath($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[2]
EndFunc ;==>_GDIPlus_PathBrushCreateFromPath
Func _GDIPlus_PathBrushSetCenterColor($hPathGradientBrush, $iARGB)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hPathGradientBrush, "uint", $iARGB)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathBrushSetCenterColor
Func _GDIPlus_PathBrushSetCenterPoint($hPathGradientBrush, $nX, $nY)
Local $tPointF = DllStructCreate("float;float")
DllStructSetData($tPointF, 1, $nX)
DllStructSetData($tPointF, 2, $nY)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterPoint", "handle", $hPathGradientBrush, "struct*", $tPointF)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathBrushSetCenterPoint
Func _GDIPlus_PathBrushSetFocusScales($hPathGradientBrush, $fScaleX, $fScaleY)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientFocusScales", "handle", $hPathGradientBrush, "float", $fScaleX, "float", $fScaleY)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathBrushSetFocusScales
Func _GDIPlus_PathBrushSetSigmaBlend($hPathGradientBrush, $fFocus, $fScale = 1)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSigmaBlend", "handle", $hPathGradientBrush, "float", $fFocus, "float", $fScale)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathBrushSetSigmaBlend
Func _GDIPlus_PathBrushSetSurroundColor($hPathGradientBrush, $iARGB)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hPathGradientBrush, "uint*", $iARGB, "int*", 1)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathBrushSetSurroundColor
Func _GDIPlus_PathCreate($iFillMode = 0)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $iFillMode, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[2]
EndFunc ;==>_GDIPlus_PathCreate
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathDispose
Func _GDIPlus_PathGetWorldBounds($hPath, $hMatrix = 0, $hPen = 0)
Local $tRectF = DllStructCreate($tagGDIPRECTF)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetPathWorldBounds", "handle", $hPath, "struct*", $tRectF, "handle", $hMatrix, "handle", $hPen)
If @error Then Return SetError(@error, @extended, -1)
If $aResult[0] Then Return SetError(10, $aResult[0], -1)
Local $aRectF[4]
For $iI = 1 To 4
$aRectF[$iI - 1] = DllStructGetData($tRectF, $iI)
Next
Return $aRectF
EndFunc ;==>_GDIPlus_PathGetWorldBounds
Func _GDIPlus_PathReset($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipResetPath", "handle", $hPath)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathReset
Func _GDIPlus_PathTransform($hPath, $hMatrix)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipTransformPath", "handle", $hPath, "handle", $hMatrix)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PathTransform
Func _GDIPlus_PenCreate($iARGB = 0xFF000000, $fWidth = 1, $iUnit = 2)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePen1", "dword", $iARGB, "float", $fWidth, "int", $iUnit, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[4]
EndFunc ;==>_GDIPlus_PenCreate
Func _GDIPlus_PenCreate2($hBrush, $fWidth = 1, $iUnit = 2)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePen2", "handle", $hBrush, "float", $fWidth, "int", $iUnit, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[4]
EndFunc ;==>_GDIPlus_PenCreate2
Func _GDIPlus_PenDispose($hPen)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePen", "handle", $hPen)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_PenDispose
Func _GDIPlus_RectFCreate($nX = 0, $nY = 0, $nWidth = 0, $nHeight = 0)
Local $tRectF = DllStructCreate($tagGDIPRECTF)
DllStructSetData($tRectF, "X", $nX)
DllStructSetData($tRectF, "Y", $nY)
DllStructSetData($tRectF, "Width", $nWidth)
DllStructSetData($tRectF, "Height", $nHeight)
Return $tRectF
EndFunc ;==>_GDIPlus_RectFCreate
Func _GDIPlus_Shutdown()
If $ghGDIPDll = 0 Then Return SetError(-1, -1, False)
$giGDIPRef -= 1
If $giGDIPRef = 0 Then
DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ulong_ptr", $giGDIPToken)
DllClose($ghGDIPDll)
$ghGDIPDll = 0
EndIf
Return True
EndFunc ;==>_GDIPlus_Shutdown
Func _GDIPlus_Startup($sGDIPDLL = Default)
$giGDIPRef += 1
If $giGDIPRef > 1 Then Return True
If $sGDIPDLL = Default Then
If @OSBuild > 4999 And @OSBuild < 7600 Then
$sGDIPDLL = @WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll"
Else
$sGDIPDLL = "gdiplus.dll"
EndIf
EndIf
$ghGDIPDll = DllOpen($sGDIPDLL)
If $ghGDIPDll = -1 Then
$giGDIPRef = 0
Return SetError(1, 2, False)
EndIf
Local $sVer = FileGetVersion($sGDIPDLL)
$sVer = StringSplit($sVer, ".")
If $sVer[1] > 5 Then $gbGDIP_V1_0 = False
Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
Local $tToken = DllStructCreate("ulong_ptr Data")
DllStructSetData($tInput, "Version", 1)
Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
$giGDIPToken = DllStructGetData($tToken, "Data")
Return True
EndFunc ;==>_GDIPlus_Startup
Func _GDIPlus_StringFormatCreate($iFormat = 0, $iLangID = 0)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateStringFormat", "int", $iFormat, "word", $iLangID, "handle*", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] Then Return SetError(10, $aResult[0], 0)
Return $aResult[3]
EndFunc ;==>_GDIPlus_StringFormatCreate
Func _GDIPlus_StringFormatDispose($hFormat)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeleteStringFormat", "handle", $hFormat)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_StringFormatDispose
Func _GDIPlus_StringFormatSetAlign($hStringFormat, $iFlag)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetStringFormatAlign", "handle", $hStringFormat, "int", $iFlag)
If @error Then Return SetError(@error, @extended, False)
If $aResult[0] Then Return SetError(10, $aResult[0], False)
Return True
EndFunc ;==>_GDIPlus_StringFormatSetAlign
Func __GDIPlus_BrushDefCreate(ByRef $hBrush)
If $hBrush = 0 Then
$ghGDIPBrush = _GDIPlus_BrushCreateSolid()
$hBrush = $ghGDIPBrush
EndIf
EndFunc ;==>__GDIPlus_BrushDefCreate
Func __GDIPlus_BrushDefDispose($icurError = @error, $icurExtended = @extended)
If $ghGDIPBrush <> 0 Then
_GDIPlus_BrushDispose($ghGDIPBrush)
$ghGDIPBrush = 0
EndIf
Return SetError($icurError, $icurExtended)
EndFunc ;==>__GDIPlus_BrushDefDispose
Func __GDIPlus_PenDefCreate(ByRef $hPen)
If $hPen = 0 Then
$ghGDIPPen = _GDIPlus_PenCreate()
$hPen = $ghGDIPPen
EndIf
EndFunc ;==>__GDIPlus_PenDefCreate
Func __GDIPlus_PenDefDispose($icurError = @error, $icurExtended = @extended)
If $ghGDIPPen <> 0 Then
_GDIPlus_PenDispose($ghGDIPPen)
$ghGDIPPen = 0
EndIf
Return SetError($icurError, $icurExtended)
EndFunc ;==>__GDIPlus_PenDefDispose
Global Const $GUI_EVENT_CLOSE = -3
Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG'
Global Const $WS_SIZEBOX = 0x00040000
Global Const $WM_PAINT = 0x000F
Global Const $WM_ERASEBKGND = 0x0014
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $iWidth = 610
Global $iHeight = 200
Global $hGui = GUICreate("GDI+ Path Tutorial", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
_GDIPlus_Startup()
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
_GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)
GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT")
GUISetState()
_DrawButton("Button", 10, 30, 160, 100, 0xFFDD3030)
_DrawButton("Text", 210, 30, 160, 100, 0xFF30AA30)
_DrawButton("Abcdefg", 410, 30, 190, 100, 0xFF3040DD)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
While Sleep(10)
WEnd
Func _DrawButton($sText, $fX, $fY, $fW, $fH, $iColor, $fRadius = 40)
Local $hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddArc($hPath, $fX, $fY, $fRadius, $fRadius, 180, 90)
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius, $fY, $fRadius, $fRadius, 270, 90)
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius, $fY + $fH - $fRadius, $fRadius, $fRadius, 0, 90)
_GDIPlus_PathAddArc($hPath, $fX, $fY + $fH - $fRadius, $fRadius, $fRadius, 90, 90)
Local $hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, 0, $fH * 0.1)
_GDIPlus_PathTransform($hPath, $hMatrix)
Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY)
_GDIPlus_PathBrushSetCenterColor($hBrush, 0xFF000000)
_GDIPlus_PathBrushSetSurroundColor($hBrush, 0x00000000)
_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 1)
_GDIPlus_PathBrushSetFocusScales($hBrush, 0.85, 0.85)
_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_MatrixTranslate($hMatrix, 0, -$fH * 0.2)
_GDIPlus_PathTransform($hPath, $hMatrix)
$hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY)
_GDIPlus_PathBrushSetCenterColor($hBrush, $iColor)
Local $iR = Int(BitAND(BitShift($iColor, 16), 0xFF) * 0.3)
Local $iG = Int(BitAND(BitShift($iColor, 8), 0xFF) * 0.3)
Local $iB = Int(BitAND($iColor, 0xFF) * 0.3)
Local $iColor2 = BitOR(BitShift($iR, -16), BitShift($iG, -8), $iB)
_GDIPlus_PathBrushSetSurroundColor($hBrush, BitOR(0xFF000000, $iColor2))
_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 1)
_GDIPlus_PathBrushSetFocusScales($hBrush, 0.97, 0.3)
_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
_GDIPlus_BrushDispose($hBrush)
$fRadius *= 0.6
_GDIPlus_PathReset($hPath)
_GDIPlus_PathAddArc($hPath, $fX + $fRadius * 0.2, $fY, $fRadius, $fRadius, 90, 180)
_GDIPlus_PathAddArc($hPath, $fX + $fW - $fRadius * 1.2, $fY, $fRadius, $fRadius, 270, 180)
$hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
_GDIPlus_PathBrushSetCenterPoint($hBrush, $fX + $fW * 0.5, $fY + $fRadius * 0.2)
_GDIPlus_PathBrushSetCenterColor($hBrush, 0xDDFFFFFF)
_GDIPlus_PathBrushSetSurroundColor($hBrush, 0x00000000)
_GDIPlus_PathBrushSetFocusScales($hBrush, 0.8, 0.2)
_GDIPlus_PathBrushSetSigmaBlend($hBrush, 1, 0.9)
_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PathReset($hPath)
Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
Local $hFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hFormat, 1)
DllCall($ghGDIPDll, "int", "GdipSetStringFormatLineAlign", "handle", $hFormat, "int", 1)
Local $tLayout = _GDIPlus_RectFCreate($fX, $fY, $fW, $fH)
_GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, 32, $hFormat)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)
_GDIPlus_MatrixSetElements($hMatrix)
_GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2) + $fX + $fW / 2, -($aBounds[1] + $aBounds[3] / 2) + $fY + $fH * 0.48)
_GDIPlus_MatrixDispose($hMatrix)
$aBounds = _GDIPlus_PathGetWorldBounds($hPath)
$hBrush = _GDIPlus_LineBrushCreate(0, $aBounds[1] - 4, 0, $aBounds[1] + $aBounds[3] + 4, BitOR(0x40000000, $iColor2), 0x40FFFFFF)
Local $hPen = _GDIPlus_PenCreate2($hBrush, 4)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
_GDIPlus_PenDispose($hPen)
$hPen = _GDIPlus_PenCreate(BitOR(0x70000000, $iColor2), 2)
_GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
_GDIPlus_PenDispose($hPen)
$hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
_GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PathDispose($hPath)
EndFunc ;==>_DrawButton
Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_PAINT
Func _Exit()
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_ExitGruß,
UEZ -
UEZ bei mir sah es genauso aus, aber hatte nicht funktioniert beim ausführen
-