Wie kann ich mit einem meine Code zu tun? Höher Ich benutzte DrawImage.
Beiträge von DemetriVeni
-
-
Guten Tag. Ich möchte das Bild zu speichern in einem transparenten PNG. Sag mir, warum nicht funktioniert?
AutoIt
Alles anzeigen#include <GDIPlus.au3> #include <misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; ; Draw by mouse ; Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 2) $hwnd = GUICreate("Sample", 400, 400, -1, -1, -1, $WS_EX_LAYERED) $button1 = GUICtrlCreateButton("save",10,5) GUICtrlSetOnEvent(-1, "save") GUISetBkColor(0xABCDEF, $hwnd) GUISetOnEvent(-3, "close") GUISetState() _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) ;_GDIPlus_GraphicsClear($graphics, 0xFFFFFFFF) $pen = _GDIPlus_PenCreate(0xFF000000,3,0) _WINAPI_SetLayeredWindowAttributes($hwnd, 0xABCDEF,255) $dll = DllOpen("user32.dll") Do If _IsPressed("01", $dll) And WinActive("Sample") Then $oldpos=MouseGetPos() _GDIPlus_GraphicsDrawRect($graphics,$oldpos[0],$oldpos[1],1,1,$pen) Do $pos = MouseGetPos() _GDIPlus_GraphicsDrawLine($graphics,$oldpos[0],$oldpos[1],$pos[0],$pos[1],$pen) $oldpos=$pos Until Not _IsPressed("01", $dll) EndIf Sleep(25) Until False Func save() $bitmap = _GDIPlus_BitmapCreateFromGraphics ( 400, 400, $graphics) $hCtxt = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) _GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0) _GDIPlus_ImageSaveToFile($bitmap, @DesktopDir & "\qqqqqqqqqqqq.png") EndFunc;==>save Func close() _GDIPlus_PenDispose($pen) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc ;==>close