Search the Community
Showing results for tags 'gdi'.
-
I wrote a dll and the wrapper to convert non-animated WebP images to a GDI/GDI+ format / encode any GDI+ supported image to WebP format for use in Autoit. What is WebP? You can find more information about WebP and WebP tools / source codes here: https://developers.google.com/speed/webp Maybe useful for one or the other... 🙂 WebP.au3: ;Version 0.3.1 build 2022-06-13 beta #include-once #include <GDIPlus.au3> Enum $WEBP_PRESET_DEFAULT = 0, _ ; default preset. $WEBP_PRESET_PICTURE, _ ; digital picture, like portrait, inner shot $WEBP_PRESET_PHOTO, _ ; outdoor photograph, with natural lighting $WEBP_PRESET_DRAWING, _ ; hand or line drawing, with high-contrast details $WEBP_PRESET_ICON, _ ; small-sized colorful images $WEBP_PRESET_TEXT ; text-like ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_Ver ; Description ...: Displays the DLL version information in a messagebox window ; Syntax ........: WebP_Ver([$sPath2DLL = ""]) ; Parameters ....: $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: None ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_Ver($sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found DllCall($sDLL, "none", "WebP_DLL_Version") Return True EndFunc ;==>WebP_Ver ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_Ver2 ; Description ...: Returns the DLL version information ; Syntax ........: WebP_Ver([$sPath2DLL = ""]) ; Parameters ....: $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: DLL version ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func WebP_Ver2($sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Return DllCall($sDLL, "str", "Web_DLL_Version2")[0] EndFunc ;==>WebP_Ver ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapGetInfo ; Description ...: Gets some rudimentary information about the WebP image ; Syntax ........: WebP_BitmapGetInfo($sFilename[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - file to load ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: Struct ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapGetInfo($sFilename, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If Not FileExists($sFilename) Then Return SetError(2, 0, 0) ;file not found Local $iFileSize = FileGetSize($sFilename), $nBytes Local $tBuffer = DllStructCreate("struct;byte bin[" & $iFileSize & "];endstruct") Local Const $hFile = _WinAPI_CreateFile($sFilename, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iFileSize, $nBytes) _WinAPI_CloseHandle($hFile) If Int(BinaryMid($tBuffer.bin, 1, 4)) <> 1179011410 Or Int(BinaryMid($tBuffer.bin, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tWebPBitstreamFeatures = DllStructCreate("struct;long width; long height; long has_alpha; long has_animation; long format; ulong pad[5];endstruct") Local $iReturn = DllCall($sDLL, "long", "WebP_BitmapGetInfo", "struct*", $tBuffer, "uint", $iFileSize, "struct*", $tWebPBitstreamFeatures) If $iReturn = 0 Then Return SetError(4, 0, 0) Return $tWebPBitstreamFeatures EndFunc ;==>WebP_BitmapGetInfo ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapCreateGDIp ; Description ...: Converts (decodes) a WebP image from disk to a GDI / GDI+ bitmap handle ; Syntax ........: WebP_BitmasFilename[, $bGDIImage = False[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename - file to load ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). If True then output is GDI bitmap handle ; $bCountColors - [optional] a boolean value. Default is False. If True then the colors will be counted and saved in extended. Use @extended to get color count. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: GDI / GDIPlus bitmap handle and color count if $bCountColors = True in extended. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Currently only WebP images are supported - no animated WebP images yet! ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapCreateGDIp($sFilename, $bGDIImage = False, $bCountColors = False, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If Not FileExists($sFilename) Then Return SetError(2, 0, 0) ;file not found Local $iFileSize = FileGetSize($sFilename), $nBytes Local $tBuffer = DllStructCreate("byte bin[" & $iFileSize & "]") Local Const $hFile = _WinAPI_CreateFile($sFilename, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, $iFileSize, $nBytes) _WinAPI_CloseHandle($hFile) If Int(BinaryMid($tBuffer.bin, 1, 4)) <> 1179011410 Or Int(BinaryMid($tBuffer.bin, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tColors = DllStructCreate("struct;ulong cc;endstruct") Local Const $hBitmap = DllCall($sDLL, "ptr", "WebP_BitmapCreateGDIp", "struct*", $tBuffer, "uint", $iFileSize, "boolean", $bGDIImage, "boolean", $bCountColors, "struct*", $tColors)[0] If $hBitmap = 0 Then Return SetError(4, 0, 0) Return SetExtended($tColors.cc, $hBitmap) EndFunc ;==>WebP_BitmapCreateGDIp ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_BitmapCreateGDIpFromMem ; Description ...: Converts (decodes) a WebP image from memory to a GDI / GDI+ bitmap handle ; Syntax ........: WebP_BitmapCreateGDIpFromMem($tBuffer[, $iBufferSize = 0[, $bGDIImage = False[, $sPath2DLL = ""]]]) ; Parameters ....: $tBuffer - a dll struct with WebP binary data as content or pointer to the memory data ; $iBufferSize - the size of the binary data (file size) ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). If True then output is GDI bitmap handle ; $bCountColors - [optional] a boolean value. Default is False. If True then the colors will be counted and saved in extended. Use @extended to get color count. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir ; Return values .: GDI / GDIPlus bitmap handle and color count if $bCountColors = True in extended. ; Author ........: UEZ ; Modified ......: ; Remarks .......: Currently only WebP images are supported - no animated WebP images yet! ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_BitmapCreateGDIpFromMem($tBuffer, $iBufferSize = 0, $bGDIImage = False, $bCountColors = False, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found If $iBufferSize = 0 Then Return SetError(2, 0, 0) Local $binMem If IsPtr($tBuffer) Then Local $tMem = DllStructCreate("byte bin[" & $iBufferSize & "]", $tBuffer) $binMem = $tMem.bin Else $binMem = DllStructGetData($tBuffer, 1) EndIf If Int(BinaryMid($binMem, 1, 4)) <> 1179011410 Or Int(BinaryMid($binMem, 9, 6)) <> 88331643929943 Then Return SetError(3, 0, 0) ;header must contain RIFF and WEBPVP Local $tColors = DllStructCreate("struct;ulong cc;endstruct") Local Const $hBitmap = DllCall($sDLL, "ptr", "WebP_BitmapCreateGDIp", "struct*", $tBuffer, "uint", $iBufferSize, "boolean", $bGDIImage, "boolean", $bCountColors, "struct*", $tColors)[0] If $hBitmap = 0 Then Return SetError(4, 0, 0) Return SetExtended($tColors.cc, $hBitmap) EndFunc ;==>WebP_BitmapCreateGDIpFromMem ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPLossySimpleFromBitmap ; Description ...: Converts a bitmap to WebP lossy image and save it to HD ; Syntax ........: WebP_CreateWebPLossySimpleFromBitmap($sFilename, $hBitmap[, $iQuality = 75[, $sPath2DLL = ""]]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $iQuality - [optional] an integer value. Default is 75. Valid range is 0 - 100. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 0 for failure, 1 for success. ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPLossySimpleFromBitmap($sFilename, $hBitmap, $iQuality = 75, $sPath2DLL = "") If $sFilename = "" Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPLossySimpleFromBitmap", "str", $sFilename, "ptr", $hBitmap, "float", $iQuality)[0] If $iReturn = 0 Then Return SetError(3, 0, 0) Return 1 EndFunc ;==>WebP_CreateWebPLossySimpleFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPLosslessSimpleFromBitmap ; Description ...: Converts a bitmap to WebP lossless image and save it to HD ; Syntax ........: WebP_CreateWebPLosslessSimpleFromBitmap($sFilename, $hBitmap[, $sPath2DLL = ""]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: 0 for failure, 1 for success. ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPLosslessSimpleFromBitmap($sFilename, $hBitmap, $sPath2DLL = "") If $sFilename = "" Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPLosslessSimpleFromBitmap", "str", $sFilename, "ptr", $hBitmap)[0] If $iReturn = 0 Then Return SetError(3, 0, 0) Return 1 EndFunc ;==>WebP_CreateWebPLosslessSimpleFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_CreateWebPAdvancedFromBitmap ; Description ...: Converts a bitmap to WebP lossy / lossless image and save it to HD ; Syntax ........: WebP_CreateWebPAdvancedFromBitmap($sFilename, $hBitmap[, $WebPPreset = $WEBP_PRESET_DEFAULT[, $lossless = 0[, ; $quality = 75.0[, $method = 4[, $sns_strength = 50[, $filter_sharpness = 0[, $filter_strength = 60[, ; $pass = 1[, $level = 6[, $sPath2DLL = ""]]]]]]]]]]) ; Parameters ....: $sFilename - file to load ; $hBitmap - GDIPlus bitmap handle ; $WebPPreset - [optional] an unknown value. Default is $WEBP_PRESET_DEFAULT. ; $lossless - [optional] an unknown value. Default is 0. 0 for lossy encoding / 1 for lossless.. ; $quality - [optional] an unknown value. Default is 75.0. Valid range is 0 - 100. ; $method - [optional] a map. Default is 4. Valid range is 0 - 6 (0=fast, 6=slower-better). ; $sns_strength - [optional] a string value. Default is 50. Spatial Noise Shaping. 0=off, 100=maximum ; $filter_sharpness - [optional] a floating point value. Default is 0. Range: [0 = off .. 7 = least sharp] ; $filter_strength - [optional] a floating point value. Default is 60. Range: [0 = off .. 100 = strongest] ; $pass - [optional] a pointer value. Default is 1. Number of entropy-analysis passes (in [1..10]). ; $level - [optional] an unknown value. Default is 6. Between 0 (fastest, lowest compression) and 9 (slower, best compression) only valid for lossless = 1! ; $near_lossless - [optional] an unknown value. Default is 100. Near lossless encoding [0 = max loss .. 100 = off (default)]. ; $alpha_compression - [optional] an unknown value. Default is 1. Algorithm for encoding the alpha plane (0 = none,1 = compressed with WebP lossless). Default is 1. ; $alpha_filtering - [optional] an unknown value. Default is 1. Predictive filtering method for alpha plane.0: none, 1: fast, 2: best. Default if 1. ; $alpha_quality - [optional] an unknown value. Default is 100. Between 0 (smallest size) and 100 (lossless). Default is 100. ; $target_size - [optional] an unknown value. Default is 0. If non-zero, set the desired target size in bytes. ; $NoSave - [optional] an unknown value. Default is False. ; $pMem - [optional] a string value. Default is Null. If $NoSave = True then the pointer to the memory which holds the data will be returned. ; $pCallback - [optional] a pointer value. Default is 0. Pointer to a callback address for progress hook. ; $sPath2DLL - [optional] a string value. Default is "". Path to WebP dll if not in script dir. ; Return values .: negative value for failure, 1 for success or the struct with information (pointers, size) if $NoSave = True ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_CreateWebPAdvancedFromBitmap($sFilename, $hBitmap, $WebPPreset = $WEBP_PRESET_DEFAULT, $lossless = 0, $quality = 75.0, $method = 4, $sns_strength = 50, _ $filter_sharpness = 0, $filter_strength = 60, $pass = 1, $level = 6, $near_lossless = 100, $alpha_compression = 1, $alpha_filtering = 1, $alpha_quality = 100, _ $target_size = 0, $NoSave = False, $pCallback = 0, $sPath2DLL = "") If $sFilename = "" And Not $NoSave Then Return SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $tMem = DllStructCreate("struct;ptr pPic; ptr pWriter; ptr pMemData; uint memsize;endstruct") Local $iReturn = DllCall($sDLL, "long", "WebP_CreateWebPAdvancedFromBitmap", _ "str", $sFilename, _ ;Webp filename "ptr", $hBitmap, _ ;handle to GDI+ bitmap "long", $WebPPreset, _ ;WebPPreset "long", $lossless, _ ;lossless "float", $quality, _ ;quality "long", $method, _ ;method "long", $sns_strength, _ ;sns_strength "long", $filter_sharpness, _ ;filter_sharpness "long", $filter_strength, _ ;filter_strength "long", $pass, _ ;pass "long", $level, _ ;level "long", $near_lossless, _ ;near_lossless "long", $alpha_compression, _ ;alpha_compression "long", $alpha_filtering, _ ;alpha_filtering "long", $alpha_quality, _ ;alpha_quality "long", $target_size, _ ;target_size "bool", $NoSave, _ ; "struct*", $tMem, _ ; "ptr", @AutoItX64 ? $pCallback : 0)[0] ;x86 crashes for unknown reason If $iReturn < 0 Then Return SetError(3, 0, $iReturn) If $NoSave And $tMem.memsize = 0 Then SetError(4, 0, 0) Return $NoSave ? $tMem : $iReturn EndFunc ;==>WebP_CreateWebPAdvancedFromBitmap ; #FUNCTION# ==================================================================================================================== ; Name ..........: WebP_FreeUp ; Description ...: Release the ressources from $tMem struct ; Syntax ........: WebP_FreeUp(Byref $tMem[, $sPath2DLL = ""]) ; Parameters ....: $tMem - [in/out] a dll struct value. ; $sPath2DLL - [optional] a string value. Default is "". ; Return values .: 1 ; Author ........: UEZ ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://developers.google.com/speed/webp ; Example .......: No ; =============================================================================================================================== Func WebP_FreeUp(ByRef $tMem, $sPath2DLL = "") Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found Local $iReturn = DllCall($sDLL, "long", "WebP_FreeUp", "struct*", $tMem)[0] Return $iReturn EndFunc ;==>WebP_FreeUp ; #FUNCTION# ==================================================================================================================== ; Name ..........: BitmapCountColors ; Description ...: Counts the colors used by the bitmap ; Syntax ........: BitmapCountColors($hBitmap) ; Parameters ....: $hBitmap - a handle to a GDI+ bitmap. ; $bGDIImage - [optional] a boolean value. Default is False (GDIPlus bitmap handle). ; Return values .: Number of colors used by the image. ; Author ........: UEZ ; Modified ......: ; Remarks .......: The result may differ from other programs for JPG images depending on the decoder. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func BitmapCountColors($hBitmap = 0, $bGDIImage = False, $sPath2DLL = "") If IsPtr($hBitmap) = 0 Or $hBitmap = 0 Then SetError(1, 0, 0) Local $sDLL = Path2DLL($sPath2DLL) If Not FileExists($sDLL) Then Return SetError(2, 0, 0) ;DLL not found Local $iReturn = DllCall(Path2DLL(), "ulong", "BitmapCountColors", "ptr", $hBitmap)[0] Return $iReturn EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: Path2DLL ; Description ...: Return the path to the _WebP_x??.dll ; Author ........: UEZ ; Modified.......: ; Remarks .......: This function is used internally by WebP.au3 ; =============================================================================================================================== Func Path2DLL($sPath2DLL = "") Return $sPath2DLL ? $sPath2DLL : @ScriptDir & (@AutoItX64 ? "\_WebP_x64.dll" : "\_WebP_x86.dll") EndFunc ;==>Path2DLL WebP Advanced Encoder GUI: ;Coded by UEZ build 2022-06-18 #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_HiDpi=n #AutoIt3Wrapper_Version=p #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe ;/rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #pragma compile(Icon, WebP_logo_2010_by_Simo99.ico) #pragma compile(FileVersion, 0.9.9.0) #pragma compile(ProductVersion, 3.3.16.1) #pragma compile(CompanyName, "UEZ Software Development") #pragma compile(ProductName, "WebP Advanced Encoder GUI") AutoItSetOption("MustDeclareVars", 1) #include <Array.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <GuiStatusBar.au3> #include <Memory.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> #include "WebP.au3" Break(0) If @OSBuild < 10240 Then MsgBox($MB_ICONWARNING, "Warning", "Your Windows version is not support!", 30) If WebP_Ver2() < "0.3.1" Then Exit MsgBox($MB_ICONERROR, "ERROR", "DLL Version v0.3.1+ required!", 30) Global Const $ver = "v0.99", $build = "build 2022-06-18" #Region TichySID Global Const $tagIMAGE_DOS_HEADER = 'WORD e_magic;WORD e_cblp;WORD e_cp;WORD e_crlc;WORD e_cparhdr;WORD e_minalloc;WORD e_maxalloc;WORD e_ss;WORD e_sp;WORD e_csum;WORD e_ip;WORD e_cs;WORD e_lfarlc;WORD e_ovno;WORD e_res[4];WORD e_oemid;WORD e_oeminfo;WORD e_res2[10];LONG e_lfanew;' Global Const $tagIMAGE_FILE_HEADER = 'WORD Machine;WORD NumberOfSections;DWORD TimeDateStamp;DWORD PointerToSymbolTable;DWORD NumberOfSymbols;WORD SizeOfOptionalHeader;WORD Characteristics;' Global $tagIMAGE_OPTIONAL_HEADER = 'WORD Magic;BYTE MajorLinkerVersion;BYTE MinorLinkerVersion;DWORD SizeOfCode;DWORD SizeOfInitializedData;DWORD SizeOfUninitializedData;DWORD AddressOfEntryPoint;DWORD BaseOfCode;DWORD BaseOfData;PTR ImageBase;DWORD SectionAlignment;DWORD FileAlignment;WORD MajorOperatingSystemVersion;WORD MinorOperatingSystemVersion;WORD MajorImageVersion;WORD MinorImageVersion;WORD MajorSubsystemVersion;WORD MinorSubsystemVersion;DWORD Win32VersionValue;DWORD SizeOfImage;DWORD SizeOfHeaders;DWORD CheckSum;WORD Subsystem;WORD DllCharacteristics;PTR SizeOfStackReserve;PTR SizeOfStackCommit;PTR SizeOfHeapReserve;PTR SizeOfHeapCommit;DWORD LoaderFlags;DWORD NumberOfRvaAndSizes;' If @AutoItX64 Then $tagIMAGE_OPTIONAL_HEADER = 'WORD Magic;BYTE MajorLinkerVersion;BYTE MinorLinkerVersion;DWORD SizeOfCode;DWORD SizeOfInitializedData;DWORD SizeOfUninitializedData;DWORD AddressOfEntryPoint;DWORD BaseOfCode;PTR ImageBase;DWORD SectionAlignment;DWORD FileAlignment;WORD MajorOperatingSystemVersion;WORD MinorOperatingSystemVersion;WORD MajorImageVersion;WORD MinorImageVersion;WORD MajorSubsystemVersion;WORD MinorSubsystemVersion;DWORD Win32VersionValue;DWORD SizeOfImage;DWORD SizeOfHeaders;DWORD CheckSum;WORD Subsystem;WORD DllCharacteristics;PTR SizeOfStackReserve;PTR SizeOfStackCommit;PTR SizeOfHeapReserve;PTR SizeOfHeapCommit;DWORD LoaderFlags;DWORD NumberOfRvaAndSizes;' Global Const $tagIMAGE_NT_HEADER = 'DWORD Signature;' & $tagIMAGE_FILE_HEADER & $tagIMAGE_OPTIONAL_HEADER Global Const $tagIMAGE_SECTION_HEADER = 'CHAR Name[8];DWORD VirtualSize;DWORD VirtualAddress;DWORD SizeOfRawData;DWORD PointerToRawData;DWORD PointerToRelocations;DWORD PointerToLinenumbers;WORD NumberOfRelocations;WORD NumberOfLinenumbers;DWORD Characteristics;' Global Const $tagIMAGE_DATA_DIRECTORY = 'DWORD VirtualAddress;DWORD Size;' Global Const $tagIMAGE_BASE_RELOCATION = 'DWORD VirtualAddress;DWORD SizeOfBlock;' Global Const $tagIMAGE_IMPORT_DESCRIPTOR = 'DWORD OriginalFirstThunk;DWORD TimeDateStamp;DWORD ForwarderChain;DWORD Name;DWORD FirstThunk;' Global Const $tagIMAGE_IMPORT_BY_NAME = 'WORD Hint;char Name[1];' Global Const $tagIMAGE_EXPORT_DIRECTORY = 'DWORD Characteristics;DWORD TimeDateStamp;WORD MajorVersion;WORD MinorVersion;DWORD Name;DWORD Base;DWORD NumberOfFunctions;DWORD NumberOfNames;DWORD AddressOfFunctions;DWORD AddressOfNames;DWORD AddressOfNameOrdinals;' Global $_KERNEL32DLL = DllOpen('kernel32.dll') Global $_MFHookPtr, $_MFHookBak, $_MFHookApi = 'LocalCompact' Global Const $tagModule = 'PTR ExportList;PTR CodeBase;PTR ImportList;PTR DllEntry;DWORD Initialized;' Global Const $SID_MEMORY = 1 Global Const $SID_NON_DEFAULT = 2 Global $hTitchysidDll, $iSubsongCount = 0 #EndRegion ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware ; enum _MONITOR_DPI_TYPE Global Enum $MDT_EFFECTIVE_DPI = 0, $MDT_ANGULAR_DPI, $MDT_RAW_DPI Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI Global Const $SM_CXPADDEDBORDER = 92 _GDIPlus_Startup() ;~ Global $aDPI = _WinAPI_GetDpiForMonitor() ;_GDIPlus_GraphicsGetDPIRatio() Global $aDPI = [1, 1] Global $hGUI_About, $iFPS = 0, $iShowFPS = 0, $bExit, $bGUIBgColor = 0xFF808080 #Region GUI Global Const $SC_DRAGMOVE = 0xF012, $iW = 322, $iH = 694 Global Const $hGUI = GUICreate("WAE GUI " & $ver & " Beta by UEZ", $iW, $iH, @DesktopWidth - 330, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_APPWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUISetFont(10 * $aDPI[0], 400, 0, "Arial Narrow") Global Const $Title = GUICtrlCreateLabel("WebP Advanced Encoder GUI", 5, 8, 310, 41) GUICtrlSetFont(-1, 21 * $aDPI[0], 400, 0, "Arial Narrow") Global Const $icLoad = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -127, 8, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Load a GDI+ supported image") Global Const $icSave = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -259, 56, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Save compressed image in WebP format.") Global Const $icReset = GUICtrlCreateIcon(@SystemDir & "\shell32.dll", -239, 104, 60, 32, 32, BitOR($GUI_SS_DEFAULT_ICON, $WS_BORDER)) GUICtrlSetTip(-1, "Reset image position if image was moved (only for images larger than preview window).") GUICtrlCreateLabel("", 0, 106, 324, 2, $SS_ETCHEDHORZ) Global Const $lbPresets = GUICtrlCreateLabel("Presets", 10, 125, 39, 20) Global Const $cbPreset = GUICtrlCreateCombo("Default", 120, 120, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)), $hcbPreset = GUICtrlGetHandle($cbPreset) GUICtrlSetData(-1, "Picture|Photo|Drawing|Icon|Text") Global Const $chkbLossless = GUICtrlCreateCheckbox("&Lossless", 120, 152, 97, 17) GUICtrlSetTip(-1, "Enable lossless compression. Default: lossy.") Global Const $lbEncoding = GUICtrlCreateLabel("Encoding", 10, 152, 48, 20) Global Const $lbQuality = GUICtrlCreateLabel("Quality", 10, 176, 36, 20) Global Const $slQuality = GUICtrlCreateSlider(116, 176, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslQuality = GUICtrlGetHandle($slQuality) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 75) GUICtrlSetTip(-1, "Between 0 and 100. 0 gives the smallest size and 100 the largest.") Global Const $ipQuality = GUICtrlCreateInput("", 274, 172, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slQuality)) Global Const $lbMethod = GUICtrlCreateLabel("Method", 10, 210, 39, 20) Global Const $slMethod = GUICtrlCreateSlider(116, 210, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslMethod = GUICtrlGetHandle($slMethod) GUICtrlSetLimit(-1, 6, 0) GUICtrlSetData(-1, 4) GUICtrlSetTip(-1, "Quality/speed trade-off (0=fast, 6=slower-better.") Global Const $ipMethod = GUICtrlCreateInput("", 274, 206, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slMethod)) Global Const $lbSNS_Strength = GUICtrlCreateLabel("SNS-Strength", 10, 242, 66, 20) Global Const $slSNS_Strength = GUICtrlCreateSlider(116, 244, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslSNS_Strength = GUICtrlGetHandle($slSNS_Strength) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 50) GUICtrlSetTip(-1, "Spatial Noise Shaping. 0=off, 100=maximum.") Global Const $ipSSN_Strength = GUICtrlCreateInput("", 274, 240, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slSNS_Strength)) Global Const $lbFilterSharpness = GUICtrlCreateLabel("Filter Sharpness", 10, 274, 81, 20) Global Const $slFilter_Sharpness = GUICtrlCreateSlider(116, 278, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslFilter_Sharpness = GUICtrlGetHandle($slFilter_Sharpness) GUICtrlSetLimit(-1, 7, 0) GUICtrlSetTip(-1, "Range: [0 = off .. 7 = least sharp].") Global Const $ipFilter_Sharpness = GUICtrlCreateInput("", 274, 274, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slFilter_Sharpness)) Global Const $lbFilter_Strength = GUICtrlCreateLabel("Filter Strenght", 010, 304, 69, 20) Global Const $slFilter_Strength = GUICtrlCreateSlider(116, 312, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslFilter_Strength = GUICtrlGetHandle($slFilter_Strength) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 60) GUICtrlSetTip(-1, "Range: [0 = off .. 100 = strongest]") Global Const $ipFilter_Strength = GUICtrlCreateInput("", 274, 308, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slFilter_Strength)) Global Const $lbPass = GUICtrlCreateLabel("Pass", 10, 344, 27, 20) Global Const $slPass = GUICtrlCreateSlider(116, 346, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslPass = GUICtrlGetHandle($slPass) GUICtrlSetLimit(-1, 10, 1) GUICtrlSetData(-1, 6) GUICtrlSetTip(-1, "Number of entropy-analysis passes (in [1..10]).") Global Const $ipPass = GUICtrlCreateInput("", 274, 342, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slPass)) Global Const $lbNear_Lossless = GUICtrlCreateLabel("Near Lossless", 10, 378, 80, 20) Global Const $slNear_Lossless = GUICtrlCreateSlider(116, 380, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslNear_Lossless = GUICtrlGetHandle($slNear_Lossless) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 60) GUICtrlSetTip(-1, "Specify the level of near-lossless image preprocessing. The range is 0 (maximum preprocessing) to 100 (no preprocessing, the default).") Global Const $ipNear_Lossless = GUICtrlCreateInput("", 274, 374, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slNear_Lossless)) Global Const $lbLevel = GUICtrlCreateLabel("Level", 10, 411, 30, 20) Global Const $slLevel = GUICtrlCreateSlider(116, 414, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslLevel = GUICtrlGetHandle($slLevel) GUICtrlSetLimit(-1, 9, 0) GUICtrlSetData(-1, 6) GUICtrlSetTip(-1, "Switch on lossless compression mode with the specified level between 0 and 9, with level 0 being the fastest, 9 being the slowest.") Global Const $ipLevel = GUICtrlCreateInput("", 274, 410, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slLevel)) Global Const $lbAlpha_Compression = GUICtrlCreateLabel("Alpha Compression", 10, 444, 96, 20) Global Const $chkbAlpha_Compression = GUICtrlCreateCheckbox("&Enable", 120, 444, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global Const $lbAlpha_Filtering = GUICtrlCreateLabel("Alpha Filtering", 10, 478, 71, 20) Global Const $slAlpha_Filtering = GUICtrlCreateSlider(114, 482, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslAlpha_Filtering = GUICtrlGetHandle($slAlpha_Filtering) GUICtrlSetLimit(-1, 2, 0) GUICtrlSetData(-1, 1) GUICtrlSetTip(-1, "Predictive filtering method for alpha plane. 0: none, 1: fast, 2: best. Default if 1.") Global Const $ipAlpha_Filtering = GUICtrlCreateInput("", 274, 478, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slAlpha_Filtering)) Global Const $lbAlpha_Quality = GUICtrlCreateLabel("Alpha Quality", 8, 516, 66, 20) Global Const $slAlpha_Quality = GUICtrlCreateSlider(114, 516, 158, 21, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_ENABLESELRANGE)), $hslAlpha_Quality = GUICtrlGetHandle($slAlpha_Quality) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData(-1, 100) GUICtrlSetTip(-1, "Between 0 (smallest size) and 100 (lossless).") Global Const $ipAlpha_Quality = GUICtrlCreateInput("", 274, 512, 28, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY)) GUICtrlSetData(-1, GUICtrlRead($slAlpha_Quality)) Global Const $lbTarget_Size = GUICtrlCreateLabel("Target Size", 10, 552, 58, 20) Global Const $ipTarget_Size = GUICtrlCreateInput("0", 120, 550, 121, 24, $ES_NUMBER) GUICtrlSetTip(-1, "If non-zero, set the desired target size in bytes (lossy mode only!).") Global Const $chkbCountColors = GUICtrlCreateCheckbox("&Count Colors", 10, 590, 87, 17) Global Const $lbColorOriginal = GUICtrlCreateLabel("Source:", 101, 590, 38, 20) Global Const $ipColorOriginal = GUICtrlCreateInput("0", 142, 588, 60, 24, BitOR($ES_NUMBER, $ES_READONLY)) Global Const $lbColorWebP = GUICtrlCreateLabel("WebP:", 215, 590, 32, 20) Global Const $ipColorWebP = GUICtrlCreateInput("0", 250, 588, 60, 24, BitOR($ES_NUMBER, $ES_READONLY)) Global Const $btnShow = GUICtrlCreateButton("Show Original Image", 10, 630, 123, 25) GUICtrlSetTip(-1, "Press lmb and hold it to display original image.") Global Const $btnApply = GUICtrlCreateButton("&Apply Settings", 188, 630, 123, 25) Global Const $StatusBar = _GUICtrlStatusBar_Create($hGUI), $iSBColor = 0xE9CFEC _WinAPI_SetWindowTheme($StatusBar, "", "") _GUICtrlStatusBar_SetText($StatusBar, " Welcome to 'WebP Advanced Encoder GUI' ٩(●̮̮̃•̃)۶") _GUICtrlStatusBar_SetBkColor($StatusBar, $iSBColor) Global Const $hGUI_Image = GUICreate("", 0, 0, -1, -1, $WS_EX_TOOLWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_APPWINDOW)) GUISetBkColor(BitAND(0xFFFFFF, $bGUIBgColor), $hGUI_Image) Global Const $iPic_WebP = GUICtrlCreatePic("", 0, 0, 0, 0), $hPic_WebP = GUICtrlGetHandle($iPic_WebP) ;~ Global Const $iW_Zoom = @DesktopWidth * 0.25, $iH_Zoom = @DesktopHeight * 0.25 ;~ Global Const $hGUI_Image_Zoom = GUICreate("", $iW_Zoom, $iH_Zoom, 0, 0, $WS_POPUP) Global Const $dw = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME), $dh = _WinAPI_GetSystemMetrics($SM_CYDLGFRAME) + _WinAPI_GetSystemMetrics($SM_CYSIZE) + 1 Global Enum $idAbout = 5000, $idResetPicPos, $idResetValues Global Const $hMenu_Sys = _GUICtrlMenu_GetSystemMenu($hGUI) _GUICtrlMenu_AppendMenu($hMenu_Sys, $MF_SEPARATOR, 0, 0) _GUICtrlMenu_AppendMenu($hMenu_Sys, $MF_STRING, $idAbout, "About") Global Const $hImage_Icon = _GDIPlus_BitmapCreateFromMemory(_WebP_Icon()) Global Const $hIcon = _GDIPlus_HICONCreateFromBitmap($hImage_Icon) _WinAPI_SetClassLongEx($hGUI, -34, $hIcon) _GDIPlus_ImageDispose($hImage_Icon) GUISetState(@SW_HIDE, $hGUI_Image) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetState(@SW_SHOW, $hGUI_Image_Zoom) _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAwareV2, $hGUI, 2) Global Const $iDummy_About = GUICtrlCreateDummy(), $iDummy_Return = GUICtrlCreateDummy() Global $sFileLoad, $hImage, $hImage_GDI, $hHBitmap, $aDim, $aPixelFormat, $pMemData, $pMemData_Size, $tMem, $mp, $sFileSave, $hFile, $nBytes, $nBytes, $iResetPosX, $iResetPosY, _ $hImage_tmp GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") #EndRegion GUI Global $aGUIGetMsg, $aMPos1, $aMPos2, $iMPx, $iMPy, $iMPx_p = 0, $iMPy_p = 0, $bBigger = False, $iResult, $old_cursor, $bNew = False While 1 $mp = GUIGetCursorInfo($hGUI) If $hImage And $mp[2] And $mp[4] = $btnShow Then _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hImage_GDI)) While $mp[2] $mp = GUIGetCursorInfo($hGUI) Sleep(10) WEnd _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) EndIf $mp = GUIGetCursorInfo($hGUI_Image) $aMPos1 = MouseGetPos() If $mp[4] = $iPic_WebP And $mp[2] And $bBigger And WinActive($hGUI_Image) Then While $mp[2] $mp = GUIGetCursorInfo($hGUI_Image) Sleep(10) $aMPos2 = MouseGetPos() $iMPx = $iMPx_p + $aMPos2[0] - $aMPos1[0] $iMPy = $iMPy_p + $aMPos2[1] - $aMPos1[1] ControlMove($hGUI_Image, "", $iPic_WebP, $iMPx, $iMPy) WEnd $iMPx_p = $iMPx $iMPy_p = $iMPy EndIf $aGUIGetMsg = GUIGetMsg(1) Switch $aGUIGetMsg[1] Case $hGUI Switch $aGUIGetMsg[0] Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_DROPFILES, "") GUIRegisterMsg($WM_LBUTTONDOWN, "") GUIRegisterMsg($WM_COMMAND, "") GUIRegisterMsg($WM_CONTEXTMENU, "") GUIRegisterMsg($WM_SYSCOMMAND, "") GUIRegisterMsg($WM_HSCROLL, "") ;~ If IsDllStruct($tMem) Then WebP_FreeUp($tMem) _WinAPI_DestroyIcon($hIcon) If $hImage_tmp Then _GDIPlus_ImageDispose($hImage_tmp) If $hImage Then _GDIPlus_ImageDispose($hImage) If $hHBitmap Then _WinAPI_DeleteObject($hHBitmap) If $hImage_GDI Then _WinAPI_DeleteObject($hImage_GDI) If $hGUI_Image Then GUIDelete($hGUI_Image) _GDIPlus_Shutdown() GUIDelete($hGUI_Image) GUIDelete($hGUI) DllClose($_KERNEL32DLL) Exit Case $btnApply, $iDummy_Return If $hImage Then CompressAndDisplay($hImage) EndIf Case $icLoad $sFileLoad = FileOpenDialog("Select an image to compress", "", "Images (*.jpg;*.bmp;*.png;*.gif;*.tif;*webp)") If @error Then ContinueLoop LoadImage($sFileLoad) Case $icSave If $hImage Then $sFileSave = FileSaveDialog("Save WebP Image", "", "WebP Image (*.webp)", BitOR($FD_PATHMUSTEXIST, $FD_PROMPTOVERWRITE), StringRegExpReplace($sFileLoad, ".+\\(.+)\..*", "$1") & ".webp", $hGUI) If @error Then ContinueLoop $hFile = _WinAPI_CreateFile($sFileSave, 1) $iResult = _WinAPI_WriteFile($hFile, $tMem.pMemData, $tMem.memsize, $nBytes) _WinAPI_CloseHandle($hFile) If Not $iResult Then MsgBox($MB_ICONERROR, "ERROR", "Unable to save WebP image to disk!", 30, $hGUI) Else MsgBox($MB_ICONINFORMATION, "Information", "WebP image successfully save to disk", 10, $hGUI) EndIf EndIf Case $icReset ResetImage() Case $slAlpha_Filtering GUICtrlSetData($ipAlpha_Filtering, GUICtrlRead($slAlpha_Filtering)) Case $slAlpha_Quality GUICtrlSetData($ipAlpha_Quality, GUICtrlRead($slAlpha_Quality)) Case $slFilter_Sharpness GUICtrlSetData($ipFilter_Sharpness, GUICtrlRead($slFilter_Sharpness)) Case $slFilter_Strength GUICtrlSetData($ipFilter_Strength, GUICtrlRead($slFilter_Strength)) Case $slLevel GUICtrlSetData($ipLevel, GUICtrlRead($slLevel)) Case $slMethod GUICtrlSetData($ipMethod, GUICtrlRead($slMethod)) Case $slNear_Lossless GUICtrlSetData($ipNear_Lossless, GUICtrlRead($slNear_Lossless)) Case $slPass GUICtrlSetData($ipPass, GUICtrlRead($slPass)) Case $slQuality GUICtrlSetData($ipQuality, GUICtrlRead($slQuality)) Case $slSNS_Strength GUICtrlSetData($ipSSN_Strength, GUICtrlRead($slSNS_Strength)) Case $iDummy_About AutoItSetOption("GUIOnEventMode", 1) GDIPlus_About(11 * $aDPI[0], 0.5, 18.5) AutoItSetOption("GUIOnEventMode", 0) EndSwitch Case $hGUI_Image Switch $aGUIGetMsg[0] Case $GUI_EVENT_CLOSE EndSwitch EndSwitch WEnd Func ResetImage() If $bBigger Then $iMPx_p = $iResetPosX $iMPy_p = $iResetPosY ControlMove($hGUI_Image, "", $iPic_WebP, $iMPx_p, $iMPy_p) EndIf EndFunc Func LoadImage($sFileLoad) If $hImage_tmp Then _GDIPlus_ImageDispose($hImage_tmp) If $hImage Then _GDIPlus_ImageDispose($hImage) If $hImage_GDI Then _WinAPI_DeleteObject($hImage_GDI) If StringRight($sFileLoad, 5) = ".webp" Then $hImage_tmp = WebP_BitmapCreateGDIp($sFileLoad) If @error Or $hImage_tmp = 0 Then Return MsgBox($MB_ICONERROR, "ERROR", "Unable to decode WebP image!", 30, $hGUI) EndIf Else $hImage_tmp = _GDIPlus_ImageLoadFromFile($sFileLoad) If @error Or $hImage_tmp = 0 Then Return MsgBox($MB_ICONERROR, "ERROR", "Unknown image format!", 30, $hGUI) EndIf EndIf $aPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage_tmp) ;Local Const $aImageRawFormat = _GDIPlus_ImageGetRawFormat($hImage_tmp) If BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED) Then GUICtrlSetData($ipColorOriginal, BitmapCountColors($hImage_tmp)) Else GUICtrlSetData($ipColorOriginal, 0) EndIf ;~ If $hImage_tmp Then ConsoleWrite("Original color count: " & BitmapCountColors($hImage_tmp) & @CRLF) $aDim = _GDIPlus_ImageGetDimension($hImage_tmp) $hImage = _GDIPlus_BitmapCreateFromScan0($aDim[0], $aDim[1]) Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) If $aPixelFormat[0] = 2498570 Then _GDIPlus_GraphicsClear($hGfx, $bGUIBgColor) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_tmp, 0, 0, $aDim[0], $aDim[1]) _GDIPlus_GraphicsDispose($hGfx) $hImage_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $bNew = True _WinAPI_LockWindowUpdate($hGUI) CompressAndDisplay($hImage, $aPixelFormat[1]) _WinAPI_LockWindowUpdate(0) EndFunc ;==>LoadImage Func CompressAndDisplay($hImage, $sFormat = "") Local $aDim = _GDIPlus_ImageGetDimension($hImage) If $hHBitmap Then _WinAPI_DeleteObject($hHBitmap) $pMemData = 0 $pMemData_Size = 0 Local $iPreset = GUICtrlRead($cbPreset) Switch $iPreset Case "Default" $iPreset = 0 Case "Picture" $iPreset = 1 Case "Photo" $iPreset = 2 Case "Drawing" $iPreset = 3 Case "Icon" $iPreset = 4 Case "Text" $iPreset = 5 EndSwitch ;~ If IsDllStruct($tMem) Then WebP_FreeUp($tMem) $old_cursor = MouseGetCursor() GUISetCursor(15, 1, $hGUI) _GUICtrlStatusBar_SetBkColor($StatusBar, 192) Local $iCallback = DllCallbackRegister("Progress", "long", "long;ptr"), $hCallback = DllCallbackGetPtr($iCallback) Sleep(10) Local $end, $fTimer = TimerInit() $tMem = WebP_CreateWebPAdvancedFromBitmap("", $hImage, _ $iPreset, _ BitAND(GUICtrlRead($chkbLossless), $GUI_CHECKED), _ GUICtrlRead($slQuality), _ GUICtrlRead($slMethod), _ GUICtrlRead($slSNS_Strength), _ GUICtrlRead($slFilter_Sharpness), _ GUICtrlRead($slFilter_Strength), _ GUICtrlRead($slPass), _ GUICtrlRead($slLevel), _ GUICtrlRead($slNear_Lossless), _ BitAND(GUICtrlRead($chkbAlpha_Compression), $GUI_CHECKED), _ GUICtrlRead($slAlpha_Filtering), _ GUICtrlRead($slAlpha_Quality), _ GUICtrlRead($ipTarget_Size), _ True, _ ;hold the compressed image in memory only, no save to HD! $hCallback) $end = TimerDiff($fTimer) DllCallbackFree($hCallback) ToolTip("") _GUICtrlStatusBar_SetBkColor($StatusBar, $iSBColor) GUISetCursor($old_cursor, 1, $hGUI) Local $iColorsWebp = 0 If IsDllStruct($tMem) Then _GUICtrlStatusBar_SetText($StatusBar, "WebP size: " & Round($tMem.memsize / 1024, 2) & " kb / encoded in " & Round($end, 2) & " ms.") $hHBitmap = WebP_BitmapCreateGDIpFromMem($tMem.pMemData, $tMem.memsize, True, BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED)) If @error Then Return MsgBox($MB_ICONERROR, "ERROR", "Unable to compress image", 30, $hGUI) $iColorsWebp = @extended GUICtrlSetData($ipColorWebP, $iColorsWebp) If BitAND(GUICtrlRead($chkbCountColors), $GUI_CHECKED) And GUICtrlRead($ipColorOriginal) = "0" Then GUICtrlSetData($ipColorOriginal, BitmapCountColors($hImage_tmp)) ;~ ConsoleWrite("WebP image color count: " & @extended & @CRLF) Local $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", ""), $tbw = 0, $tbh = 0 If $aTaskbar[2] > $aTaskbar[3] Then $tbh = $aTaskbar[3] ELse $tbw = $aTaskbar[2] EndIf Local Const $minw = 384, $minh = $minw * 10 / 16 Local $maxw = Min($aDim[0] + $dw, @DesktopWidth * 0.95), $maxh = Min($aDim[1] + $dh, @DesktopHeight * 0.95), $iNewW = 0, $iNewH = 0 If $aDim[0] + $dw > @DesktopWidth * 0.95 Or $aDim[1] + $dh > @DesktopHeight * 0.95 Then $bBigger = True Else $bBigger = False EndIf If $bNew Then $iNewW = Max($minw, $maxw) $iNewH = Max($minh, $maxh) WinMove($hGUI_Image, "", (@DesktopWidth - $iNewW - (@DesktopWidth - $iW > $iNewW ? $iW : 0)) / 2 - $tbw, (@DesktopHeight - $iNewH - $tbh) / 2, $iNewW, $iNewH) WinSetTitle($hGUI_Image, "", StringRegExpReplace($sFileLoad, ".+\\(.*)", "$1") & " / " & $aDim[0] & "x" & $aDim[1] & " px / " & $sFormat & " / " & Round(FileGetSize($sFileLoad) / 1024, 2) & " kb") $iNewH -= $dh ;_WinAPI_GetSystemMetrics($SM_CXBORDER) + _WinAPI_GetSystemMetrics($SM_CYSIZE) + _WinAPI_GetSystemMetrics($SM_CXPADDEDBORDER) * 2 $iMPx_p = ($iNewW - $aDim[0]) / 2 $iMPy_p = ($iNewH - $aDim[1] - 4) / 2 $iResetPosX = $iMPx_p $iResetPosY = $iMPy_p GUICtrlSetPos($iPic_WebP, $iMPx_p, $iMPy_p, $iNewW - 1, $iNewH - 1) $bNew = False EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WebP, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) Local Const $iWC_State = WinGetState($hGUI_Image) If $iWC_State <> 7 Or $iWC_State <> 5 Then WinSetState($hGUI_Image, "", @SW_SHOW) WinActivate($hGUI_Image) EndIf WinActivate($hGUI) Else MsgBox($MB_ICONERROR, "ERROR", "DLL encode error " & $tMem, 30) EndIf EndFunc ;==>CompressAndDisplay Func Progress($progress, $ptr) ToolTip($progress & "%", MouseGetPos(0) - 40, MouseGetPos(1)) Return 1 EndFunc Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam Switch $lParam Case $hslAlpha_Filtering GUICtrlSetData($ipAlpha_Filtering, GUICtrlRead($slAlpha_Filtering)) Case $hslAlpha_Quality GUICtrlSetData($ipAlpha_Quality, GUICtrlRead($slAlpha_Quality)) Case $hslFilter_Sharpness GUICtrlSetData($ipFilter_Sharpness, GUICtrlRead($slFilter_Sharpness)) Case $hslFilter_Strength GUICtrlSetData($ipFilter_Strength, GUICtrlRead($slFilter_Strength)) Case $hslLevel GUICtrlSetData($ipLevel, GUICtrlRead($slLevel)) Case $hslMethod GUICtrlSetData($ipMethod, GUICtrlRead($slMethod)) Case $hslNear_Lossless GUICtrlSetData($ipNear_Lossless, GUICtrlRead($slNear_Lossless)) Case $hslPass GUICtrlSetData($ipPass, GUICtrlRead($slPass)) Case $hslQuality GUICtrlSetData($ipQuality, GUICtrlRead($slQuality)) Case $hslSNS_Strength GUICtrlSetData($ipSSN_Strength, GUICtrlRead($slSNS_Strength)) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_HSCROLL Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam) Local $i = 1 Local $aFileList = _WinAPI_DragQueryFileEx($wParam) Do If StringInStr(FileGetAttrib($aFileList[$i]), "D") Then _ArrayDelete($aFileList, $i) Else $i += 1 EndIf Until $i = UBound($aFileList) $aFileList[0] = UBound($aFileList) - 1 $sFileLoad = $aFileList[1] _WinAPI_DragFinish($wParam) LoadImage($sFileLoad) Return 0 EndFunc ;==>WM_DROPFILES# Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func WM_SYSCOMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Switch BitAND($iwParam, 0x0000FFFF) Case $idAbout GUICtrlSendToDummy($iDummy_About) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_SYSCOMMAND Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Switch $iwParam Case 1 GUICtrlSendToDummy($iDummy_Return) Return 0 Case $idResetPicPos ResetImage() Return 0 Case $idResetValues GUICtrlSetData($slAlpha_Filtering, 1) GUICtrlSetData($ipAlpha_Filtering, 1) GUICtrlSetData($slAlpha_Quality, 100) GUICtrlSetData($ipAlpha_Quality, 100) GUICtrlSetData($slFilter_Sharpness, 0) GUICtrlSetData($ipFilter_Sharpness, 0) GUICtrlSetData($slFilter_Strength, 60) GUICtrlSetData($ipFilter_Strength, 60) GUICtrlSetData($slLevel, 6) GUICtrlSetData($ipLevel, 6) GUICtrlSetData($slMethod, 4) GUICtrlSetData($ipMethod, 4) GUICtrlSetData($slNear_Lossless, 60) GUICtrlSetData($ipNear_Lossless, 60) GUICtrlSetData($slPass, 6) GUICtrlSetData($ipPass, 6) GUICtrlSetData($slQuality, 75) GUICtrlSetData($ipQuality, 75) GUICtrlSetData($slSNS_Strength, 50) GUICtrlSetData($ipSSN_Strength, 50) GUICtrlSetData($ipTarget_Size, 0) GUICtrlSetState($chkbAlpha_Compression, $GUI_CHECKED) GUICtrlSetState($chkbLossless, $GUI_UNCHECKED) _SendMessage($hcbPreset, $CB_SETCURSEL, 0) Return 0 EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_COMMAND Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $hWnd Case $hGUI Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Reset values to default", $idResetValues) If $bBigger Then _GUICtrlMenu_InsertMenuItem($hMenu, 1, 0) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Reset image position", $idResetPicPos) EndIf _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func Max($a, $b) If $a > $b Then Return $a Return $b EndFunc Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc Func GDIPlus_About($iFontsize = 10, $dx = 0, $dy = 0, $iSpeed = 333, $sFont = "MV Boli") If @AutoItX64 = 0 Then Local $binSIDSound = _Chip_Sound() _SIDStartup() _SIDOpen($binSIDSound) EndIf Local Const $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ About Window" Local Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi #Region text Local $sText = _ "WebP Advanced Encoder GUI ²" & _ " " & $ver & " beta " & _ " " & $build & " " & _ " " & _ " Coded by UEZ ;-) " & _ " " & _ "Credits to: " & _ " " & _ "* Google for the WebP API " & _ " and static libraries " & _ "* wakillon for TichySID " & _ " and Stat-Mat for the DLL " & _ "* Soren Lund for SID Tune " & _ "* Ward for Mem call code " & _ " " & _ "-------------------------- " & _ " " & _ "Greetings fly out to: " & _ " " & _ " All Autoit users " & _ " around the globe " & _ " " & _ " " & _ " Press ESC to exit. " & _ " " & _ " " & _ "-------------------------- " & _ " " & _ "NO ..--+++--.. WAR " & _ " .-' | `-. " & _ " +' | `+ " & _ " ' | ` " & _ " ' | ` " & _ ": | :" & _ ": +'|`+ :" & _ ". +' | `+ ;" & _ " + +' | `+ + " & _ " `. +' | `+ .' " & _ " `._ | _.' " & _ "Peace `--.._|_..--' :-) " #EndRegion $bExit = False $hGUI_About = GUICreate($sTitle, $iW, $iH, 0, 0, $WS_POPUP, $WS_EX_NOPARENTNOTIFY, $hGUI) _WinAPI_SetParent($hGUI_About, $hGUI) WinSetTrans($hGUI_About, "", 0xD8) GUISetState(@SW_SHOWNA, $hGUI_About) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI_About) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_HatchBrushCreate(18, 0xF0B0B0E0, 0xF0F0F0FF), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 100, 24) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") Local $iLen = StringLen($sText), $iColums = StringInStr($sText, "²"), $i, $u, $s, $r, $iChar_Space, $x, $y, $t = 0, $f, $b = 0, $a = 512, $iCharCol = 0x101030 $sText = StringReplace($sText, "²", " ") Local $aChars = StringSplit($sText, "", 2) Local $hFormat_char = _GDIPlus_StringFormatCreate(), $hFamily_char = _GDIPlus_FontFamilyCreate($sFont), $hFont_char = _GDIPlus_FontCreate($hFamily_char, $iFontsize, 1), _ $tLayout_char = _GDIPlus_RectFCreate(), $hBrush_char = _GDIPlus_BrushCreateSolid(0xFF000000 + $iCharCol) Local Const $iMilliSeconds = 5 AdlibRegister("CalcFPS", 1000) Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, "float", $iW, "float", $iH) ;erase canvas background For $i = 0 To UBound($aChars) - 1 If $aChars[$i] <> " " Then $f = $t - $i / $iSpeed $s = $f > 2 ? 2 : $f $s = $s > 0 ? $s : 0 $r = (2 - $s) * $iColums * $iColums $iChar_Space = $s / 4.5 * $iColums $tLayout_char.x = $dx + $r / 2 * Sin($t + $i) + Mod($i, $iColums) * $iChar_Space $tLayout_char.y = $dy + $r / 3 * Cos($t + $i) + Int($i / $iColums) * $iChar_Space * 1.3333 DllCall($__g_hGDIPDll, "int", "GdipDrawString", "handle", $hCanvas, "wstr", $aChars[$i], "int", -1, "handle", $hFont_char, "struct*", $tLayout_char, "handle", $tLayout_char, "handle", $hBrush_char) EndIf Next $t += 0.025 DllCall($__g_hGDIPDll, "int", "GdipDrawString", "handle", $hCanvas, "wstr", "FPS: " & $iShowFPS, "int", -1, "handle", $hFont_FPS, "struct*", $tLayout_FPS, "handle", $hFormat_FPS, "handle", $hBrush_FPS) DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hDC, "int", 0, "int", 0, "int", $iW, "int", $iH, "handle", $hDC_backbuffer, "int", 0, "int", 0, "dword", $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop If $r = 0 Then $b = 1 If $b Then $a -= 5 If $a < 256 Then DllCall($__g_hGDIPDll, "int", "GdipSetSolidFillColor", "handle", $hBrush_char, "dword", BitShift(Max(0, $a), -24) + $iCharCol) If $a <= -50 Then $b = 0 $a = 384 DllCall($__g_hGDIPDll, "int", "GdipSetSolidFillColor", "handle", $hBrush_char, "dword", 0xFF000000 + $iCharCol) $t = 0 EndIf EndIf DllCall($_KERNEL32DLL, "dword", "SleepEx", "dword", $iMilliSeconds, "bool", True) Until False AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_char) _GDIPlus_FontFamilyDispose($hFamily_char) _GDIPlus_StringFormatDispose($hFormat_char) _GDIPlus_BrushDispose($hBrush_char) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI_About, $hDC) GUIDelete($hGUI_About) If @AutoItX64 = 0 Then _SIDStop() _SIDClose() _SIDShutdown() $binSIDSound = 0 EndIf EndFunc ;==>GDIPlus_About Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96) Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 0) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 0) Local $iDPI = $aResult[2] _GDIPlus_GraphicsDispose($hGfx) Local $aResults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef] Return $aResults EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio Func _WinAPI_GetDpiForMonitor($dpiType = $MDT_DEFAULT, $iDPIDef = 96) Local $aMonitors = _WinAPI_EnumDisplayMonitors() Local $x, $y Local $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $aMonitors[1][0], "int", $dpiType, "uint*", $x, "uint*", $y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$iDPIDef / $aRet[3], $aRet[3] / $iDPIDef] Return $aDPI EndFunc ;==>_WinAPI_GetDpiForMonitor Func _WinAPI_SetDPIAwareness($hGUI = 0) Switch @OSBuild Case 6000 To 9199 If Not DllCall("user32.dll", "bool", "SetProcessDPIAware") Then Return SetError(1, 0, 0) Return 1 Case 9200 To 13999 _WinAPI_SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE) If @error Then Return SetError(1, 0, 0) Return 1 Case @OSBuild > 13999 #cs Context_Unaware = ((DPI_AWARENESS_CONTEXT)(-1)), Context_SystemAware = ((DPI_AWARENESS_CONTEXT)(-2)), Context_PerMonitorAware = ((DPI_AWARENESS_CONTEXT)(-3)), Context_PerMonitorAwareV2 = ((DPI_AWARENESS_CONTEXT)(-4)), Context_UnawareGdiScaled = ((DPI_AWARENESS_CONTEXT)(-5)) #ce _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAwareV2, $hGUI) If @error Then Return SetError(3, @error, 0) Return 1 EndSwitch Return -1 EndFunc ;==>_WinAPI_SetDPIAwareness Func _WinAPI_SetProcessDpiAwareness($DPIAware) ;https://docs.microsoft.com/en-us/windows/desktop/api/shellscalingapi/nf-shellscalingapi-setprocessdpiawareness DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwareness ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 1) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05 Func _Chip_Sound($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Chip_Sound $Chip_Sound &= 'UFNJRAACAHwAABAAEAMAAQABAAAAAENvbW1vZG9yZSA2NAAAAAAAAAAAAAAAAAAAAAAAAAAAU/hyZW4gTHVuZCAoSmVmZikAAAAAAAAAAAAAAAAAAAAyMDA0IFZpcnV6L0NhbWVsb3QAAAAAAAAAAAAAAAAAAAAUAAAAAAAQTH0RTOoRTA0SrZaJkpWarS0oAykgCgUGBi8WCRIVGi0BAAAAAAAAAAABAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFic4S19ziqG61PAOLU5xlr3nE0J0qeAbWpviLHvOJ4XoUcE3tDfEV/WcTgnQo4JuaG6Ir+s5nBOhRgTc0NwQXtZyOCZCjAi4oLggvKzkcEyEGBBwQHBAeFjI4JgIMCAuAQEBAQEBAQEBAQECAgICAgICAwMDAwMEBAQEBQUFBgYGBwcICAkJCgo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1/mv7vGP7b/7/l2MAZ/6VYAq6bvtr/rtn/rxj/pprAP+SYCe3Yvtj/mAjt2L7Y/6WYC63Yvtj/mAqt2L7Y/6TYCe3avty/rlg/v+bYCe+YvuSYCe3Yvtj/mAjt2L7Y/6WYC63Yvtj/mAqt2L7Y/6TYCe3cvtn/v+XYQCYYCL8J/wu/CL8KfwulwD8+5gq/CX8J/wq/Cz8J/+eYBjAYvvBY/vC+8Nn+8Rj+8X7xvtgSshi+8dgSsj+Sshi+8dgSsj+nxvJavvKYD9m+/+eYBjAYvvBY/vC+8Nn+8Rj+8X7y2H7zPtgSshi+8dgSsj+Sshi+8dgSsj+nz/KYvuXYwCHYQCQYwAAhWEA/w==' Local $bString = _WinAPI_Base64Decode($Chip_Sound) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Commodore_64.sid", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Chip_Sound Func _WebP_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $WebP_Icon $WebP_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAMkElEQVR4XsRZe3BU1Rn/vnPvPpNsdsnCIgkkFogoElIpFAMZmUIC5SVpBcb6ACMNFAYUi5RRKUgFNWTEDgyKBEHoA4y1ZkKxHQYspfJ0SpGEplIeCXntJvtIsu+993yF3EDGMs3eO67hd3fuP/fuOb/f9zrfOReoV8TkGBFdrwvo7oXFi5bNmjN59pzJi55dZh4OX5y91P3CXQUDFeAxZu0HhSu8BUtbpyxu/eFz3nsyIRZWnsG3BM5VDR1HgMJPFA16PdizojZHxOaI9ssM2NLAZuvX9UiEbweMqTJub9MTkcKvualRFwJPS9DvFUHGtuZrDsz+5Usbc76b7XL7BCYAECQIBKBnzO1vnD+3qKAwX3FFL2KQiP7/UAgAH+4/WLx81urSSdljfX6PBMBMKfK16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HJyMuGjo6NqNb1eL7Wd2NhY4Drdx6/cUh6bxJM/AhSiW+Xp7x88Ngrl5s5CVVWVFKmkpCRKk3ehkJmZiZGyore3l9edYoxxenqaaloq2aOjI9SGxWJBZ9jc3MT65Ofnt7e3R0REqNWoT7A/vEO97/KQLrv4e/DOR4LoPUjehDO5uLhIFigjrFar4FCRBmqXI41yIb6iogLM+fm5tAIoXEYclGBubi547nIgNzc34AUF+eDPLMqjn8XTEfHr8Pfnx0rHYPWzMZH+7xRKT0+XLPj4+AAvKioSEDiLcnJyMGZkZBC4trZGorZei4uLgaDHSQ4MDw8DRyNmB/z8/KS5Ozs7UhE3dZUU' $WebP_Icon &= 'dYoCg0jWiy8N4qtO1yedn7MFnU4nWTg9PSUL2H8EtgYqDqpdOrqoQ5iQkICxpaXF7i5bWloKXtuapMeDZmdngeClX+scKVSEzYTDyhburHh6emrtokB5/5L2y8PDQ2GPuJuxk2j/7BvTxcWFeuPSbs1SW6uvr5csoPygILg/nJycxMXFIQc40rR1p6Sk9PT0EKil5eVlbIVYh8bGRpwpJAX04tTUVOIRv9ra2vLy8oGBAefOOXJfRnNDk0DL6ejokA5z941kB8bGxv7722msAxF4B6D0K05KGJl3MJ01mXGS+F6BAzmbZQv3eQXkG4Xdi4RQ7jehbOCAgyP3P94Red6jcQCLAAAAAElFTkSuQmCC' Local $bString = _WinAPI_Base64Decode($WebP_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\WebP_logo_2010_64x64_Simo99.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_WebP_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode #Region TichySID Func _SIDClose() Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDClose') If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_SIDClose Func _SIDOpen($Sid, $iSubsong = 1) Local $bSid If Not IsBinary($Sid) Then If Not FileExists($Sid) Then Return SetError(2, 0, 0) Local $hFileOpen = FileOpen($Sid, 0) If $hFileOpen = -1 Then Return SetError(-1, 0, 0) $bSid = FileRead($hFileOpen) FileClose($hFileOpen) Else $bSid = $Sid EndIf Local $tSid = DllStructCreate('byte[' & BinaryLen($bSid) & ']') DllStructSetData($tSid, 1, $bSid) Local $sType = BinaryToString(BinaryMid($bSid, 1, 4), 1) ConsoleWrite('-->-- Sid File Type : ' & $sType & @CRLF) Local $iVersion = Execute(BinaryMid($bSid, 5, 2)) ConsoleWrite('-->-- Sid File Version : ' & $iVersion & @CRLF) $iSubsongCount = Int(StringTrimLeft(BinaryMid($bSid, 15, 2), 2)) ConsoleWrite('-->-- SubsongCount : ' & $iSubsongCount & @CRLF) $iSubsong = $iSubsong - 1 If $iSubsong < 0 Then $iSubsong = 0 If $iSubsong > $iSubsongCount Then $iSubsong = 0 ConsoleWrite('-->-- Subsong : ' & $iSubsong & @CRLF) Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDOpen', 'ptr', DllStructGetPtr($tSid), 'int', DllStructGetSize($tSid), 'int', $SID_MEMORY, 'int', $SID_NON_DEFAULT, 'int', $iSubsong) If @error Then Return SetError(@error, 0, 0) $tSid = 0 $bSid = 0 Return $aRet[0] EndFunc ;==>_SIDOpen Func _SIDShutdown() MemoryDllClose($hTitchysidDll) $hTitchysidDll = 0 EndFunc ;==>_SIDShutdown Func _SIDStartup() $hTitchysidDll = MemoryDllOpen(TitchySIDdll()) If $hTitchysidDll = -1 Then Return SetError(1, 0, 0) Return SetError(0, 0, $hTitchysidDll) EndFunc ;==>_SIDStartup Func _SIDStop() Local $aRet = MemoryDllCall($hTitchysidDll, 'int', 'SIDStop') If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_SIDStop Func TitchySIDdll() ;only x86 :-( Local $sFileBin = 'cbsATVqQAAMAAACCBAAw//8AALgAOC0BAEAEOBkAsAAMDh8Aug4AtAnNIbgAAUzNIVRoaXMAIHByb2dyYW0AIGNhbm5vdCAAYmUgcnVuIGkAbiBET1MgbW+AZGUuDQ0KJASGADvpjpN/iODAQQUDg6jywHwAB/EQl/PAZQAHUmljBmgBFwVzUEUAAEyAAQQA9O0oVQUTAOAADiELAQUMpAASAAzMAgegEAADfjAECQELABoB5wEABQcA/iCAfgQGgxwAFIEVhgMDA2BgMgAAvoEDgCc84RmKEAMAnKCdDgCAK4JYGA8udGV4dIADftYBRoEBgXUGYgRlAE8uAHJkYXRhAAAeNwHqgX2BERaLE4DtQC5xAxMAW8NAPQF7AT8aAc4JwC5yZWxvY7gAAGjBB8A2whMczgn+QrE8PwA/AD8APwA/ADcAAFWL7IPE6FZXADPJvoRCABC/ASA5EOtzUQ+3RgACJf8PAADB4AAQiUcED7YVmwEAA9Pqg+IBiFcACQ+2TgXB6QRAiwSNCEAA4AMKDLpI4AChAoDhDw9AtwRKiUcOoAEGAaYBFg+2RgYk8ACJRxKKRgSIR0AID7cG9yXgRhAAiQdZQYPGB4MAxyyD+QNyiL+BYRAPtkcWweBgDgBPFYPhBwPB90QlBCAFuQCAoIXBAHYBkYlHGTPJCLEE64AKRxjT6ACD4AGA+Qd1AwCD8AGIRDkZQQCD+Qhy5WaD5gAPiXchuD0KAAIAAAkXwOkE9+EAuTMzAQAryMEA6QiJTyUz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FYTMABxAAT0AAh0ABYAJTg4KiUzOBerMABxAAXwADhwAAl0AIQYJnAAJi84EjAAKhUwAAb0AAx0ABk1oXAANTQ4IjAAFTAACgf0AA10ADgPODiAEQ8QOB84I3IAIgD0ACQPGrIBLSsiLDIAISsdcgABKxEzAQ4rHnIAMjA4QTAAKDggMBtyAAIV8AA4cAAKdAAxNjhBMAApOBw2N3IAAxXwADhwAAt0AGvdMwDTi9kA0HrdTcDUK90d0WD8AP0BFfMADPYAaPYBRNUrStnwANj5ABHS+AHUT/IB/AD1HtEyRKywWLEuAjAzgHIgAGhwAQswABAwKTA/MEcwAHswjzClMBIxAFkxCTK8MvIyAIAzjTO+M/MzAA40XDShNCQ2AEo2dTadNqI2AKs2uDbINvI2AAc3Ejc9PJM8AME82jwqPUg9AE49kz34PQU+ACU+1z5MP3Y/sJ4/uj8ABkAmNGAAAgRwBiAwbDByMAB4MH4whDCKMACQMJYwnDCiMACoMK4wtDC6MIDAMMYwzDDSP2H/DwAPAA8ADwAPAA8ADwAPAP8PAA8ADwAPAA8ADwAPAA8A/w8ADwAPAA8ADwAPAA8ADwD/DwAPAA8ADwAPAA8ADwAPAP8PAA8ADwAPAA8ADwAPAA8A/w8ADwAPAA8ADwAPAA8ABAA=' $sFileBin = Binary(_WinAPI_Base64Decode($sFileBin)) $sFileBin = Binary(_LzntDecompress($sFileBin)) Return SetError(0, 0, $sFileBin) EndFunc ;==>TitchySIDdll Func _LzntDecompress($bBinary) $bBinary = Binary($bBinary) Local $tInput = DllStructCreate('byte[' & BinaryLen($bBinary) & ']') DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate('byte[' & 16 * DllStructGetSize($tInput) & ']') Local $a_Call = DllCall('ntdll.dll', 'int', 'RtlDecompressBuffer', 'ushort', 2, 'ptr', DllStructGetPtr($tBuffer), 'dword', DllStructGetSize($tBuffer), 'ptr', DllStructGetPtr($tInput), 'dword', DllStructGetSize($tInput), 'dword*', 0) If @error Or $a_Call[0] Then Return SetError(1, 0, '') Local $tOutput = DllStructCreate('byte[' & $a_Call[6] & ']', DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LzntDecompress Func API_FreeLibrary($Module) Local $Ret = DllCall($_KERNEL32DLL, 'bool', 'FreeLibrary', 'handle', $Module) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_FreeLibrary Func API_GetProcAddress($Module, $Procname) If IsNumber($Procname) Then Local $Ret = DllCall($_KERNEL32DLL, 'ptr', 'GetProcAddress', 'handle', $Module, 'int', $Procname) Else Local $Ret = DllCall($_KERNEL32DLL, 'ptr', 'GetProcAddress', 'handle', $Module, 'str', $Procname) EndIf If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_GetProcAddress Func API_IsBadReadPtr($Ptr, $Len) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'IsBadReadPtr', 'ptr', $Ptr, 'UINT_PTR', $Len) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_IsBadReadPtr Func API_LoadLibrary($Filename) Local $Ret = DllCall($_KERNEL32DLL, 'handle', 'LoadLibraryW', 'wstr', $Filename) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_LoadLibrary Func API_lstrlenA($Address) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'lstrlenA', 'ptr', $Address) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_lstrlenA Func API_lstrlenW($Address) Local $Ret = DllCall($_KERNEL32DLL, 'int', 'lstrlenW', 'ptr', $Address) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_lstrlenW Func API_VirtualProtect($Address, $Size, $Protection) Local $Ret = DllCall($_KERNEL32DLL, 'bool', 'VirtualProtect', 'ptr', $Address, 'dword_ptr', $Size, 'dword', $Protection, 'dword*', 0) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_VirtualProtect Func API_ZeroMemory($Address, $Size) Local $Ret = DllCall($_KERNEL32DLL, 'none', 'RtlZeroMemory', 'ptr', $Address, 'dword_ptr', $Size) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>API_ZeroMemory Func MemLib_BuildImportTable($CodeBase, $PEHeader) Local Const $IMAGE_DIRECTORY_ENTRY_IMPORT = 1 Local Const $SizeOfPtr = DllStructGetSize(DllStructCreate('ptr', 1)) Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $ImportDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_IMPORT * $SizeOfDataDirectory Local $ImportDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $ImportDirectoryPtr) Local $ImportSize = DllStructGetData($ImportDirectory, 'Size') Local $ImportVirtualAddress = DllStructGetData($ImportDirectory, 'VirtualAddress') Local $SizeOfImportDir = DllStructGetSize(DllStructCreate($tagIMAGE_IMPORT_DESCRIPTOR)) Local $ImportList = '' If $ImportSize > 0 Then Local $ImportDescPtr = $CodeBase + $ImportVirtualAddress While 1 If API_IsBadReadPtr($ImportDescPtr, $SizeOfImportDir) Then ExitLoop Local $ImportDesc = DllStructCreate($tagIMAGE_IMPORT_DESCRIPTOR, $ImportDescPtr) Local $NameOffset = DllStructGetData($ImportDesc, 'Name') If $NameOffset = 0 Then ExitLoop Local $Name = Peek('str', $CodeBase + $NameOffset) Local $OriginalFirstThunk = DllStructGetData($ImportDesc, 'OriginalFirstThunk') Local $FirstThunk = DllStructGetData($ImportDesc, 'FirstThunk') Local $Handle = API_LoadLibrary($Name) If $Handle Then $ImportList &= $Handle & ',' Local $FuncRef = $CodeBase + $FirstThunk Local $ThunkRef = $CodeBase + $OriginalFirstThunk If $OriginalFirstThunk = 0 Then $ThunkRef = $FuncRef While 1 Local $Ref = Peek('ptr', $ThunkRef) If $Ref = 0 Then ExitLoop If BitAND(Peek('byte', $ThunkRef + $SizeOfPtr - 1), 0x80) Then Local $Ptr = API_GetProcAddress($Handle, BitAND($Ref, 0xffff)) Else Local $IMAGE_IMPORT_BY_NAME = DllStructCreate($tagIMAGE_IMPORT_BY_NAME, $CodeBase + $Ref) Local $NamePtr = DllStructGetPtr($IMAGE_IMPORT_BY_NAME, 2) Local $FuncName = Peek('str', $NamePtr) Local $Ptr = API_GetProcAddress($Handle, $FuncName) EndIf If $Ptr = 0 Then Return SetError(1, 0, False) Poke('ptr', $FuncRef, $Ptr) $ThunkRef += $SizeOfPtr $FuncRef += $SizeOfPtr WEnd Else Return SetError(1, 0, False) EndIf $ImportDescPtr += $SizeOfImportDir WEnd EndIf Return $ImportList EndFunc ;==>MemLib_BuildImportTable Func MemLib_CopySections($CodeBase, $PEHeader, $DllDataPtr) Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfFileHeader = DllStructGetPtr($IMAGE_NT_HEADER, 'Magic') - $PEHeader Local $SizeOfOptionalHeader = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfOptionalHeader') Local $NumberOfSections = DllStructGetData($IMAGE_NT_HEADER, 'NumberOfSections') Local $SectionAlignment = DllStructGetData($IMAGE_NT_HEADER, 'SectionAlignment') Local $SectionPtr = $PEHeader + $SizeOfFileHeader + $SizeOfOptionalHeader For $i = 1 To $NumberOfSections Local $Section = DllStructCreate($tagIMAGE_SECTION_HEADER, $SectionPtr) Local $VirtualAddress = DllStructGetData($Section, 'VirtualAddress') Local $SizeOfRawData = DllStructGetData($Section, 'SizeOfRawData') Local $PointerToRawData = DllStructGetData($Section, 'PointerToRawData') If $SizeOfRawData = 0 Then Local $Dest = _MemVirtualAlloc($CodeBase + $VirtualAddress, $SectionAlignment, $MEM_COMMIT, $PAGE_READWRITE) API_ZeroMemory($Dest, $SectionAlignment) Else Local $Dest = _MemVirtualAlloc($CodeBase + $VirtualAddress, $SizeOfRawData, $MEM_COMMIT, $PAGE_READWRITE) _MemMoveMemory($DllDataPtr + $PointerToRawData, $Dest, $SizeOfRawData) EndIf DllStructSetData($Section, 'VirtualSize', $Dest - $CodeBase) $SectionPtr += DllStructGetSize($Section) Next EndFunc ;==>MemLib_CopySections Func MemLib_FinalizeSections($CodeBase, $PEHeader) Local Const $IMAGE_SCN_MEM_EXECUTE = 0x20000000 Local Const $IMAGE_SCN_MEM_READ = 0x40000000 Local Const $IMAGE_SCN_MEM_WRITE = 0x80000000 Local Const $IMAGE_SCN_MEM_NOT_CACHED = 0x4000000 Local Const $IMAGE_SCN_CNT_INITIALIZED_DATA = 64 Local Const $IMAGE_SCN_CNT_UNINITIALIZED_DATA = 128 Local Const $PAGE_WRITECOPY = 0x0008 Local Const $PAGE_EXECUTE_WRITECOPY = 0x0080 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfFileHeader = DllStructGetPtr($IMAGE_NT_HEADER, 'Magic') - $PEHeader Local $SizeOfOptionalHeader = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfOptionalHeader') Local $NumberOfSections = DllStructGetData($IMAGE_NT_HEADER, 'NumberOfSections') Local $SectionAlignment = DllStructGetData($IMAGE_NT_HEADER, 'SectionAlignment') Local $SectionPtr = $PEHeader + $SizeOfFileHeader + $SizeOfOptionalHeader For $i = 1 To $NumberOfSections Local $Section = DllStructCreate($tagIMAGE_SECTION_HEADER, $SectionPtr) Local $Characteristics = DllStructGetData($Section, 'Characteristics') Local $SizeOfRawData = DllStructGetData($Section, 'SizeOfRawData') Local $Executable = (BitAND($Characteristics, $IMAGE_SCN_MEM_EXECUTE) <> 0) Local $Readable = (BitAND($Characteristics, $IMAGE_SCN_MEM_READ) <> 0) Local $Writeable = (BitAND($Characteristics, $IMAGE_SCN_MEM_WRITE) <> 0) Local $ProtectList[8] = [$PAGE_NOACCESS, $PAGE_EXECUTE, $PAGE_READONLY, $PAGE_EXECUTE_READ, $PAGE_WRITECOPY, $PAGE_EXECUTE_WRITECOPY, $PAGE_READWRITE, $PAGE_EXECUTE_READWRITE] Local $Protect = $ProtectList[$Executable + $Readable * 2 + $Writeable * 4] If BitAND($Characteristics, $IMAGE_SCN_MEM_NOT_CACHED) Then $Protect = BitOR($Protect, $PAGE_NOCACHE) Local $Size = $SizeOfRawData If $Size = 0 Then If BitAND($Characteristics, $IMAGE_SCN_CNT_INITIALIZED_DATA) Then $Size = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfInitializedData') ElseIf BitAND($Characteristics, $IMAGE_SCN_CNT_UNINITIALIZED_DATA) Then $Size = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfUninitializedData') EndIf EndIf If $Size > 0 Then Local $PhysicalAddress = $CodeBase + DllStructGetData($Section, 'VirtualSize') API_VirtualProtect($PhysicalAddress, $Size, $Protect) EndIf $SectionPtr += DllStructGetSize($Section) Next EndFunc ;==>MemLib_FinalizeSections Func MemLib_FreeLibrary($ModulePtr) If Not MemLib_Vaild($ModulePtr) Then Return 0 Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = DllStructGetData($Module, 'CodeBase') Local $DllEntry = DllStructGetData($Module, 'DllEntry') Local $Initialized = DllStructGetData($Module, 'Initialized') Local $ImportListPtr = DllStructGetData($Module, 'ImportList') Local $ExportListPtr = DllStructGetData($Module, 'ExportList') If $Initialized And $DllEntry Then Local $Success = MemoryFuncCall('bool', $DllEntry, 'ptr', $CodeBase, 'dword', 0, 'ptr', 0) DllStructSetData($Module, 'Initialized', 0) EndIf If $ExportListPtr Then _MemGlobalFree($ExportListPtr) If $ImportListPtr Then Local $ImportList = StringSplit(Peek('str', $ImportListPtr), ',') For $i = 1 To $ImportList[0] If $ImportList[$i] Then API_FreeLibrary($ImportList[$i]) Next _MemGlobalFree($ImportListPtr) EndIf If $CodeBase Then _MemVirtualFree($CodeBase, 0, $MEM_RELEASE) DllStructSetData($Module, 'CodeBase', 0) DllStructSetData($Module, 'ExportList', 0) _MemGlobalFree($ModulePtr) Return 1 EndFunc ;==>MemLib_FreeLibrary Func MemLib_GetExportList($CodeBase, $PEHeader) Local Const $IMAGE_DIRECTORY_ENTRY_EXPORT = 0 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $ExportDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_EXPORT * $SizeOfDataDirectory Local $ExportDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $ExportDirectoryPtr) Local $ExportSize = DllStructGetData($ExportDirectory, 'Size') Local $ExportVirtualAddress = DllStructGetData($ExportDirectory, 'VirtualAddress') Local $ExportList = '' If $ExportSize > 0 Then Local $IMAGE_EXPORT_DIRECTORY = DllStructCreate($tagIMAGE_EXPORT_DIRECTORY, $CodeBase + $ExportVirtualAddress) Local $NumberOfNames = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'NumberOfNames') Local $NumberOfFunctions = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'NumberOfFunctions') Local $AddressOfFunctions = DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfFunctions') If $NumberOfNames = 0 Or $NumberOfFunctions = 0 Then Return '' Local $NameRef = $CodeBase + DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfNames') Local $Ordinal = $CodeBase + DllStructGetData($IMAGE_EXPORT_DIRECTORY, 'AddressOfNameOrdinals') For $i = 1 To $NumberOfNames Local $Ref = Peek('dword', $NameRef) Local $Idx = Peek('word', $Ordinal) Local $FuncName = Peek('str', $CodeBase + $Ref) If $Idx <= $NumberOfFunctions Then Local $Addr = $CodeBase + Peek('dword', $CodeBase + $AddressOfFunctions + $Idx * 4) $ExportList &= $FuncName & Chr(1) & $Addr & Chr(1) EndIf $NameRef += 4 $Ordinal += 2 Next EndIf Return $ExportList EndFunc ;==>MemLib_GetExportList Func MemLib_GetProcAddress($ModulePtr, $FuncName) Local $ExportPtr = Peek('ptr', $ModulePtr) If Not $ExportPtr Then Return 0 Local $ExportList = Peek('str', $ExportPtr) Local $Match = StringRegExp($ExportList, '(?i)' & $FuncName & '\001([^\001]*)\001', 3) If Not @error Then Return Ptr($Match[0]) Return 0 EndFunc ;==>MemLib_GetProcAddress Func MemLib_LoadLibrary($DllBinary) $DllBinary = Binary($DllBinary) Local $DllData = DllStructCreate('byte[' & BinaryLen($DllBinary) & ']') Local $DllDataPtr = DllStructGetPtr($DllData) DllStructSetData($DllData, 1, $DllBinary) Local $IMAGE_DOS_HEADER = DllStructCreate($tagIMAGE_DOS_HEADER, $DllDataPtr) If DllStructGetData($IMAGE_DOS_HEADER, 'e_magic') <> 0x5A4D Then Return SetError(1, 0, 0) EndIf Local $PEHeader = $DllDataPtr + DllStructGetData($IMAGE_DOS_HEADER, 'e_lfanew') Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) If DllStructGetData($IMAGE_NT_HEADER, 'Signature') <> 0x4550 Then Return SetError(1, 0, 0) EndIf Switch DllStructGetData($IMAGE_NT_HEADER, 'Magic') Case 0x10B If @AutoItX64 Then Return SetError(2, 0, 0) Case 0x20B If Not @AutoItX64 Then Return SetError(2, 0, 0) EndSwitch Local $ImageBase = DllStructGetData($IMAGE_NT_HEADER, 'ImageBase') Local $SizeOfImage = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfImage') Local $SizeOfHeaders = DllStructGetData($IMAGE_NT_HEADER, 'SizeOfHeaders') Local $AddressOfEntryPoint = DllStructGetData($IMAGE_NT_HEADER, 'AddressOfEntryPoint') Local $ModulePtr = _MemGlobalAlloc(DllStructGetSize(DllStructCreate($tagModule)), $GPTR) If $ModulePtr = 0 Then Return SetError(3, 0, 0) Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = _MemVirtualAlloc($ImageBase, $SizeOfImage, $MEM_RESERVE, $PAGE_READWRITE) If $CodeBase = 0 Then $CodeBase = _MemVirtualAlloc(0, $SizeOfImage, $MEM_RESERVE, $PAGE_READWRITE) If $CodeBase = 0 Then Return SetError(3, 0, 0) DllStructSetData($Module, 'CodeBase', $CodeBase) _MemVirtualAlloc($CodeBase, $SizeOfImage, $MEM_COMMIT, $PAGE_READWRITE) Local $Base = _MemVirtualAlloc($CodeBase, $SizeOfHeaders, $MEM_COMMIT, $PAGE_READWRITE) _MemMoveMemory($DllDataPtr, $Base, $SizeOfHeaders) MemLib_CopySections($CodeBase, $PEHeader, $DllDataPtr) Local $LocationDelta = $CodeBase - $ImageBase If $LocationDelta <> 0 Then MemLib_PerformBaseRelocation($CodeBase, $PEHeader, $LocationDelta) Local $ImportList = MemLib_BuildImportTable($CodeBase, $PEHeader) If @error Then MemLib_FreeLibrary($ModulePtr) Return SetError(2, 0, 0) EndIf Local $ExportList = MemLib_GetExportList($CodeBase, $PEHeader) Local $ImportListPtr = _MemGlobalAlloc(StringLen($ImportList) + 2, $GPTR) Local $ExportListPtr = _MemGlobalAlloc(StringLen($ExportList) + 2, $GPTR) DllStructSetData($Module, 'ImportList', $ImportListPtr) DllStructSetData($Module, 'ExportList', $ExportListPtr) If $ImportListPtr = 0 Or $ExportListPtr = 0 Then MemLib_FreeLibrary($ModulePtr) Return SetError(3, 0, 0) EndIf Poke('str', $ImportListPtr, $ImportList) Poke('str', $ExportListPtr, $ExportList) MemLib_FinalizeSections($CodeBase, $PEHeader) Local $DllEntry = $CodeBase + $AddressOfEntryPoint DllStructSetData($Module, 'DllEntry', $DllEntry) DllStructSetData($Module, 'Initialized', 0) If $AddressOfEntryPoint Then Local $Success = MemoryFuncCall('bool', $DllEntry, 'ptr', $CodeBase, 'dword', 1, 'ptr', 0) If Not $Success[0] Then MemLib_FreeLibrary($ModulePtr) Return SetError(4, 0, 0) EndIf DllStructSetData($Module, 'Initialized', 1) EndIf Return $ModulePtr EndFunc ;==>MemLib_LoadLibrary Func MemLib_PerformBaseRelocation($CodeBase, $PEHeader, $LocationDelta) Local Const $IMAGE_DIRECTORY_ENTRY_BASERELOC = 5 Local Const $IMAGE_REL_BASED_HIGHLOW = 3 Local Const $IMAGE_REL_BASED_DIR64 = 10 Local $IMAGE_NT_HEADER = DllStructCreate($tagIMAGE_NT_HEADER, $PEHeader) Local $SizeOfDataDirectory = DllStructGetSize(DllStructCreate($tagIMAGE_DATA_DIRECTORY)) Local $RelocDirectoryPtr = $PEHeader + DllStructGetSize($IMAGE_NT_HEADER) + $IMAGE_DIRECTORY_ENTRY_BASERELOC * $SizeOfDataDirectory Local $RelocDirectory = DllStructCreate($tagIMAGE_DATA_DIRECTORY, $RelocDirectoryPtr) Local $RelocSize = DllStructGetData($RelocDirectory, 'Size') Local $RelocVirtualAddress = DllStructGetData($RelocDirectory, 'VirtualAddress') If $RelocSize > 0 Then Local $Relocation = $CodeBase + $RelocVirtualAddress While 1 Local $IMAGE_BASE_RELOCATION = DllStructCreate($tagIMAGE_BASE_RELOCATION, $Relocation) Local $VirtualAddress = DllStructGetData($IMAGE_BASE_RELOCATION, 'VirtualAddress') Local $SizeOfBlock = DllStructGetData($IMAGE_BASE_RELOCATION, 'SizeOfBlock') If $VirtualAddress = 0 Then ExitLoop Local $Dest = $CodeBase + $VirtualAddress Local $Entries = ($SizeOfBlock - 8) / 2 Local $RelInfo = DllStructCreate('word[' & $Entries & ']', $Relocation + 8) For $i = 1 To $Entries Local $Info = DllStructGetData($RelInfo, 1, $i) Local $Type = BitShift($Info, 12) If $Type = $IMAGE_REL_BASED_HIGHLOW Or $Type = $IMAGE_REL_BASED_DIR64 Then Local $Addr = DllStructCreate('ptr', $Dest + BitAND($Info, 0xFFF)) DllStructSetData($Addr, 1, DllStructGetData($Addr, 1) + $LocationDelta) EndIf Next $Relocation += $SizeOfBlock WEnd EndIf EndFunc ;==>MemLib_PerformBaseRelocation Func MemLib_Vaild($ModulePtr) Local $ModuleSize = DllStructGetSize(DllStructCreate($tagModule)) If API_IsBadReadPtr($ModulePtr, $ModuleSize) Then Return False Local $Module = DllStructCreate($tagModule, $ModulePtr) Local $CodeBase = DllStructGetData($Module, 'CodeBase') If Not $CodeBase Then Return False Return True EndFunc ;==>MemLib_Vaild Func MemoryDllCall($Module, $RetType, $FuncName, $Type1 = '', $Param1 = 0, $Type2 = '', $Param2 = 0, $Type3 = '', $Param3 = 0, $Type4 = '', $Param4 = 0, $Type5 = '', $Param5 = 0, $Type6 = '', $Param6 = 0, $Type7 = '', $Param7 = 0, $Type8 = '', $Param8 = 0, $Type9 = '', $Param9 = 0, $Type10 = '', $Param10 = 0, $Type11 = '', $Param11 = 0, $Type12 = '', $Param12 = 0, $Type13 = '', $Param13 = 0, $Type14 = '', $Param14 = 0, $Type15 = '', $Param15 = 0, $Type16 = '', $Param16 = 0, $Type17 = '', $Param17 = 0, $Type18 = '', $Param18 = 0, $Type19 = '', $Param19 = 0, $Type20 = '', $Param20 = 0) Local $Ret, $OpenFlag = False Local Const $MaxParams = 20 If (@NumParams < 3) Or (@NumParams > $MaxParams * 2 + 3) Or (Mod(@NumParams, 2) = 0) Then Return SetError(4, 0, 0) If Not IsPtr($Module) Then $OpenFlag = True $Module = MemoryDllOpen($Module) If @error Then Return SetError(1, 0, 0) EndIf Local $Addr = MemLib_GetProcAddress($Module, $FuncName) If Not $Addr Then Return SetError(3, 0, 0) Poke('ptr', $_MFHookPtr + 1 + @AutoItX64, $Addr) Switch @NumParams Case 3 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi) Case 5 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1) Case 7 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2) Case 9 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3) Case 11 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4) Case 13 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4, $Type5, $Param5) Case Else Local $DllCallStr = 'DllCall ( $_KERNEL32DLL, $RetType, $_MFHookApi', $n = 1 For $i = 5 To @NumParams Step 2 $DllCallStr &= ', $Type' & $n & ', $Param' & $n $n += 1 Next $DllCallStr &= ' )' $Ret = Execute($DllCallStr) EndSwitch Local $Err = @error If $OpenFlag Then MemoryDllClose($Module) Return SetError($Err, 0, $Ret) EndFunc ;==>MemoryDllCall Func MemoryDllClose($Module) MemLib_FreeLibrary($Module) EndFunc ;==>MemoryDllClose Func MemoryDllOpen($DllBinary) If Not IsDllStruct($_MFHookBak) Then MemoryFuncInit() Local $Module = MemLib_LoadLibrary($DllBinary) If @error Then Return SetError(@error, 0, -1) Return $Module EndFunc ;==>MemoryDllOpen Func MemoryFuncCall($RetType, $Address, $Type1 = '', $Param1 = 0, $Type2 = '', $Param2 = 0, $Type3 = '', $Param3 = 0, $Type4 = '', $Param4 = 0, $Type5 = '', $Param5 = 0, $Type6 = '', $Param6 = 0, $Type7 = '', $Param7 = 0, $Type8 = '', $Param8 = 0, $Type9 = '', $Param9 = 0, $Type10 = '', $Param10 = 0, $Type11 = '', $Param11 = 0, $Type12 = '', $Param12 = 0, $Type13 = '', $Param13 = 0, $Type14 = '', $Param14 = 0, $Type15 = '', $Param15 = 0, $Type16 = '', $Param16 = 0, $Type17 = '', $Param17 = 0, $Type18 = '', $Param18 = 0, $Type19 = '', $Param19 = 0, $Type20 = '', $Param20 = 0) If Not IsDllStruct($_MFHookBak) Then MemoryFuncInit() Poke('ptr', $_MFHookPtr + 1 + @AutoItX64, $Address) Local $Ret Switch @NumParams Case 2 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi) Case 4 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1) Case 6 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2) Case 8 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3) Case 10 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4) Case 12 $Ret = DllCall($_KERNEL32DLL, $RetType, $_MFHookApi, $Type1, $Param1, $Type2, $Param2, $Type3, $Param3, $Type4, $Param4, $Type5, $Param5) Case Else Local $DllCallStr = 'DllCall($_KERNEL32DLL, $RetType, $_MFHookApi', $n = 1 For $i = 4 To @NumParams Step 2 $DllCallStr &= ', $Type' & $n & ', $Param' & $n $n += 1 Next $DllCallStr &= ')' $Ret = Execute($DllCallStr) EndSwitch Return SetError(@error, 0, $Ret) EndFunc ;==>MemoryFuncCall Func MemoryFuncInit() Local $KernelHandle = API_LoadLibrary('kernel32.dll') API_FreeLibrary($KernelHandle) Local $HookPtr = API_GetProcAddress($KernelHandle, $_MFHookApi) Local $HookSize = 7 + @AutoItX64 * 5 $_MFHookPtr = $HookPtr $_MFHookBak = DllStructCreate('byte[' & $HookSize & ']') If Not API_VirtualProtect($_MFHookPtr, $HookSize, $PAGE_EXECUTE_READWRITE) Then Return False DllStructSetData($_MFHookBak, 1, Peek('byte[' & $HookSize & ']', $_MFHookPtr)) If @AutoItX64 Then Poke('word', $_MFHookPtr, 0xB848) Poke('word', $_MFHookPtr + 10, 0xE0FF) Else Poke('byte', $_MFHookPtr, 0xB8) Poke('word', $_MFHookPtr + 5, 0xE0FF) EndIf Return True EndFunc ;==>MemoryFuncInit Func Peek($Type, $Ptr) If $Type = 'str' Then $Type = 'char[' & API_lstrlenA($Ptr) & ']' ElseIf $Type = 'wstr' Then $Type = 'wchar[' & API_lstrlenW($Ptr) & ']' EndIf Return DllStructGetData(DllStructCreate($Type, $Ptr), 1) EndFunc ;==>Peek Func Poke($Type, $Ptr, $Value) If $Type = 'str' Then $Type = 'char[' & (StringLen($Value) + 1) & ']' ElseIf $Type = 'wstr' Then $Type = 'wchar[' & (StringLen($Value) + 1) & ']' EndIf DllStructSetData(DllStructCreate($Type, $Ptr), 1, $Value) EndFunc ;==>Poke #EndRegion Download 7-Zip archive for the UDF, DLLs and examples: WebP v0.3.1 build 2022-06-18 beta.7z
-
I ported half of the Cairo functions to Autoit. You can read more about the functions here: https://www.cairographics.org/documentation/ The probability is high that errors have crept in and I have only tested a fraction of the functions. Anyone who wants to can contribute examples. All needed files (DLLs, UDF and examples) can be download from my OneDrive: Cairo for Autoit If you find a mistake, I am sure you will, then please report it.
-
#include <GDIPlus.au3> Example() Func Example() Local $hImage1, $hGraphics Local Const $iWidth = 100, $iHeight = 100 ; Initialize GDI+ library _GDIPlus_Startup() $hImage1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\p0.bmp") ; Draw one image in another $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage1) Local $aRemapTable[4][2] $aRemapTable[0][0] = 3 $aRemapTable[1][0] = 0xFF2D1200 ;Old Color1 $aRemapTable[1][1] = 0xFF000000 ;New Color1 $aRemapTable[2][0] = 0xFF491D00 ;Old Color2 $aRemapTable[2][1] = 0xFF000000 ;New Color2 $aRemapTable[3][0] = 0xFF381600 ;Old Color3 $aRemapTable[3][1] = 0xFF000000 ;New Color3 Local $hIA = _GDIPlus_ImageAttributesCreate() _GDIPlus_ImageAttributesSetRemapTable($hIA, $aRemapTable) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage1, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, $hIA) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage1, @ScriptDir & "\p1.bmp") ; Clean up resources _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImage1) ; Shut down GDI+ library _GDIPlus_Shutdown() EndFunc ;==>Example https://i.postimg.cc/ZYXCH5MQ/p0.png https://i.postimg.cc/0jS5F7BB/p1.png Hello, Is there a quick way to use "gdi" to convert the image "p0.bmp" to "p1.bmp"? With "_GDIPlus_ImageAttributesSetRemapTable" I could convert the relevant pixels to the desired color. Now I just need a quick function to replace the remaining non-relevant pixels with white "0xFFFFFFFF". thanks in advance p1.bmp p0.bmp
-
I don't think I ever posted The Matrix here, so here's the upload: The Matrix v1.31.au3 ;coded by UEZ build 2018-10-20 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe ;/rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "The Matrix Sound.au3" _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = @DesktopWidth / 2, $iH = @DesktopHeight / @DesktopWidth * $iW, $sTitle = "GDI / GDI+ The MATRIX v1.31" AutoItSetOption("GUIOnEventMode", 1) ProcessSetPriority (@AutoItPID, $PROCESS_HIGH) TheMatrix_v1() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func TheMatrix_v1() Local $bFullscreen = True, $iMsg = MsgBox(BitOR($MB_ICONQUESTION, $MB_TOPMOST, $MB_YESNO), "Question", "Enable fullscreen?", 5) If $iMsg = 7 Then $bFullscreen = False Local $binMusic = _Music() Local Const $iLen = BinaryLen($binMusic) Local $tMem = DllStructCreate("byte[" & $iLen & "]") DllStructSetData($tMem, 1, $binMusic) FSOUND_Init() Local Const $hMod = LoadSongEx($tMem, 0, $iLen) FMUSIC_MasterVolume($hMod, 50) FMUSIC_PlaySong($hMod) FMUSIC_SetLooping($hMod, 1) $binMusic = 0 $bExit = False If $bFullscreen Then Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen), $iPosMainScreen = Abs($aFullScreen[0]) $hGUI = GUICreate($sTitle, $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], $WS_POPUP, $WS_EX_TOPMOST) Else $hGUI = GUICreate($sTitle, $iW, $iH, -1, -1) EndIf GUISetBkColor(0) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_BitmapCreateDIB($iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $hDC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hHBitmap2 = _WinAPI_BitmapCreateDIB($iW, $iH) Local Const $hDC_backbuffer2 = _WinAPI_CreateCompatibleDC($hDC) Local Const $hDC_obj2 = _WinAPI_SelectObject($hDC_backbuffer2, $hHBitmap2) Local Const $hCanvas2 = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer2) _GDIPlus_GraphicsSetSmoothingMode($hCanvas2, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas2, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hImage_Bg = _GDIPlus_BitmapCreateFromMemory(_BG_Image()) Local Const $hHBitmap3 = _WinAPI_BitmapCreateDIB($iW, $iH) Local Const $hDC_backbuffer3 = _WinAPI_CreateCompatibleDC($hDC) Local Const $hDC_obj3 = _WinAPI_SelectObject($hDC_backbuffer3, $hHBitmap3) Local Const $hCanvas3 = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer3) Local $tColorMatrix = _GDIPlus_ColorMatrixCreate() DllStructSetData($tColorMatrix, "m", 2, 2) DllStructSetData($tColorMatrix, "m", -1, 12) DllStructSetData($tColorMatrix, "m", 0.0175, 19) Local $hIA = _GDIPlus_ImageAttributesCreate() _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) Local $iPosY = $iH - _GDIPlus_ImageGetHeight($hImage_Bg) $iPosY = $iPosY < 0 ? 0 : $iPosY _GDIPlus_GraphicsDrawImageRectRect($hCanvas3, $hImage_Bg, 0, 0, $iW, $iH, 0, $iPosY, $iW, $iH, $hIA) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0x0B000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0C0FFC0), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16) _GDIPlus_GraphicsClear($hCanvas) $iFPS = 0 Local Const $fFontSize = 8, $iW_Char = Int($fFontSize * 1.5), $iH_Char = Int($fFontSize * 1.5), $iMaxSpeed = 8, $iMinSpeed = 2, _ $iAmountChars = ($bFullscreen ? 75 : 100) Local $aTable[$iAmountChars][4], $aChars[56], $i, $sChar, $iChar = 0 For $i = 0 To UBound($aChars) - 1 $aChars[$i] = ChrW($i + 65382) Next $sChar = $aChars[0] Local Const $hFamily = _GDIPlus_FontFamilyCreate("Times New Roman") Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize, 1) Local Const $hFont_Glow = _GDIPlus_FontCreate($hFamily, $iW_Char, 1) Local Const $tLayout2 = _GDIPlus_RectFCreate(0, 0, $iW_Char, $iH_Char) Local $tLayout3 = _GDIPlus_RectFCreate(0, 0, $iW_Char, $iH_Char) Local Const $hStringFormat = _GDIPlus_StringFormatCreate() Local Const $hBrush_Char = _GDIPlus_BrushCreateSolid(0xE8E0FFE0) , _ $hBrush_CharGlow = _GDIPlus_LineBrushCreateFromRectWithAngle($tLayout3, 0x4000FF00, 0xE0A0FFA0, 0, False, 1), _ $hBrush_CharGlow2 = _GDIPlus_BrushCreateSolid(0xF000FF00), _ $hBrush_Bg = _GDIPlus_HatchBrushCreate(9, 0xFF002800, 0xF0000000) _GDIPlus_LineBrushSetSigmaBlend($hBrush_CharGlow, 0.5, 1) _GDIPlus_LineBrushSetGammaCorrection($hBrush_CharGlow) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) For $i = 0 To UBound($aTable) - 1 $aTable[$i][0] = Random(0, $iW - $iW_Char) ;x $aTable[$i][1] = -1 * Random(3, 200) ;Y $aTable[$i][2] = Random($iMinSpeed, $iMaxSpeed) ;vy $aTable[$i][3] = $aTable[$i][1] - $iH_Char - 1 ;delta y counter Next Local $hGfx, $aChars_pre[UBound($aChars)][3] Local Const $hEffect = _GDIPlus_EffectCreateBlur(2) For $i = 0 To UBound($aChars_pre) - 1 $aChars_pre[$i][0] = _GDIPlus_BitmapCreateFromScan0($iW_Char, $iH_Char) $hGfx = _GDIPlus_ImageGetGraphicsContext($aChars_pre[$i][0]) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 3) _GDIPlus_GraphicsDrawStringEx($hGfx, $aChars[$i], $hFont_Glow, $tLayout2, $hStringFormat, $hBrush_CharGlow) _GDIPlus_GraphicsDispose($hGfx) $aChars_pre[$i][1] = _GDIPlus_BitmapCreateFromScan0($iW_Char, $iH_Char) $hGfx = _GDIPlus_ImageGetGraphicsContext($aChars_pre[$i][1]) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 3) _GDIPlus_GraphicsDrawStringEx($hGfx, $aChars[$i], $hFont, $tLayout2, $hStringFormat, $hBrush_Char) _GDIPlus_GraphicsDispose($hGfx) $aChars_pre[$i][2] = _GDIPlus_BitmapCreateFromScan0($iW_Char, $iH_Char) $hGfx = _GDIPlus_ImageGetGraphicsContext($aChars_pre[$i][2]) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 3) _GDIPlus_GraphicsDrawStringEx($hGfx, $aChars[$i], $hFont_Glow, $tLayout2, $hStringFormat, $hBrush_CharGlow2) _GDIPlus_BitmapApplyEffect($aChars_pre[$i][2], $hEffect) _GDIPlus_GraphicsDispose($hGfx) Next _GDIPlus_EffectDispose($hEffect) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $c = 500, $bDisplay = -1 Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas2, "handle", $hBrush_Bg, "float", 0, "float", 0, "float", $iW, "float", $iH) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, "float", $iW, "float", $iH) For $i = 0 To UBound($aTable) - 1 If $aTable[$i][1] - $aTable[$i][3] > $iH_Char Then DllCall($__g_hGDIPDll, "int", "GdipDrawImageRect", "handle", $hCanvas, "handle", $aChars_pre[$iChar][0], "float", $aTable[$i][0], "float", $aTable[$i][1], "float", $iW_Char, "float", $iH_Char) $aTable[$i][3] = $aTable[$i][1] EndIf $iChar = Random(0, UBound($aChars) - 1, 1) DllCall($__g_hGDIPDll, "int", "GdipDrawImageRect", "handle", $hCanvas2, "handle", $aChars_pre[$iChar][2], "float", $aTable[$i][0], "float", $aTable[$i][1], "float", $iW_Char, "float", $iH_Char) DllCall($__g_hGDIPDll, "int", "GdipDrawImageRect", "handle", $hCanvas2, "handle", $aChars_pre[$iChar][1], "float", $aTable[$i][0], "float", $aTable[$i][1], "float", $iW_Char, "float", $iH_Char) $aTable[$i][1] += $aTable[$i][2] If $aTable[$i][1] > $iH Then $aTable[$i][0] = Random(0, $iW - $iW_Char, 1) ;x $aTable[$i][1] = -1 ;Y $aTable[$i][2] = Random($iMinSpeed, $iMaxSpeed) ;vy $aTable[$i][3] = $aTable[$i][1] - $iH_Char - 1 ;delta y EndIf Next _GDIPlus_GraphicsDrawStringEx($hCanvas2, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) If Not Mod($c, 1000) Then $bDisplay *= -1 EndIf $c += 1 If $bDisplay = 1 Then _WinAPI_BitBlt($hDC_backbuffer, 0, 0, $iW, $iH, $hDC_backbuffer3, 0, 0, $SRCPAINT) _WinAPI_BitBlt($hDC_backbuffer2, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCPAINT) Switch $bFullscreen Case True _WinAPI_StretchBlt($hDC, $iPosMainScreen, 0, @DesktopWidth, @DesktopHeight, $hDC_backbuffer2, 0, 0, $iW, $iH, $SRCCOPY) Case Else _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer2, 0, 0, $SRCCOPY) EndSwitch $iFPS += 1 If $bExit Then ExitLoop DllCall($_MDKernel32Dll, "none", "Sleep", "uint", 5) Until False AdlibUnRegister("CalcFPS") ;release resources For $i = 0 To UBound($aChars_pre) - 1 _GDIPlus_ImageDispose($aChars_pre[$i][0]) _GDIPlus_ImageDispose($aChars_pre[$i][1]) _GDIPlus_ImageDispose($aChars_pre[$i][2]) Next _GDIPlus_ImageAttributesDispose($hIA) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_FontDispose($hFont_Glow) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_BrushCreateSolid($hBrush_Char) _GDIPlus_BrushCreateSolid($hBrush_CharGlow) _GDIPlus_BrushCreateSolid($hBrush_CharGlow2) _GDIPlus_BrushCreateSolid($hBrush_Bg) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_ImageDispose($hImage_Bg) _GDIPlus_GraphicsDispose($hCanvas3) _WinAPI_SelectObject($hDC_backbuffer3, $hDC_obj3) _WinAPI_DeleteDC($hDC_backbuffer3) _GDIPlus_GraphicsDispose($hCanvas2) _WinAPI_SelectObject($hDC_backbuffer2, $hDC_obj2) _WinAPI_DeleteDC($hDC_backbuffer2) _WinAPI_DeleteObject($hHBitmap2) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $hDC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) FMUSIC_StopSong($hMod) FSOUND_Close() MemoryDllClose($F_DLL) MemoryDllExit() DllClose($_MDKernel32Dll) EndFunc ;==>TheMatrix_v1 Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func _WinAPI_BitmapCreateDIB($iWidth, $iHeight) Local $tBMI = DllStructCreate($tagBITMAPINFO) $tBMI.biSize = DllStructGetSize($tBMI) $tBMI.biWidth = $iWidth $tBMI.biHeight = -$iHeight $tBMI.biPlanes = 1 $tBMI.biBitCount = 32 $tBMI.biCompression = $BI_RGB Local $aResult = DllCall("gdi32.dll", "ptr", "CreateDIBSection", "hwnd", 0, "struct*", $tBMI, "uint", 0, "ptr*", 0, "ptr", 0, "uint", 0) Return $aResult[0] EndFunc ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _BG_Image($bSaveBinary = False, $sSavePath = @ScriptDir) Local $BG_Image $BG_Image &= 'iVBORw0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BddrBP7QOUG68oOqXVeeNlA+wAL91SrOx+lHCm8FOl7x8hSDMjU8w///NlOcDlcFPI0Tk7enw+Ycnt3bDiAhqLSlTicRP4yQSdIP9G0aIg6F3cUlfr2ECSdGkzIOKZ8WKRALIPfwXob3srtbd5/R4yJkJJcYNroCoZaMzZ60fxagqQY+W0c9GR3yb/bSM8XQ3pxZMcHEOTuqmgLgsH6KmLLWv+dH2UGlbXKOf6xQ36dvViR5bk1titMLZVUqBS1nwavS6cYOjdGBAG0vFqSQ3nx4M1oXNaI7qvWimm0Gr9bK/EjiNNGroWMm3IkxMgu69sI8j/twS5+biz0fwAA' $BG_Image &= 'AABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($BG_Image) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Neo_Matrix_800x500_cut_32c.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_BG_Image You need The Matrix Sound.au3 which is in the Zip archive (see below) to run the code properly! Download: The Matrix v1.31 (incl. sound), without sound The Matrix v1.30 Can you decipher the code?
-
Here some graphical examples written completely in FreeBasic just for fun. _WinAPI_SetWindowTitleIcon Check for Numeric Entry in an EditBox using RegEx CreateWindowEx (hGUI) Example FB 3D Starfield Rotating Flight FB File2Bas Code Generator FB Fire Particles FB Fireworks FB GFX Examples FB Image to Trapezoid Transformation FB Layered Parallax Effect FB Plasma FB Puristic Clock FB Rotating Cube FB Rotating Earth FB Rutt Etra Izer Effect FB Simple Recursive Tree Generator FB Snowfall FB Tunnel Flight FB Water Effect FMOD Examples GDI - GDI+ 3D Sinus Wave GDI - GDI+ Animated Pythagoras Tree GDI - GDI+ Bezier Lines GDI - GDI+ Particles - Repulsive Force Sim v2.0 GDI - GDI+ Plasma v5 Booster GDI - GDI+ Random Pattern GDI - GDI+ Space Flight GDI - GDI+ Tunnel Flight - WipeOut Style GDI Classic Raytraced Tunnel GDI Elastic Twister Effect GDI Exploding Pixels GDI Infinite Image Zoom Flight GDI Liquid Pixels GDI Mandelbrot GDI Particle Repulsion Grid GDI Particles Mouse Attraction GDI Starfield GDI The Nautilus Raymarcher GDI Worm Tunnel Flight GDI+ 3D Starfield Scrolling v1 Booster GDI+ 3D Starfield Scrolling v3 Booster GDI+ Convert Bitmap to ASCII GDI+ GIF Anim to ASCII Player GDI+ Image Painting GDI+ Impossible Possible GDI+ Kaleidoscope GDI+ Performance Test - Au3 vs FB GDI+ Polar Clock GDI+ Rotating Earth GDI+ Spiral Text GDI+ Star Wars Scroller GDI+ Streamer GDI+ Swiss Railway Clock GDI+ The MATRIX Ini Read - Write Rutt_Etra_Izer_Booster Stack TitchySID uFMOD Download: FreeBasic Examples build 2019-05-08.rar I will add new examples from time to time. FreeBasic source codes are also included.
-
hello Im wondering if it is possible to process image in autoit like this 1. firstly there is colorfull wallpaper 2. Fill all colors (exception rose color) - with white 3. Fill rose color with black color I see Gdi functions have things to manipulate images https://imgur.com/a/lFdY26g
-
_GDIPlus_MarkScreenRegionAnimated build 2020-08-07 beta
UEZ posted a topic in AutoIt Example Scripts
Here another example to mark the desktop to get the marked region for capturing. This example is not perfect and not very fast (room for improvements). ;Coded by UEZ build 2020-08-07 beta ;Code cleanup up mLipok ; ;Short instruction: mark area on your desktop and press return key to capture. #include <APISysConstants.au3> #include <Array.au3> ;#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAware) Global $__g_hGUI_MarkArea, $__g_hGUI_Bg, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _ $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4, $__g_bSelectionDone = False Global $aRect = _GDIPlus_MarkScreenRegionAnimated() Global $hImage_Capture = _ScreenCapture_Capture(@TempDir & "\Test.png", $aRect[0], $aRect[1], $aRect[0] + $aRect[2] - 1, $aRect[1] + $aRect[3] - 1, False) ShellExecute(@TempDir & "\Test.png") ;_ArrayDisplay($aRect, "Marked area coordinates") Func _GDIPlus_MarkScreenRegionAnimated($bAnim = True) _GDIPlus_Startup() Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) $__g_hGUI_Bg = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], BitOR($WS_CLIPCHILDREN, $WS_POPUP), $WS_EX_TOPMOST) ;to avoid cursor flickering and for proper control read WinSetTrans($__g_hGUI_Bg, "", 0x01) $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $bAnim ? $WS_POPUP : BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $__g_hGUI_Bg) GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea) If Not $bAnim Then $__g_iColor_ResizeDots = 0xFF0000 $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) GUISetState(@SW_SHOWNA, $__g_hGUI_Bg) GUISetState(@SW_SHOW, $__g_hGUI_MarkArea) $__g_iOldCursor = MouseGetCursor() GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0) Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $aOldWinPos, $aOldMPos, $bMoved Local $aGUIStartPos, $iKey_Exit = GUICtrlCreateButton("", $aFullScreen[0] - 10, $aFullScreen[1] - 10, 1, 1), $aAccelKeys[1][2] = [["{ENTER}", $iKey_Exit]] GUISetAccelerators($aAccelKeys, $__g_hGUI_Bg) GUISetAccelerators($aAccelKeys, $__g_hGUI_MarkArea) #forceref $bMoved Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iKey_Exit If $bAnim Then GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID) GUIRegisterMsg($WM_ERASEBKGND, "") EndIf _GDIPlus_Shutdown() Local $aResult = WinGetPos($__g_hGUI_MarkArea) $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0] $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1] GUIDelete($__g_hGUI_MarkArea) GUIDelete($__g_hGUI_Bg) If Not $__g_bSelectionDone Then $aResult = 0 Return $aResult EndSwitch $aMPos = MouseGetPos() If ($aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1]) And (Not $__g_bSelectionDone) Then WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1]) $aPrevMPos = $aMPos EndIf $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If $aCI[2] And (Not $__g_bSelectionDone) Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $bAnim Then GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 50, "ptr", 0)[0] EndIf While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) $aMPos = MouseGetPos() $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1 $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1 If $aMPos[0] < $aGUIStartPos[0] Then $iX = $aMPos[0] Else $iX = $aGUIStartPos[0] EndIf If $aMPos[1] < $aGUIStartPos[1] Then $iY = $aMPos[1] Else $iY = $aGUIStartPos[1] EndIf WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH) UpdateCtrlPos($bAnim) WEnd $__g_bSelectionDone = True GUISetCursor(3, 1, $__g_hGUI_MarkArea) ElseIf $aCI[3] And $__g_bSelectionDone Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aGUIStartPos[0], $aGUIStartPos[1], $aGUIStartPos[0] + $aGUIStartPos[2], $aGUIStartPos[1] + $aGUIStartPos[3]) Then $aMPos = MouseGetPos() $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) While $aCI[3] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aGUIStartPos[0] - ($aMPos[0] - MouseGetPos(0)), $aGUIStartPos[1] - ($aMPos[1] - MouseGetPos(1)), $__g_iW, $__g_iH) GUISetCursor(0, 1, $__g_hGUI_Bg) GUISetCursor(0, 1, $__g_hGUI_MarkArea) WEnd GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndIf EndIf If $__g_bSelectionDone Then $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If @error Then ContinueLoop Switch $aCI[4] Case $__g_iLabel_TL GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), MouseGetPos(1), $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BR GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TR GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BL GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_LM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_RM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2], $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2], $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case Else GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndSwitch EndIf Until False EndFunc ;==>_GDIPlus_MarkScreenRegionAnimated Func UpdateCtrlPos($bAnim = True) Local Const $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "") $__g_iW = $aGUIStartPos[2] $__g_iH = $aGUIStartPos[3] ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TL, 0, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") EndFunc ;==>UpdateCtrlPos Func PlayBorderAnim() Local $aWinPos = WinGetClientSize($__g_hGUI_MarkArea), $iW = $aWinPos[0], $iH = $aWinPos[1] Local Static $fOffset = 0 Local Const $iSize = $__g_iBorder / 2 Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $__g_iColor_ResizeDots), $hPen3 = _GDIPlus_PenCreate(0xFF000000) _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOT) _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF) ;for faster performance direct dll calls DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen2, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) $fOffset += 0.5 _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_PenDispose($hPen3) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>PlayBorderAnim Func WM_ERASEBKGND($hWnd, $iMsgm, $wParam, $lParam) ;suppress repainting to avoid flickering but causes some other side effects #forceref $iMsgm, $wParam, $lParam, $hWnd Local Const $hBrush = _WinAPI_CreateSolidBrush(0xEFCDAB) ;BGR format ;~ _WinAPI_RedrawWindow($__g_hGUI_MarkArea, 0, 0, BitOR($RDW_NOERASE, $RDW_NOCHILDREN, $RDW_NOFRAME, $RDW_VALIDATE)) _WinAPI_SetClassLongEx($__g_hGUI_MarkArea, $GCL_HBRBACKGROUND, $hBrush) _WinAPI_DeleteObject($hBrush) Return 0 EndFunc ;==>WM_ERASEBKGND ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 3) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext Just press the lmb and move your mouse. When lmb is released you can adjust the size of the window by dragging the white rectangle to any direction. Rmb will move the marked area. Press ESC to get the coordinates of the marked region. If you have any improvements, please post it here. Tested on Win10 x64 only. -
I was looking around the help file and I came across _GDIPlus_GraphicsDrawRect and _WinAPI_DrawLine and I seem to be having the same "problem" where every time it draws into a window and you lose or gain focus it has to redraw itself. Is there anyway around this? #include <WindowsConstants.au3> #include <WinAPI.au3> #Include <GDIPlus.au3> _GDIPlus_Startup() Run("notepad.exe") $hWnd = WinWait("Untitled") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $Color = 0xFFFF0000 $hPen = _GDIPlus_PenCreate($Color, 2) For $i = 1 To 10 _GDIPlus_GraphicsDrawRect($hGraphic, 200, 200, 25 ,25, $hPen) ToolTip($i) Sleep(1000) Next _WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown()
-
-
I have a situation where I am repeatedly capturing a region of the screen and feeding it into Tesseract OCR. Since the OCR is a relatively slow operation, I would like to create an in memory cache of the ocr results. An ideal hash key for this cache would be a checksum of the captured image. With this I could capture the region, checksum it, and then only if I don't get a cache hit I would write the image out to disk for external OCR. Now I know I can do this by saving the captured image out to disk, and then summing the disk file with _Crypt_HashFile(). But that's still slower than I would like, and it shouldn't be necessary. Ideally, it should be possible to checksum the image data directly in memory so I don't have to go to disk at all. In order to do that, I need a way to dump a representation of the image into a string (or some equivalent). Then I could use the _Crypt_HashData() function against that string to create my cache hash key. Googling around I found an article here that shows a way to convert an image object to a byte array using System.Drawing. This was the closest thing I found to what I'm trying to do. I don't know if that method could be used from within AutoIT, or if perhaps there may be a better way I don't know about. If someone could give me a shove in the right direction it would be a big help. Thanks!
- 1 reply
-
- image capture
- gdi
-
(and 1 more)
Tagged with:
-
This is a visual Crop Tool, Version 1.0.0.5 Load the image in the Crop GUIMove the cross-hair to the upper left corner where to start croppingMark the rectangle with left mouse button, releaseAdjust the position with left mouse, release (right mouse = start over)Press enterImage is saved in same folder, same format, with '_cr' added to file nameAs simple as that. Updated script, Visual Crop UDF 1.0.0.4 examples.au3 Visual Crop UDF 1.0.0.4.au3 (No obscuration of non-selected area) Visual Crop UDF 1.0.0.5.au3 (with obscuration) Ver 1.0.0.1 Avoid trespassing the edge of the GUI while selecting the crop area.Ver 1.0.0.4 Mark crop area in any directionResizing Corner grabbers (use with Ctrl Left Mouse button)Mouse cursor changes over move and resizing corner grabbersRedraw when left mouse clicking outside of crop area (restart crop), right Mouse click, same result.Magnifier de-/selectable with Ctrl-M or F2. (original function by Melba23) Note: without image ratio: Magnifier remains visible till the crop area has been marked with image ratio: Magnifier is only visible until the rectangle appears, first corner has been marked. Ver 1.0.0.5 Obscure non crop area, did some hard thinking and found my way... Missing still: ?Enjoy GreenCan Related:
-
Draw Path Points allows you to make line paths for drawing with gdi You can even load an image and trace the outline Save and load functionality undo and redo zoom and scale; Don't Forget Rotate! ;Draw Path Points BILGUS 2018 ;Includes #include <File.au3> #include <GDIPlus.au3> #include <GUIConstants.au3> #include <GuiEdit.au3> #include <GuiListView.au3> #include <GuiTab.au3> #include <Misc.au3> If OnAutoItExitRegister("_Exit") <> 0 Then _GDIPlus_Startup() ;initialize GDI+ ConsoleWrite("GDI+ Started" & @CRLF) EndIf Opt("MouseCoordMode", 2) ;Relative coords to the client area of the active window Opt("PixelCoordMode", 2) ;Relative coords to the client area of the active window Global $g_iXScale = 8 Global $g_iYScale = $g_iXScale Global $g_sFileSave = @ScriptDir & "\DrawPath.txt" ;Default Global $g_bClosePath = False Global $g_bShowImage = False Global $g_sImagefile = "" Global $g_iUndo_Max = 50 Global $g_asUndo_Files[1] = [""] Global $g_asRedo_Files[1] = [""] Global $g_aPath_Points[1][2] = [[0, 0]] Global $g_aPath_Rot_Points Global $g_hForm1 = GUICreate("Draw Path Points", 615, 437, 192, 124) Global $g_hSelSquare = GUICtrlCreateLabel("", 0, 0, 0, 0, $SS_BLACKFRAME, $WS_EX_TOPMOST) GUICtrlSetState(-1, $GUI_HIDE) ;------------------------------------------------------------------------------- Global Enum $eC1_delete, $eC1_del_all, $eC1_update, $eC1_shift_dn, $eC1_shift_up, _ $eC1_closepath, $eC1_showimg, $eC1_lock, $eC1_undo, $eC1_redo, $aCtl1_LAST Global $g_ahCtl1[$aCtl1_LAST] Control_Create_Group1() ;------------------------------------------------------------------------------- Global Enum $eC2_zin, $eC2_zout, $eC2_dgroup, $eC2_decx, $eC2_incx, $eC2_decy, _ $eC2_incy, $eC2_edit_rot, $eC2_rot, $eC2_ud_rot, $eC2_rev, $eC2_toall, $aCtl2_LAST Global $g_ahCtl2[$aCtl2_LAST] Control_Create_Group2() ;------------------------------------------------------------------------------- Global $g_hBtn_load = GUICtrlCreateButton("Load", 5, 1, 35, 20) Global $g_hBtn_save = GUICtrlCreateButton("Save", 40, 1, 35, 20) Global $g_hBtn_arr_disp = GUICtrlCreateButton("Array", 75, 1, 35, 20) Global $g_hEdit_encoded = GUICtrlCreateEdit("", 115, 2, 50, 18, $ES_READONLY + $ES_AUTOHSCROLL, $WS_EX_STATICEDGE + $WS_EX_TRANSPARENT) Global $g_hList1 = GUICtrlCreateListView("#|x|y", 5, 24, 161, 201, $LVS_SHOWSELALWAYS Or $LVS_SINGLESEL) Global $g_hList1_LVN = GUICtrlCreateDummy() ;listview notifications Global $g_hImage1 = GUICtrlCreatePic("", 200, 16, 400, 400, -1, $WS_EX_LAYERED) Global $g_hTab1 = GUICtrlCreateTab(1, 225, 20, 500, $TCS_VERTICAL) GUICtrlCreateTabItem(" ") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateTabItem(" ") GUICtrlCreateTabItem("") ; end tabitem definition For $i = 0 To UBound($g_ahCtl2) - 1 GUICtrlSetState($g_ahCtl2[$i], $GUI_HIDE) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") List_Update() List_Index() GUISetState(@SW_SHOW) State_Save($g_aPath_Points) Points_Update($g_aPath_Points) Global $g_nMsg = 0 While 1 $g_nMsg = GUIGetMsg() If $g_nMsg > 0 And $g_nMsg <> $g_ahCtl2[$eC2_ud_rot] And $g_nMsg <> $g_ahCtl2[$eC2_edit_rot] And GUICtrlRead($g_ahCtl2[$eC2_edit_rot]) <> 0 Then ;ConsoleWrite("Cancel_Rotate? " & $g_nMsg & @CRLF) If MsgBox($MB_ICONQUESTION + $MB_OKCANCEL + $MB_DEFBUTTON2, "Save?", "Save Rotated Points?", 10) == $IDOK Then _GUICtrlEdit_SetText($g_ahCtl2[$eC2_edit_rot], "0") $g_aPath_Points = $g_aPath_Rot_Points State_Save($g_aPath_Points) List_Update(List_Index()) Else _GUICtrlEdit_SetText($g_ahCtl2[$eC2_edit_rot], "0") Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage, List_Index()) ;, True) EndIf EndIf Switch $g_nMsg Case $GUI_EVENT_CLOSE Exit Case $g_hTab1 Tab1_Select() Case $g_hSelSquare ;ConsoleWrite("SelSquare" & @CRLF) SelSquare_Drag() Case $g_hList1 ;ConsoleWrite("List1 " & $g_nMsg & @CRLF) Local $iIndex = List_Index() If $iIndex <> -1 Then Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage, $iIndex) _GUICtrlListView_SetItemSelected($g_hList1, $iIndex, True, True) EndIf Case $g_hList1_LVN Point_Selected($g_aPath_Points, $g_hImage1, List_Index()) Case $g_hList1_LVN Case $g_hImage1 Image1_Clicked() Case $g_hBtn_save Btn_save_Clicked() Case $g_hBtn_load Btn_load_Clicked() Case $g_hBtn_arr_disp _ArrayDisplay($g_aPath_Points) ;------------------------------------------------------------------- Case $g_ahCtl1[$eC1_shift_up] $iIndex = List_Index() Point_Swap($iIndex, -1) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_shift_dn] $iIndex = List_Index() Point_Swap($iIndex, 1) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_del_all] $g_aPath_Points = 0 Global $g_aPath_Points[1][2] = [[0, 0]] List_Update() Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_delete] $iIndex = List_Index() Point_Delete($iIndex) _GUICtrlListView_ClickItem($g_hList1, $iIndex) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_redo] $g_aPath_Points = State_Restore($g_aPath_Points, False) List_Update() Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_undo] $g_aPath_Points = State_Restore($g_aPath_Points, True) List_Update() Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Case $g_ahCtl1[$eC1_update] List_Update(List_Index()) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Ascii_Points($g_aPath_Points) _GUICtrlEdit_SetSel($g_hEdit_encoded, 0, -1) Case $g_ahCtl1[$eC1_closepath] $g_bClosePath = Control_IsChecked($g_ahCtl1[$eC1_closepath]) List_Update(List_Index()) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) If $g_bClosePath Then GUICtrlSetState($g_ahCtl2[$eC2_rev], $GUI_DISABLE) Else GUICtrlSetState($g_ahCtl2[$eC2_rev], $GUI_ENABLE) EndIf Case $g_ahCtl1[$eC1_showimg] If Not $g_bShowImage Then $g_sImagefile = FileOpenDialog("Select an image", SplitDir($g_sImagefile), "All Files(*.*)", 0, SplitFileName($g_sImagefile), $g_hForm1) EndIf $g_bShowImage = Control_IsChecked($g_ahCtl1[$eC1_showimg]) List_Update(List_Index()) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) ;------------------------------------------------------------------- Case $g_ahCtl2[$eC2_zin] If Control_IsChecked($g_ahCtl2[$eC2_toall]) Then Points_Scale(1, 1) Else $g_iXScale += 1 $g_iYScale += 1 Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndIf _GUICtrlListView_ClickItem($g_hList1, List_Index()) Case $g_ahCtl2[$eC2_zout] If Control_IsChecked($g_ahCtl2[$eC2_toall]) Then Points_Scale(-1, -1) Else $g_iXScale -= 1 $g_iYScale -= 1 Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndIf _GUICtrlListView_ClickItem($g_hList1, List_Index()) Case $g_ahCtl2[$eC2_rev] $iIndex = List_Index() $g_aPath_Points = Points_Reverse($g_aPath_Points) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage, $iIndex) ;, True) List_Update($iIndex) Case $g_ahCtl2[$eC2_edit_rot] ;ConsoleWrite("Rotate" & @CRLF) $iIndex = List_Index() Local $iDegrees = GUICtrlRead($g_ahCtl2[$eC2_edit_rot]) $g_aPath_Rot_Points = Points_Rotate($g_aPath_Points, $iDegrees) Points_Update($g_aPath_Rot_Points, $g_bClosePath, $g_bShowImage, $iIndex) ;, True) Case $g_ahCtl2[$eC2_incx] Point_Adjust(1, 0, Control_IsChecked($g_ahCtl2[$eC2_toall])) Case $g_ahCtl2[$eC2_decx] Point_Adjust(-1, 0, Control_IsChecked($g_ahCtl2[$eC2_toall])) Case $g_ahCtl2[$eC2_incy] Point_Adjust(0, 1, Control_IsChecked($g_ahCtl2[$eC2_toall])) Case $g_ahCtl2[$eC2_decy] Point_Adjust(0, -1, Control_IsChecked($g_ahCtl2[$eC2_toall])) EndSwitch WEnd ;---------------------------------------------------------------------------------------------------- Func _Exit() _GDIPlus_Shutdown() ConsoleWrite("GDI+ Stopped" & @CRLF) State_Destroy() EndFunc ;==>_Exit Func Ascii_Points($aPts) ;encodes points into an ascii string Local Const $iChrOffset = 33 Local Const $iMaxOffset = 126 - $iChrOffset If Not IsArray($aPts) Then Return Local $sAscEnc = StringFormat("%03i%05i", $iChrOffset, UBound($aPts) * 2 + 8) If _ArrayMin($aPts) >= 0 And (_ArrayMax($aPts) - _ArrayMin($aPts)) <= $iMaxOffset Then For $i = 0 To UBound($aPts) - 1 $sAscEnc = $sAscEnc & Chr($aPts[$i][0] + $iChrOffset) & Chr($aPts[$i][1] + $iChrOffset) Next EndIf _GUICtrlEdit_SetText($g_hEdit_encoded, $sAscEnc) EndFunc ;==>Ascii_Points Func Btn_load_Clicked() ConsoleWrite("Load: " & SplitDir($g_sFileSave) & @CRLF) $g_sFileSave = FileOpenDialog("Select a save file", SplitDir($g_sFileSave), "All Files(*.*)", 0, SplitFileName($g_sFileSave), $g_hForm1) _FileReadToArray($g_sFileSave, $g_aPath_Points, 0, ",") If @error Then Dim $g_aPath_Points[1][2] = [[0, 0]] Else State_Destroy() State_Save($g_aPath_Points) EndIf List_Update() Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndFunc ;==>Btn_load_Clicked Func Btn_save_Clicked() List_Update(List_Index()) $g_sFileSave = FileOpenDialog("Select a save file", SplitDir($g_sFileSave), "All Files(*.*)", 0, SplitFileName($g_sFileSave), $g_hForm1) _FileWriteFromArray($g_sFileSave, $g_aPath_Points, 0, Default, ",") EndFunc ;==>Btn_save_Clicked Func Control_Create_Group1() Local $iX = 30 Local $iY = 225 $g_ahCtl1[$eC1_delete] = GUICtrlCreateButton("Delete", $iX + 0, $iY + 0, 50, 20) $g_ahCtl1[$eC1_shift_dn] = GUICtrlCreateButton("+", $iX + 70, $iY + 0, 20, 20) $g_ahCtl1[$eC1_shift_up] = GUICtrlCreateButton("-", $iX + 95, $iY + 0, 20, 20) $g_ahCtl1[$eC1_del_all] = GUICtrlCreateButton("Delete All", $iX + 0, $iY + 25, 50, 20) $g_ahCtl1[$eC1_update] = GUICtrlCreateButton("Update", $iX + 70, $iY + 25, 50, 20) $g_ahCtl1[$eC1_undo] = GUICtrlCreateButton("Undo", $iX + 0, $iY + 50, 50, 20) $g_ahCtl1[$eC1_redo] = GUICtrlCreateButton("Redo", $iX + 70, $iY + 50, 50, 20) GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) $g_ahCtl1[$eC1_closepath] = GUICtrlCreateCheckbox("Complete", $iX + 0, $iY + 70, 65, 25) $g_ahCtl1[$eC1_showimg] = GUICtrlCreateCheckbox("Image", $iX + 0, $iY + 90, 65, 25) $g_ahCtl1[$eC1_lock] = GUICtrlCreateCheckbox("Locked", $iX + 0, $iY + 110, 65, 25) EndFunc ;==>Control_Create_Group1 Func Control_Create_Group2() Local $iX = 30 Local $iY = 225 $g_ahCtl2[$eC2_rev] = GUICtrlCreateButton("Reverse", $iX + 0, $iY + 0, 50, 20) $g_ahCtl2[$eC2_edit_rot] = GUICtrlCreateInput("0", $iX + 0, $iY + 25, 40, 20) $g_ahCtl2[$eC2_ud_rot] = GUICtrlCreateUpdown(-1) GUICtrlSetLimit($eC2_ud_rot, 360, -360) $g_ahCtl2[$eC2_rot] = GUICtrlCreateButton("", $iX + 40, $iY + 25, 10, 20) $g_ahCtl2[$eC2_dgroup] = GUICtrlCreateGroup("Coords", 5 + $iX + 70, $iY + 0, 55, 70) $g_ahCtl2[$eC2_decy] = GUICtrlCreateButton("-", 24 + $iX + 70, 16 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incy] = GUICtrlCreateButton("+", 24 + $iX + 70, 48 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_decx] = GUICtrlCreateButton("-", 8 + $iX + 70, 32 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incx] = GUICtrlCreateButton("+", 40 + $iX + 70, 32 + $iY + 0, 17, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $g_ahCtl2[$eC2_zout] = GUICtrlCreateButton("Zoom -", $iX + 0, $iY + 75, 50, 20) $g_ahCtl2[$eC2_zin] = GUICtrlCreateButton("Zoom +", $iX + 75, $iY + 75, 50, 20) $g_ahCtl2[$eC2_toall] = GUICtrlCreateCheckbox("Apply to all", $iX + 0, $iY + 100, 80, 25) EndFunc ;==>Control_Create_Group2 Func Control_IsChecked($IdCtrl) Return (BitAND(GUICtrlRead($IdCtrl), $GUI_CHECKED) = $GUI_CHECKED) EndFunc ;==>Control_IsChecked Func GDI_Draw_ArrayPoints(ByRef $aPts, $hImage, $g_bClosePath, $iX, $iY, $sFileName, $iSelected = -1) Local $hWnd = GUICtrlGetHandle($hImage) If UBound($aPts) > 1 Then Local $aPoints = GDI_Points($aPts, $iX, $iY) Else Local $aPoints[1][2] = [[0, 0]] EndIf Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;create a graphics object from a window handle _GDIPlus_GraphicsClear($hGraphics, 0xFFFFFFFF) If FileExists($sFileName) Then Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sFileName) Local Const $iWidth = ScaleX(_GDIPlus_ImageGetWidth($hBitmap)) Local Const $iHeight = ScaleY(_GDIPlus_ImageGetHeight($hBitmap)) Local $hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap, $iWidth, $iHeight) ;resize image _GDIPlus_BitmapDispose($hBitmap) ;Done with initial bitmap _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, 0, 0) _GDIPlus_BitmapDispose($hBitmap_Scaled) EndIf Local $hPen = _GDIPlus_PenCreate(0xFFFF0000, ScaleX(1)) Local $hEndCap = _GDIPlus_ArrowCapCreate(1, 1) _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap) If $g_bClosePath Then _GDIPlus_GraphicsDrawPolygon($hGraphics, $aPoints, $hPen) Local $iX0, $iY0, $iX1, $iY1 For $i = 1 To $aPoints[0][0] If Not $g_bClosePath And $i < $aPoints[0][0] Then $iX0 = $aPoints[$i][0] $iY0 = $aPoints[$i][1] $iX1 = $aPoints[$i + 1][0] $iY1 = $aPoints[$i + 1][1] _GDIPlus_GraphicsDrawLine($hGraphics, $iX0, $iY0, $iX1, $iY1, $hPen) EndIf Next _GDIPlus_ArrowCapDispose($hEndCap) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphics) Point_Selected($aPts, $hImage, $iSelected) EndFunc ;==>GDI_Draw_ArrayPoints Func GDI_Line_hPath_From_Points($aPts, $iXorig, $iYorig) ;Returns hpath object be sure to delete it when finished Local $hPath = _GDIPlus_PathCreate() ;Create new path object Local $aPoints = GDI_Points($aPts, $iXorig, $iYorig) Local $iX0, $iY0, $iX1, $iY1 If IsArray($aPoints) Then For $i = 1 To $aPoints[0][0] - 1 $iX0 = $aPoints[$i][0] $iY0 = $aPoints[$i][1] $iX1 = $aPoints[$i + 1][0] $iY1 = $aPoints[$i + 1][1] _GDIPlus_PathAddLine($hPath, $iX0, $iY0, $iX1, $iY1) Next EndIf Return $hPath ;_GDIPlus_PathDispose($hPath) EndFunc ;==>GDI_Line_hPath_From_Points Func GDI_Points($aPts, $iXo, $iYO) Local $aGDIPts If IsArray($aPts) And UBound($aPts) > 1 Then Local $aGDIPts[UBound($aPts) + 1][2] $aGDIPts[0][0] = UBound($aPts) For $i = 1 To $aGDIPts[0][0] ;Build points list $aGDIPts[$i][0] = ScaleX($aPts[$i - 1][0]) + $iXo $aGDIPts[$i][1] = ScaleY($aPts[$i - 1][1]) + $iYO Next Else Local $aGDIPts[1][2] = [[0, 0]] EndIf Return $aGDIPts EndFunc ;==>GDI_Points Func Image1_Clicked() If Not Control_IsChecked($g_ahCtl1[$eC1_lock]) Then Local $aCPos = ControlGetPos(GUICtrlGetHandle($g_hImage1), "", 0) Local $aPos = MouseGetPos() If IsArray($aPos) And IsArray($aCPos) Then Local $iXn = Int(($aPos[0] - $aCPos[0] + ScaleX(1) / 2) / ScaleX(1)) Local $iYn = Int(($aPos[1] - $aCPos[1] + ScaleY(1) / 2) / ScaleY(1)) Point_Add(List_Index(), $iXn, $iYn) EndIf Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) Else ToolTip("Locked") Sleep(500) ToolTip("") EndIf EndFunc ;==>Image1_Clicked Func List_Index() Static Local $hWndList1 = GUICtrlGetHandle($g_hList1) Local $iIndex = _GUICtrlListView_GetSelectionMark($hWndList1) If _GUICtrlListView_GetItemSelected($g_hList1, $iIndex) Then Return $iIndex Return -1 EndFunc ;==>List_Index Func List_Update($iIndex = -1) Static $hWnd_List1 = GUICtrlGetHandle($g_hList1) _GUICtrlListView_BeginUpdate($g_hList1) _GUICtrlListView_DeleteAllItems($hWnd_List1) For $i = 0 To UBound($g_aPath_Points) - 1 GUICtrlCreateListViewItem($i & "|" & $g_aPath_Points[$i][0] & "|" & $g_aPath_Points[$i][1], $g_hList1) Next If $iIndex > -1 Then _GUICtrlListView_ClickItem($g_hList1, $iIndex) _GUICtrlListView_EnsureVisible($g_hList1, $iIndex) EndIf _GUICtrlListView_EndUpdate($g_hList1) EndFunc ;==>List_Update Func Point_Add($iIndex, $iX, $iY) If $iIndex <> -1 Then _ArrayInsert($g_aPath_Points, $iIndex, $iX & "|" & $iY, 0) _GUICtrlListView_InsertItem($g_hList1, $iIndex, $iIndex) _GUICtrlListView_SetItemText($g_hList1, $iIndex, $iX, 1) _GUICtrlListView_SetItemText($g_hList1, $iIndex, $iY, 2) _GUICtrlListView_EnsureVisible($g_hList1, $iIndex) Else _ArrayAdd($g_aPath_Points, $iX & "|" & $iY, 0) GUICtrlCreateListViewItem(UBound($g_aPath_Points) - 1 & "|" & $iX & "|" & $iY, $g_hList1) _GUICtrlListView_EnsureVisible($g_hList1, UBound($g_aPath_Points) - 1) EndIf State_Save($g_aPath_Points) EndFunc ;==>Point_Add Func Point_Adjust($iX, $iY, $bToAll) If Not $bToAll Then Local $iIndex = List_Index() If $iIndex == -1 And IsArray($g_aPath_Points) Then $iIndex = UBound($g_aPath_Points) - 1 If $iIndex == -1 Then Return $g_aPath_Points[$iIndex][0] += $iX $g_aPath_Points[$iIndex][1] += $iY _GUICtrlListView_SetItemText($g_hList1, $iIndex, $g_aPath_Points[$iIndex][0], 1) _GUICtrlListView_SetItemText($g_hList1, $iIndex, $g_aPath_Points[$iIndex][1], 2) If $iIndex <> UBound($g_aPath_Points) - 1 Then _GUICtrlListView_ClickItem($g_hList1, $iIndex) Else For $i = 0 To UBound($g_aPath_Points) - 1 $g_aPath_Points[$i][0] += $iX $g_aPath_Points[$i][1] += $iY Next List_Update(List_Index()) EndIf State_Save($g_aPath_Points) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndFunc ;==>Point_Adjust Func Point_Delete($iIndex) If $iIndex <> -1 Then _ArrayDelete($g_aPath_Points, $iIndex) _GUICtrlListView_DeleteItem($g_hList1, $iIndex) State_Save($g_aPath_Points) ;List_Update($iIndex) EndIf EndFunc ;==>Point_Delete Func Point_Modify($iIndex, $iX, $iY) If $iIndex <> -1 Then $g_aPath_Points[$iIndex][0] = $iX $g_aPath_Points[$iIndex][1] = $iY _GUICtrlListView_SetItemText($g_hList1, $iIndex, $iX, 1) _GUICtrlListView_SetItemText($g_hList1, $iIndex, $iY, 2) _GUICtrlListView_EnsureVisible($g_hList1, $iIndex) State_Save($g_aPath_Points) EndIf EndFunc ;==>Point_Modify Func Point_Selected($aPts, $hImage, $iIndex) If $iIndex > -1 Then GUICtrlSetState($g_hSelSquare, $GUI_HIDE) Local $hWnd = GUICtrlGetHandle($hImage) Local $aPos = ControlGetPos($hWnd, "", 0) If IsArray($aPos) And IsArray($aPts) Then _WinAPI_RedrawWindow($hWnd, Default, Default, $RDW_ERASENOW) Local $iXs = ScaleX($aPts[$iIndex][0]) + $aPos[0] - ScaleX(1) / 2 Local $iYs = ScaleY($aPts[$iIndex][1]) + $aPos[1] - ScaleY(1) / 2 WinMove(GUICtrlGetHandle($g_hSelSquare), "", $iXs, $iYs, ScaleX(1), ScaleY(1)) GUICtrlSetState($g_hSelSquare, $GUI_SHOW) ;ConsoleWrite("Point_Selected" & @CRLF) Else ConsoleWriteError("Error: Point_Selected" & @CRLF) EndIf EndIf EndFunc ;==>Point_Selected Func Point_Swap($iIndex1, $iNext) _GUICtrlListView_BeginUpdate($g_hList1) Local $iIndex2 = 0 Local $aTmp = 0 If $iIndex1 <> -1 Then $iIndex2 = $iIndex1 + $iNext If $iIndex2 > UBound($g_aPath_Points) - 1 Then $iIndex2 = 0 ElseIf $iIndex2 < 0 Then $iIndex2 = UBound($g_aPath_Points) - 1 EndIf _ArraySwap($g_aPath_Points, $iIndex1, $iIndex2) Local $iX1 = _GUICtrlListView_GetItemText($g_hList1, $iIndex1, 2) Local $iY1 = _GUICtrlListView_GetItemText($g_hList1, $iIndex1, 2) Local $iX2 = _GUICtrlListView_GetItemText($g_hList1, $iIndex2, 2) Local $iY2 = _GUICtrlListView_GetItemText($g_hList1, $iIndex2, 2) _GUICtrlListView_SetItemText($g_hList1, $iIndex1, $iX2, 1) _GUICtrlListView_SetItemText($g_hList1, $iIndex1, $iY2, 2) _GUICtrlListView_SetItemText($g_hList1, $iIndex2, $iX1, 1) _GUICtrlListView_SetItemText($g_hList1, $iIndex2, $iY1, 2) _GUICtrlListView_ClickItem($g_hList1, $iIndex2) _GUICtrlListView_EnsureVisible($g_hList1, $iIndex2) Else ;ConsoleWrite("Array Shift" & @CRLF) If $iNext > 0 Then ;ARRAY SHIFT -- Melba23 Local $iUBound = UBound($g_aPath_Points) ; Get size of array $aTmp = _ArrayExtract($g_aPath_Points, 0, $iUBound - 2) ; Extract all but last _ArrayInsert($aTmp, 0, _ArrayExtract($g_aPath_Points, $iUBound - 1, Default)) ; Insert last at top $g_aPath_Points = $aTmp Else $aTmp = _ArrayExtract($g_aPath_Points, 1, Default) ; Extract all but top row _ArrayAdd($aTmp, _ArrayExtract($g_aPath_Points, 0, 0)) ; Add top row at bottom $g_aPath_Points = $aTmp EndIf List_Update(List_Index()) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndIf State_Save($g_aPath_Points) _GUICtrlListView_EndUpdate($g_hList1) EndFunc ;==>Point_Swap Func Points_Reverse($aPts) Local $hPath = GDI_Line_hPath_From_Points($aPts, 0, 0) ;_GDIPlus_PathFlatten($hPath) _GDIPlus_PathReverse($hPath) Local $aPoints = _GDIPlus_PathGetPoints($hPath) _GDIPlus_PathDispose($hPath) If IsArray($aPoints) Then ;ConsoleWrite("Flipped_Points" & @CRLF) Global $aPts_Rev[$aPoints[0][0]][2] For $i = 1 To $aPoints[0][0] $aPts_Rev[$i - 1][0] = Int($aPoints[$i][0] / ScaleX(1)) $aPts_Rev[$i - 1][1] = Int($aPoints[$i][1] / ScaleY(1)) Next Return $aPts_Rev Else Return $aPts EndIf EndFunc ;==>Points_Reverse Func Points_Rotate($aPts, $iDegrees) Local $hPath = GDI_Line_hPath_From_Points($aPts, 0, 0) ;_GDIPlus_PathFlatten($hPath) Local $hPen = _GDIPlus_PenCreate(0x0, ScaleX(1)) Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath, 0, $hPen) _GDIPlus_PenDispose($hPen) If IsArray($aBounds) Then Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2) _GDIPlus_MatrixRotate($hMatrix, $iDegrees) _GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2), -($aBounds[1] + $aBounds[3] / 2)) _GDIPlus_PathTransform($hPath, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndIf Local $aPoints = _GDIPlus_PathGetPoints($hPath) _GDIPlus_PathDispose($hPath) If IsArray($aPoints) Then ;ConsoleWrite("Rotate_Points" & @CRLF) Dim $aPts_Rev[$aPoints[0][0]][2] For $i = 1 To $aPoints[0][0] $aPts_Rev[$i - 1][0] = Int($aPoints[$i][0] / ScaleX(1)) $aPts_Rev[$i - 1][1] = Int($aPoints[$i][1] / ScaleY(1)) Next Return $aPts_Rev Else Return $aPts EndIf EndFunc ;==>Points_Rotate Func Points_Scale($iScaleX, $iScaleY) For $i = 0 To UBound($g_aPath_Points) - 1 If $iScaleX > 0 Then $g_aPath_Points[$i][0] *= 2 Else $g_aPath_Points[$i][0] /= 2 EndIf If $iScaleY > 0 Then $g_aPath_Points[$i][1] *= 2 Else $g_aPath_Points[$i][1] /= 2 EndIf Next State_Save($g_aPath_Points) List_Update(List_Index()) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage) EndFunc ;==>Points_Scale Func Points_Update($aPts, $g_bClosePath = False, $b_Show_Image = True, $iSelected = -1) Local $_Image_File = $g_sImagefile If Not $b_Show_Image Then $_Image_File = "" GDI_Draw_ArrayPoints($aPts, $g_hImage1, $g_bClosePath, 0, 0, $_Image_File, $iSelected) EndFunc ;==>Points_Update Func ScaleX($iX) Local $iXs = $g_iXScale If $iXs == 0 Then $iXs = -1 If $iXs > 0 Then $iX = $iX * $iXs Else $iX = $iX / Abs($iXs) EndIf Return $iX EndFunc ;==>ScaleX Func ScaleY($iY) Local $iYs = $g_iYScale If $iYs == 0 Then $iYs = -1 If $iYs > 0 Then $iY = $iY * $iYs Else $iY = $iY / Abs($iYs) EndIf Return $iY EndFunc ;==>ScaleY Func SelSquare_Drag() Local $iIndex = List_Index() If $iIndex <> -1 Then Local $cInfo = GUIGetCursorInfo($g_hForm1) Local $aPosSelOrig = ControlGetPos($g_hForm1, "", $g_hSelSquare) If IsArray($aPosSelOrig) Then Local $iSubtractX = $cInfo[0] - $aPosSelOrig[0] Local $iSubtractY = $cInfo[1] - $aPosSelOrig[1] EndIf If IsArray($cInfo) Then Do $cInfo = GUIGetCursorInfo($g_hForm1) ControlMove($g_hForm1, "", $g_hSelSquare, $cInfo[0] - $iSubtractX, $cInfo[1] - $iSubtractY) Until Not $cInfo[2] EndIf Local $aPosSelNew = ControlGetPos($g_hForm1, "", $g_hSelSquare) If IsArray($aPosSelNew) And IsArray($aPosSelOrig) Then Local $iXm = $g_aPath_Points[$iIndex][0] + Int(($aPosSelNew[0] - $aPosSelOrig[0]) / ScaleX(1)) Local $iYm = $g_aPath_Points[$iIndex][1] + Int(($aPosSelNew[1] - $aPosSelOrig[1]) / ScaleY(1)) Point_Modify($iIndex, $iXm, $iYm) Points_Update($g_aPath_Points, $g_bClosePath, $g_bShowImage, $iIndex) EndIf EndIf EndFunc ;==>SelSquare_Drag Func SplitDir($FullPath) Local $sDrive, $sDir, $sDummy _PathSplit($FullPath, $sDrive, $sDir, $sDummy, $sDummy) Return $sDrive & $sDir EndFunc ;==>SplitDir Func SplitFileName($FullPath) Local $sDummy, $sFileName, $sExt _PathSplit($FullPath, $sDummy, $sDummy, $sFileName, $sExt) Return $sFileName & "" & $sExt EndFunc ;==>SplitFileName Func State_Cleanup(ByRef $a1) If (UBound($a1) > $g_iUndo_Max + 2) Then Local $a1Rem = _ArrayExtract($a1, 1, Default) $a1Rem[0] = $a1[0] Local $sTmp = $a1[1] If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite("Cleanup Delete (UnD) " & $sTmp & @CRLF) EndIf $a1 = $a1Rem EndIf EndFunc ;==>State_Cleanup Func State_Destroy($bRedo_Only = False) Local $sTmp While (UBound($g_asRedo_Files) > 1) $sTmp = _ArrayPop($g_asRedo_Files) If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite(", Delete (ReD) " & $sTmp) If @error Then ConsoleWriteError("Failed to Delete " & $sTmp) EndIf WEnd GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) If $bRedo_Only Then Return While (UBound($g_asUndo_Files) > 1) $sTmp = _ArrayPop($g_asUndo_Files) If $sTmp <> "" And FileExists($sTmp) Then FileDelete($sTmp) ;ConsoleWrite(", Delete (UnD)" & $sTmp) If @error Then ConsoleWriteError("Failed to Delete " & $sTmp) EndIf WEnd GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) EndFunc ;==>State_Destroy Func State_Is_Diff(ByRef $a1, ByRef $a2) Local $bIsDiff = True If UBound($a1) = UBound($a2) Then $bIsDiff = False For $i = UBound($a1) - 1 To 0 Step -1 If $a1[$i][0] == $a2[$i][0] And $a1[$i][1] == $a2[$i][1] Then ContinueLoop Else ;ConsoleWrite("Diff " & $i & @CRLF) $bIsDiff = True ExitLoop EndIf Next Else ;ConsoleWrite("Diff " & @CRLF) EndIf Return $bIsDiff EndFunc ;==>State_Is_Diff Func State_Restore(ByRef $aPts, $bUndo) Local $sTmp = "" Local $aRes If $bUndo Then $sTmp = _ArrayPop($g_asUndo_Files) ;ConsoleWrite(", Restore (UnD)" & $sTmp) If $sTmp <> "" And FileExists($sTmp) Then _ArrayAdd($g_asRedo_Files, $sTmp) _FileReadToArray($sTmp, $aRes, 0, ",") If UBound($g_asUndo_Files) < 2 Then GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) If UBound($g_asRedo_Files) > 2 Then GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_ENABLE) If UBound($g_asUndo_Files) > 1 And Not State_Is_Diff($aPts, $aRes) Then Return State_Restore($aPts, $bUndo) If Not @error Then Return $aRes Else ConsoleWriteError("Failed to Restore " & $sTmp) EndIf Else $sTmp = _ArrayPop($g_asRedo_Files) ;ConsoleWrite(", Restore (ReD) " & $sTmp) If $sTmp <> "" And FileExists($sTmp) Then _ArrayAdd($g_asUndo_Files, $sTmp) _FileReadToArray($sTmp, $aRes, 0, ",") If UBound($g_asRedo_Files) < 2 Then GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) If UBound($g_asUndo_Files) > 2 Then GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_ENABLE) If UBound($g_asRedo_Files) > 1 And Not State_Is_Diff($aPts, $aRes) Then Return State_Restore($aPts, $bUndo) If Not @error Then Return $aRes Else ConsoleWriteError("Failed to Restore " & $sTmp) EndIf EndIf Return $aPts EndFunc ;==>State_Restore Func State_Save($aPts) If $g_iUndo_Max < 1 Then Return Local $sTmp = _TempFile(@TempDir, "DPP_") If UBound($g_asRedo_Files) > 2 Then _ArrayAdd($g_asUndo_Files, _ArrayPop($g_asRedo_Files)) _ArrayAdd($g_asUndo_Files, $sTmp) _FileWriteFromArray($sTmp, $aPts, 0, Default, ",") If UBound($g_asRedo_Files) > 2 Then State_Destroy(True) State_Cleanup($g_asUndo_Files) ;ConsoleWrite("Save State " & UBound($g_asUndo_Files) & " " & $sTmp & @CRLF) If UBound($g_asUndo_Files) > 2 Then GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_ENABLE) If @error Then MsgBox(0, @ScriptName & " Error", "Unable to create undo file " & $sTmp) GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) $g_iUndo_Max = 0 EndIf EndFunc ;==>State_Save Func Tab1_Select() Local $iStateCtl1, $iStateCtl2 Local $tabindex = GUICtrlRead($g_hTab1) ;ConsoleWrite("tab" & $tabindex + 1 & "_selected" & @CRLF) Select Case $tabindex = 0 $iStateCtl1 = $GUI_SHOW $iStateCtl2 = $GUI_HIDE Case $tabindex = 1 $iStateCtl1 = $GUI_HIDE $iStateCtl2 = $GUI_SHOW Case Else _GUICtrlTab_ActivateTab($g_hTab1, 0) Return EndSelect For $i = 0 To UBound($g_ahCtl1) - 1 GUICtrlSetState($g_ahCtl1[$i], $iStateCtl1) Next For $i = 0 To UBound($g_ahCtl2) - 1 GUICtrlSetState($g_ahCtl2[$i], $iStateCtl2) Next EndFunc ;==>Tab1_Select Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Static Local $hWndList1 = GUICtrlGetHandle($g_hList1) If Not IsHWnd($hWndList1) Then $hWndList1 = GUICtrlGetHandle($g_hList1) If @error Then Return $GUI_RUNDEFMSG If $wParam = $g_hList1 Then Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Switch DllStructGetData($tNMHDR, "Code") Case $LVN_KEYDOWN, $NM_CLICK GUICtrlSendToDummy($g_hList1_LVN, $lParam) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY DrawPathPoints.au3
-
- gdi polygon
- path
-
(and 2 more)
Tagged with:
-
i want to copy a picture file to clipboard, so that i can paste the picture through ctrl+V this is my code ,but it dosen't work : #AutoIt3Wrapper_UseX64 = n #Include <Clipboard.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $hClipboard_Bitmap = _GDIPlus_BitmapCreateFromFile('C:\1.jpg') _ClipBoard_Open(0) _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() _GDIPlus_Shutdown() can you help me
-
Hello I have problem with my object drawn in gdi Func drawTriangle($tabName,$gui_active = 0) _GDIPlus_Startup() ;initialize GDI+ Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($sGUI[$gui_active]) ;create a graphics object from a window handle _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFEFEFEF) ;color format AARRGGBB (hex) Local $aPoints[5][3] $aPoints[0][0] = 4 $aPoints[1][0] = 0.0 ; left $aPoints[1][1] = 0.0 ; top $aPoints[2][0] = 0.0 ; left $aPoints[2][1] = 30.0 ; top $aPoints[3][0] = 80.0 ; left $aPoints[3][1] = 30.0 ; top $aPoints[4][0] = 110.0 ; left $aPoints[4][1] = 0.0 ; top _GDIPlus_GraphicsFillPolygon($hGraphics, $aPoints, $hBrush) ;draw the triangle Local $fBrush = _GDIPlus_BrushCreateSolid(0xFFAAAAAA) ;color format AARRGGBB (hex) Local $sString = $tabName, $aInfo ; from the func param Local $hFormat, $hFamily, $hFont, $tLayout $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI") $hFont = _GDIPlus_FontCreate($hFamily, 12, 2) $tLayout = _GDIPlus_RectFCreate(6, 2) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $fBrush) ;_GDIPlus_GraphicsDrawString($hGraphics, $tabName, 6, 3, "Segoe UI", 12) ; write text ;cleanup GDI+ resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc After this code execution I got new object rectangle Global $ma_border = GUICtrlCreateGraphic(100, 180, 40, 40) GUICtrlSetGraphic($ma_border, $GUI_GR_COLOR, 0x00000, $COLOR_BLUE) GUICtrlSetGraphic($ma_border, $GUI_GR_RECT, 0, 0, 40, 40) GUICtrlSetState(-1,$GUI_DISABLE) And what happens is first func = draw rectangle is pushed to parameters from GUICtrlCreateGraphic func. Left: 100, Top: 180. I can simplu reverse order of these func execution but There is too much things to change in my code. Can something be done to prevent this slipping?
-
- gdi
- guictrlcreategraphic
-
(and 1 more)
Tagged with:
-
I saw this code here: http://zoomquilt.org/ and here: http://arkadia.xyz and thought how this can be implemented in AutoIt. Here the results. The Zoomquilt: ;coded by UEZ build 2018-01-10, idea and images taken from http://zoomquilt.org/ ;thanks to spudw2k for the MouseZoom function #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $iW, $iH Global Const $sTitle = "GDI Image Zoom v2.1.2 coded by UEZ" AutoItSetOption("GUIOnEventMode", 1) Downloader() GDIPlus_ZoomImage() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_ZoomImage($bMultimonitor = False) $bExit = False Local $i, $aImages[46], $hImage, $hObj ConsoleWrite("Loading images from local disk..." & @CRLF) Local $fTimer = TimerInit() For $i = 0 To UBound($aImages) - 1 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i)) $aImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) Next ConsoleWrite(UBound($aImages) & " images loaded in " & TimerDiff($fTimer) & " ms" & @CRLF) Local $tDim = DllStructCreate($tagBITMAP) DllCall("GDI32.dll", 'int', 'GetObject', 'int', $aImages[0], 'int', DllStructGetSize($tDim), 'ptr', DllStructGetPtr($tDim)) $iW = $tDim.bmWidth $iH = $tDim.bmHeight Local $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]"), $aFullScreen[4], $iW_Dt, $iH_Dt $aFullScreen = WinGetPos($hFullScreen) If $bMultimonitor Then $iW_Dt = $aFullScreen[2] $iH_Dt = $aFullScreen[3] Else $iW_Dt = @DesktopWidth $iH_Dt = @DesktopHeight $aFullScreen[0] = "" $aFullScreen[1] = "" EndIf $hGUI = GUICreate($sTitle, $iW_Dt, $iH_Dt, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW_Dt, $iH_Dt) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SetStretchBltMode($hDC_backbuffer, $STRETCH_DELETESCANS) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 130, 16) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $a[3], $b = 1, $c, $x, $e, $y, $w, $h, $w2 = $iW_Dt / 2, $h2 = $iH_Dt / 2, $q, $r If $iW_Dt > 1.5 * $iH_Dt Then $q = $iW_Dt $r = 0.75 * $iW_Dt Else $q = 1.5 * $iH_Dt $r = 0.75 * $iH_Dt EndIf Do For $e = 0 To 2 $a[$e] = $aImages[Mod(Floor($b) + $e, UBound($aImages))] Next $c = 2^(Mod($b, 1)) For $e = 0 To 2 $x = $w2 - $q / 2 * $c $y = $h2 - $r / 2 * $c $w = $q * $c $h = $r * $c $hObj = _WinAPI_SelectObject($hMemDC, $a[$e]) _WinAPI_StretchBlt($hDC_backbuffer, $x, $y, $w, $h, $hMemDC, 0, 0, $iW, $iH, $SRCCOPY) $c *= 0.5 Next $b += MouseZoom() IF $b < 0 Then $b = UBound($aImages) - $b _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & " @ " & $iW_Dt & "x" & $iH_Dt & " px", $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) _WinAPI_BitBlt($hDC, 0, 0, $iW_Dt, $iH_Dt, $hDC_backbuffer, 0, 0, $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(0) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hMemDC, $hObj) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) For $i = 0 To UBound($aImages) - 1 _WinAPI_DeleteObject($aImages[$i]) Next GUIDelete($hGUI) EndFunc ;==>GDIPlus_ZoomImage Func MouseZoom() ;https://www.arduino.cc/reference/en/language/functions/math/map/ Local $iInput = MouseGetPos(1), $iInMin = 0, $iInMax = @DesktopHeight, $iOutMin = 1, $iOutMax = -1, $iStep = 0.025 Return (($iInput - $iInMin) * ($iOutMax - $iOutMin) / ($iInMax - $iInMin) + $iOutMin) * $iStep EndFunc ;MouseZoom() Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func Downloader() Local $i, $A = StringSplit("FUjD9hf gbHhxTR 8YyzJdR xP3aNkR 2Qi4fQr E6pW5Ky zmtWIBF Af7LtYp TuXy30d 3nKGLr2 hNoWscB mSBvv3K f4wJ70e mIt9XmM M4TkAyh P4L4qhd hNM6bTv VoT8JXM jqcGH0B DYVoN8n bOPQkOI NeaTfJ1 18ppMNr FZ3d8Jv HsoX2RP mjv4kzI 6rpJbef pySKauq WjNQYRV Ffooo8y Xei5XfD T5A415r LiV0VNB nGcwiO4 b1Gdjjy GE828iy eSQ7SLe 1mPyGgL GNtwJIr KxBlU7E aKXhms5 9Quu2wu Y07quDf r0yC5Qa 273fCkD 2wMyCUw FUjD9hf", " ", 2) Local $sURL For $i = 0 To UBound($A) - 1 If Not FileExists(@ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i)) Then If Not FileExists(@ScriptDir & "\Images") Then DirCreate(@ScriptDir & "\Images") $sURL = "http://imgur.com/" & $A[Mod(20 + $i, 46)] & ".jpg" ConsoleWrite("Downloading " & $sURL & ": " & InetGet($sURL, @ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i), 8) & " bytes" & @CRLF) ToolTip("Downloading images...Please wait! -> " & $i + 1 & " / " & UBound($A), MouseGetPos(0), MouseGetPos(1)) EndIf Next ToolTip("") EndFunc ;==>Downloader Arkadia: ;coded by UEZ build 2018-01-10, idea and images taken from http://arkadia.xyz ;thanks to spudw2k for the MouseZoom function #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $iW, $iH Global Const $sTitle = "GDI Image Zoom v2.2.1 coded by UEZ" AutoItSetOption("GUIOnEventMode", 1) Downloader() GDIPlus_ZoomImage() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_ZoomImage($bMultimonitor = False) $bExit = False Local $i, $aImages[49], $hImage, $hObj ConsoleWrite("Loading images from local disk..." & @CRLF) Local $fTimer = TimerInit() For $i = 0 To UBound($aImages) - 1 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Arkadia" & $i & ".jpg") $aImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) Next ConsoleWrite(UBound($aImages) & " images loaded in " & TimerDiff($fTimer) & " ms" & @CRLF) Local $tDim = DllStructCreate($tagBITMAP) DllCall("GDI32.dll", "int", "GetObject", "int", $aImages[0], "int", DllStructGetSize($tDim), "ptr", DllStructGetPtr($tDim)) $iW = $tDim.bmWidth $iH = $tDim.bmHeight Local $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]"), $aFullScreen[4], $iW_Dt, $iH_Dt $aFullScreen = WinGetPos($hFullScreen) If $bMultimonitor Then $iW_Dt = $aFullScreen[2] $iH_Dt = $aFullScreen[3] Else $iW_Dt = @DesktopWidth $iH_Dt = @DesktopHeight $aFullScreen[0] = "" $aFullScreen[1] = "" EndIf $hGUI = GUICreate($sTitle, $iW_Dt, $iH_Dt, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW_Dt, $iH_Dt) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SetStretchBltMode($hDC_backbuffer, $STRETCH_DELETESCANS) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 130, 16) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $a[3], $b = 1, $c, $x, $e, $y, $w, $h, $w2 = $iW_Dt / 2, $h2 = $iH_Dt / 2, $q, $r If $iW_Dt > 1.5 * $iH_Dt Then $q = $iW_Dt $r = 0.75 * $iW_Dt Else $q = 1.5 * $iH_Dt $r = 0.75 * $iH_Dt EndIf Do For $e = 0 To 2 $a[$e] = $aImages[Mod(Floor($b) + $e, UBound($aImages))] Next $c = 2^(Mod($b, 1)) For $e = 0 To 2 $x = $w2 - $q / 2 * $c $y = $h2 - $r / 2 * $c $w = $q * $c $h = $r * $c $hObj = _WinAPI_SelectObject($hMemDC, $a[$e]) _WinAPI_StretchBlt($hDC_backbuffer, $x, $y, $w, $h, $hMemDC, 0, 0, $iW, $iH, $SRCCOPY) $c *= 0.5 Next $b += MouseZoom() IF $b < 0 Then $b = UBound($aImages) - $b _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & " @ " & $iW_Dt & "x" & $iH_Dt & " px", $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) _WinAPI_BitBlt($hDC, 0, 0, $iW_Dt, $iH_Dt, $hDC_backbuffer, 0, 0, $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(0) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hMemDC, $hObj) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) For $i = 0 To UBound($aImages) - 1 _WinAPI_DeleteObject($aImages[$i]) Next GUIDelete($hGUI) EndFunc ;==>GDIPlus_ZoomImage Func MouseZoom() ;https://www.arduino.cc/reference/en/language/functions/math/map/ Local $iInput = MouseGetPos(1), $iInMin = 0, $iInMax = @DesktopHeight, $iOutMin = 1, $iOutMax = -1, $iStep = 0.025 Return (($iInput - $iInMin) * ($iOutMax - $iOutMin) / ($iInMax - $iInMin) + $iOutMin) * $iStep EndFunc ;MouseZoom() Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func Downloader() Local $sURL, $i For $i = 0 To 48 If Not FileExists(@ScriptDir & "\Images\Arkadia" & $i & ".jpg") Then If Not FileExists(@ScriptDir & "\Images") Then DirCreate(@ScriptDir & "\Images") $sURL = "http://arkadia.xyz/images/arkadia" & $i & ".jpg" ConsoleWrite("Downloading " & $sURL & ": " & InetGet($sURL, @ScriptDir & "\Images\Arkadia" & $i & ".jpg", 8) & " bytes" & @CRLF) ToolTip("Downloading images...Please wait! -> " & $i + 1 & " / " & $i, MouseGetPos(0), MouseGetPos(1)) EndIf Next ToolTip("") EndFunc ;==>Downloader The missing images will be download and saved to script dir in folder images. Due to internal integer format of the GDI functions the screen is little bit wobbling. Happy watching.
-
As requested by @Lakes here: GDI and GDI+ versions of 3D Sinus Wave. GDI ≠ GDI+! GDI: ;coded by UEZ build 2017-01-18 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GuiConstantsEx.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> Global $__f1, $__f2, $__f3, $__fY0, $__fZ0, $__fX1, $__fY1 Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $fZoom = 5.0 Global Const $iW = @DesktopWidth * 0.75, $iH = @DesktopHeight * 0.75, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ 3D Sinus Wave v1.1 coded by UEZ / FPS: " Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $fPi2 = ACos(-1) * 2 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_3DSinusWave() AutoItSetOption("GUIOnEventMode", 0) Func GDIPlus_3DSinusWave() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) Local Const $hPen = _WinAPI_GetStockObject($DC_PEN) Local Const $hPen_Old = _WinAPI_SelectObject($hGfxDC, $hPen) _WinAPI_SetStretchBltMode($hDC, $HALFTONE) $iFPS = 0 Local Const $fEuler = 2.7182818284 Local $fSpace = 6, $iPoints = 16, $fSpace2 = $fSpace / 2, $iPoints2 = $iPoints / 2 Local $fRotX = Random(-360, 360), $fRotY = Random(-360, 360), $fRotZ = Random(-360, 360), $fPower = 20.0 Local $fRx = Random(-1.5, 1,5), $fRy = Random(-1.5, 1,5), $fRz = Random(-1.5, 1,5) Local $c = 0, $t = 0, $aCoords[$iPoints ^ 2][3] Local $i, $j, $x, $y, $z, $x1, $y1, $z1, $x2, $y2, $z2, $x3, $y3, $z3, $fDistance, $r, $g, $b Local $hDLL_gdi32 = DllOpen("gdi32.dll") Local $tLOGBRUSH = DllStructCreate($tagLOGBRUSH) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") AdlibRegister("CalcFPS", 1000) Do _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $WHITENESS) ;erase canvas background $c = 0 For $i = 0 To $iPoints - 1 For $j = 0 To $iPoints - 1 $aCoords[$c][0] = $fSpace * $i + $fSpace2 - $fSpace * $iPoints2 $aCoords[$c][1] = $fSpace * $j + $fSpace2 - $fSpace * $iPoints2 $fDistance = Dist(0, 0, $aCoords[$c][0], $aCoords[$c][1]) $aCoords[$c][2] = $fEuler ^ (-$fDistance / 50) * Sin(($fDistance / 10) - $t) * $fPower $c += 1 $t += 0.00075 Next Next For $i = 0 To $iPoints - 2 For $j = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next Next For $i = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next For $j = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next $fRotX += $fRx $fRotY += $fRy $fRotZ += $fRz _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) GUIRegisterMsg($WM_MOUSEWHEEL, "") AdlibUnRegister("CalcFPS") ;release resources _WinAPI_SelectObject($hGfxDC, $hPen_Old) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) GUIDelete($hGUI) DllClose($hDLL_gdi32) EndFunc ;==>GDIPlus_3DSinusWave Func WM_MOUSEWHEEL($hGUI, $iMsg, $wParam, $lParam) Local $wheel_Dir = _WinAPI_HiWord($wParam) If $wheel_Dir > 0 Then $fZoom += 0.25 $fZoom = $fZoom > 20 ? 20 : $fZoom Else $fZoom -= 0.25 $fZoom = $fZoom < 0.25 ? 0.25 : $fZoom EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>WM_MOUSEWHEEL Func Dist($x1, $y1, $x2, $y2) Return Sqrt(($x1 - $x2) * ($x1 - $x2) + ($y1 - $y2) * ($y1 - $y2)) EndFunc ;==>Dist Func _3Dto2D($fX, $fY, $fZ, $fRotX, $fRotY, $fRotZ, ByRef $__fXPos, ByRef $__fYPos, ByRef $__fZPos) ;apply the x-axis rotation to transform coordinates ($fX, $fY, $fZ) into coordinates ($fX0, $fY0, $fZ0) $__f1 = $fRotX * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fY0 = $fY * $__f2 + $fZ * $__f3 $__fZ0 = $fZ * $__f2 - $fY * $__f3 ;apply the y-axis rotation to ($fX0, $__fY0, $fZ0) to obtain ($__fX1, $__fY1, $fZ1) $__f1 = $fRotY * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fX1 = $fX * $__f2 - $__fZ0 * $__f3 $__fY1 = $__fY0 ;~ $__fZ1 = $__fZ0 * $__f2 + $fX * $__f2 ;finally, apply the z-axis rotation to obtain the point ($fXPos, $fYPos) $__f1 = $fRotZ * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fXPos = $__fX1 * $__f2 + $__fY1 * $__f3 $__fYPos = $__fY1 * $__f2 - $__fX1 * $__f3 $__fZPos = $__fZ0 EndFunc ;==>_3Dto2D Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 WinSetTitle($hGUI, "", $sTitle & $iShowFPS) EndFunc ;==>CalcFPS GDI+ ;coded by UEZ build 2017-01-17 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $__f1, $__f2, $__f3, $__fY0, $__fZ0, $__fX1, $__fY1 Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = @DesktopWidth * 0.75, $iH = @DesktopHeight * 0.75, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ 3D Sinus Wave v1.0 coded by UEZ" Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $fPi2 = ACos(-1) * 2 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_3DSinusWave() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_3DSinusWave() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16), _ $hPath = _GDIPlus_PathCreate(), _ $hPen = _GDIPlus_PenCreate(0xCF101010, 1.25) _GDIPlus_PenSetLineJoin($hPen, 2) ;~ _GDIPlus_PenSetDashCap($hPen, $GDIP_DASHCAPROUND) ;~ _GDIPlus_PenSetLineCap($hPen, 0x12, 0x12, 2) $iFPS = 0 Local $fEuler = 2.7182818284 Local $fSpace = 6, $iPoints = 16, $fSpace2 = $fSpace / 2, $iPoints2 = $iPoints / 2 Local $fRotX = Random(-360, 360), $fRotY = Random(-360, 360), $fRotZ = Random(-360, 360), $fZoom = 5.0, $fPower = 20.0 Local $fRx = Random(-1.5, 1,5), $fRy = Random(-1.5, 1,5), $fRz = Random(-1.5, 1,5) Local $c = 0, $t = 0, $aCoords[$iPoints ^ 2][3] Local $i, $j, $x, $y, $z, $x1, $y1, $z1, $x2, $y2, $z2, $x3, $y3, $z3, $fDistance, $r, $g, $b GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Do ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _ ;~ "float", $iW, "float", $iH) ;erase canvas background _WinAPI_BitBlt($hDC_backbuffer, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $WHITENESS) $c = 0 For $i = 0 To $iPoints - 1 For $j = 0 To $iPoints - 1 $aCoords[$c][0] = ($fSpace * $i + $fSpace2 - $fSpace * $iPoints2) $aCoords[$c][1] = ($fSpace * $j + $fSpace2 - $fSpace * $iPoints2) $fDistance = Dist(0, 0, $aCoords[$c][0], $aCoords[$c][1]) $aCoords[$c][2] = $fEuler ^ (-$fDistance / 50) * Sin(($fDistance / 10) - $t) * $fPower $c += 1 $t += 0.00075 Next Next For $i = 0 To $iPoints - 2 For $j = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next Next For $i = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next For $j = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next $fRotX += $fRx $fRotY += $fRy $fRotZ += $fRz _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_PenDispose($hPen) _GDIPlus_PathDispose($hPath) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_3DSinusWave Func Dist($x1, $y1, $x2, $y2) Return Sqrt(($x1 - $x2) * ($x1 - $x2) + ($y1 - $y2) * ($y1 - $y2)) EndFunc ;==>Dist Func _3Dto2D($fX, $fY, $fZ, $fRotX, $fRotY, $fRotZ, ByRef $__fXPos, ByRef $__fYPos, ByRef $__fZPos) ;apply the x-axis rotation to transform coordinates ($fX, $fY, $fZ) into coordinates ($fX0, $fY0, $fZ0) $__f1 = $fRotX * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fY0 = $fY * $__f2 + $fZ * $__f3 $__fZ0 = $fZ * $__f2 - $fY * $__f3 ;apply the y-axis rotation to ($fX0, $__fY0, $fZ0) to obtain ($__fX1, $__fY1, $fZ1) $__f1 = $fRotY * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fX1 = $fX * $__f2 - $__fZ0 * $__f3 $__fY1 = $__fY0 ;~ $__fZ1 = $__fZ0 * $__f2 + $fX * $__f2 ;finally, apply the z-axis rotation to obtain the point ($fXPos, $fYPos) $__f1 = $fRotZ * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fXPos = $__fX1 * $__f2 + $__fY1 * $__f3 $__fYPos = $__fY1 * $__f2 - $__fX1 * $__f3 $__fZPos = $__fZ0 EndFunc ;==>_3Dto2D Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS In the attached 7-Zip file you can find the compiled and also a FreeBasic version. -> DL: 3D Sinus Wave.7z Have fun.
-
This script generates Barnsleys Fractal Fern using script only. ; version 2017-10-03 ; Barnsley Fractal Fern ; by larnil #include <GUIConstants.au3> Dim $x, $y, $xn, $yn, $n, $r, $dc $WinSize = 800 ; window size ;Create graphics windows AutoItSetOption("GUIOnEventMode", 1) $GUI = GUICreate("Barnsley Fractal Fern", $WinSize, $WinSize, -1, -1) $Graphic = GuiCtrlCreateGraphic(0, 0, $WinSize, $WinSize) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE,"Bye") ;Main $start = TimerInit() _Fern(800) ; hight of fern - can be larger than window MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") While 1 Sleep(100) WEnd Func Bye() Exit EndFunc Func _Fern($height) $f = $height/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $height/2 - $height/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $height*200 ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn GUICtrlSetGraphic($Graphic, $GUI_GR_PIXEL, $offset_x + $x * $f, $height - $y * $f) Next GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) EndFunc ;==> Fern Here is another example where I have used GDI (my very first attempt at using GDI by the way). This script can generate much larger Ferns and save them to file (png). I have used this script to generate a 20000 x 20000 pixel @ 600 dpi image. Looks really good printed out in full size. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ; Param Local Const $iPxColor = 0xFF00FF00 ; Pixel color for fractal Alpha/R/G/B Local Const $iBgColor = 0xFFFFFFFF ; Background color for image Alpha/R/G/B Local Const $iSize = 1000 ; Hight of fern in pixels - image will have this hight and width too Local Const $iIter = $iSize*400 ; Number of iterations - $iSize * 200 is a good starting point ; Call function ;$start = TimerInit() _Fern($iSize,$iIter) ;MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") ; Function for generating Barnsley Fractal Fern Func _Fern($Size,$Iter) _GDIPlus_Startup() ; initialize GDI+ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($Size, $Size) ; create an empty bitmap Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; get the graphics context of the image _GDIPlus_GraphicsClear($hBmpCtxt, $iBgColor) ; Set the background color for empty bitmap ; Here the magic happens $x=0 ; init $y=0 ; init $f = $Size/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $Size/2 - $Size/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $Iter ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn _GDIPlus_BitmapSetPixel($hBitmap, $offset_x + $x * $f, $Size - $y * $f, $iPxColor) ; Change pixel color for calculated X,Y Next ; ==> End of magic $File = "\Fractal_Fern_"&StringRight(Hex($iPxColor),6)&"-"&StringRight(Hex($iBgColor),6)&"-"&$iSize&".png" _GDIPlus_ImageSaveToFile($hBitmap, @MyDocumentsDir & $File) ;save bitmap to disk ShellExecute(@MyDocumentsDir & $File); Show it to the world in your default image viewer ; Cleanup GDI+ resources _GDIPlus_GraphicsDispose($hBmpCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==> _Fern
-
how can I fit the image when the GUI is maximized? I would like to always measure the 50% height and width of the GUI and is always in the bottom right poistion, and does not lose its quality. THX #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124,BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\img.jpg") $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) $resimg = _GDIPlus_ImageResize($hImage,200,300) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") ;GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState(@SW_SHOW,$Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_PAINT($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 300, 0) _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT ;Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) ; #forceref $hWnd, $iMsg, $iwParam, $ilParam ; Local $xClient, $yClient ; $xClient = BitAND($ilParam, 0x0000FFFF) ; $yClient = BitShift($ilParam, 16) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) ; _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, $xClient/2, $yClient/2) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) ; ConsoleWrite($xClient & " "&$yClient&@CR) ; Return $GUI_RUNDEFMSG ;EndFunc
-
plz help explain between GDI+ and Winapi, is it desktop inside another desktop, 3 layer dimension? i can't get the picture 1. u get desktop u can visual see 2. then u create GDI+ startup another desktop screen dimension? 3. then u have Winapi command inside GDI+, is this another desktop screen dimension? cuz GDI+ could create bitmap that is one dimension? Winapi get windowDC also another dimension? plz help and explain, with picture would be nice, im not good with visualize ("dumb newbie"), still learning newbie to programming world thankyou.
-
I'm attempting to cobble together a replacement for the 64bit version of BGInfo that will run within WinPE 10/64. I've located a couple useful threads: Between the two, they get me close (see code below), but for some reason GDI+ is not working the same within WinPE as it does in Windows 10. Bottomline is that the "Text" never get's written to WallPaper. Here is what I have thus far. Any thoughts if any of the GDI commands might not work within WinPE? Any other way to achieve the same result (system information on the wallpaper in WinPE 10)? #include <GDIPlus.au3> #include <Date.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\WallPaper.bmp") $imagegraphics = _GDIPlus_ImageGetGraphicsContext($image) $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $whitebrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $fontfamily = _GDIPlus_FontFamilyCreate("Arial") $font = _GDIPlus_FontCreate($fontfamily, 16) $stringformat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($stringformat, 2) $rect = _GDIPlus_RectFCreate(0, $h - $h + 100, $w - 25, $h) ;$rect = _GDIPlus_RectFCreate(100, 100, 200, 200) _GDIPlus_GraphicsDrawStringEx($imagegraphics, _Now() & @CRLF & @UserName & @CRLF & @ComputerName & @CRLF & @IPAddress1, $font, $rect, $stringformat, $whitebrush) _GDIPlus_ImageSaveToFile($image, @ScriptDir & "\NewWallPaper.bmp") _GDIPlus_ImageDispose($image) _GDIPlus_GraphicsDispose($imagegraphics) _GDIPlus_BrushDispose($whitebrush) _GDIPlus_FontFamilyDispose($fontfamily) _GDIPlus_FontDispose($font) _GDIPlus_StringFormatDispose($stringformat) _GDIPlus_Shutdown() _ChangeDesktopWallpaper(@ScriptDir & "\NewWallPaper.bmp", 2) Func _ChangeDesktopWallpaper($bmp, $style = 0) ;=============================================================================== ; ; Function Name: _ChangeDesktopWallPaper ; Description: Update WallPaper Settings ; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1) ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp) ; [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched ; Requirement(s): None. ; Return Value(s): On Success - Returns 0 ; On Failure - -1 ; Author(s): FlyingBoz ; Thanks: Larry - DllCall Example - Tested and Working under XPHome and W2K Pro ; Excalibur - Reawakening my interest in Getting This done. ; ;=============================================================================== If Not FileExists($bmp) Then Return -1 ;The $SPI* values could be defined elsewhere via #include - if you conflict, ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP = "HKEY_CURRENT_USER\Control Panel\Desktop" If $style = 1 Then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDesktopWallpaper Thanks for your time, -Mike
-
Here a small function to mark a region on the desktop and capture that region to a bitmap handle or to the clipboard: #include-once #include <Clipboard.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> #Region Example ;capture manual coordinates FileDelete(@ScriptDir & "\Captured.bmp") Global $hHBitmap = _WinAPI_MarkScreenRegionAndCapture(0, False, True, 0, 0, 99, 99) _WinAPI_SaveHBITMAPToFile(@ScriptDir & "\Captured.bmp", $hHBitmap) _WinAPI_DeleteObject($hHBitmap) If FileExists(@ScriptDir & "\Captured.bmp") Then ShellExecute(@ScriptDir & "\Captured.bmp") ;save the captured bitmap to a file FileDelete(@ScriptDir & "\Captured.bmp") Global $hHBitmap = _WinAPI_MarkScreenRegionAndCapture() _WinAPI_SaveHBITMAPToFile(@ScriptDir & "\Captured.bmp", $hHBitmap) _WinAPI_DeleteObject($hHBitmap) If FileExists(@ScriptDir & "\Captured.bmp") Then ShellExecute(@ScriptDir & "\Captured.bmp") ;copy captured bitmap to clipboard Switch _WinAPI_MarkScreenRegionAndCapture(1, True) Case 1 MsgBox($MB_ICONINFORMATION, "Information", "Marked region was properly captured to clipboard!", 30) Case 0 MsgBox($MB_ICONERROR, "ERROR", "An error has occured!", 30) EndSwitch #EndRegion ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinAPI_MarkScreenRegionAndCapture ; Description ...: Selected area on desktop will be captured and save to clipbord or GDI bitmap handle will be returned. ; Syntax ........: _WinAPI_MarkScreenRegionAndCapture([$iFillMode = 0[, $bClipboard = True]]) ; Parameters ....: $iFillMode - [optional] an integer value. Default is 0. ; 0: marked area filled with solid color ; 1: marked area filled with hatch pattern ($HS_DIAGCROSS) ; 2: marked area without any fill pattern / color - only red border ; $bClipboard - [optional] a boolean value. Default is False. If True then no GDI bitmap handle will be returned. ; If false then GDI bitmap handle will be returned. ; $bManual - [optional] a boolean value. Default is False. If True manual capturing is activated. ; $iX1 - [optional] an integer value. Default is 0. If $bManual is true enter the x1 screen pos. ; $iY1 - [optional] an integer value. Default is 0. If $bManual is true enter the Y1 screen pos. ; $iX2 - [optional] an integer value. Default is 0. If $bManual is true enter the x2 screen pos. ; $iY2 - [optional] an integer value. Default is 0. If $bManual is true enter the y2 screen pos. ; Return values .: 0 / 1 / -1 / GDI bitmap handle ; Author ........: UEZ ; Version .......: 0.92 build 2017-01-22 ; Modified ......: ; Remarks .......: Do not forget to dispose returned GDI bitmap handle for non clipboard mode using _WinAPI_DeleteObject! ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _WinAPI_MarkScreenRegionAndCapture($iFillMode = 0, $bClipboard = False, $bManual = False, $iX1 = 0, $iY1 = 0, $iX2 = 0, $iY2 = 0) If @OSBuild > 6299 Then ;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx DllCall("Shcore.dll", "long", "PROCESS_DPI_AWARENESS", 1) ;PROCESS_SYSTEM_DPI_AWARE = 1 (https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx) Else DllCall("User32.dll", "bool", "SetProcessDPIAware") EndIf Local $iOld = AutoItSetOption("MouseCoordMode", 1) If Not $bManual Then Local Const $hDesktop = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hDesktop) ;should work also on multi screens Local Const $iW = $aFullScreen[2], $iH = $aFullScreen[3] Local Const $hGUI_Screencapture = GUICreate("", $iW, $iH, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetState(@SW_SHOW, $hGUI_Screencapture) Local Const $hDC = _WinAPI_GetDC($hGUI_Screencapture) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) Local $tSize = DllStructCreate($tagSIZE) $tSize.x = $iW $tSize.y = $iH Local $tSource = DllStructCreate($tagPOINT) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) $tBlend.Alpha = 0xFF $tBlend.Format = 1 Local $tDest = DllStructCreate($tagPOINT), $pPoint = DllStructGetPtr($tDest) $tDest.x = $aFullScreen[0] $tDest.y = $aFullScreen[1] Local Const $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x0000FF) Local Const $hPen_Orig = _WinAPI_SelectObject($hGfxDC, $hPen) Local $hBrush, $iAlpha2, $iFlag $iFillMode = $iFillMode > 2 ? 2 : $iFillMode < 0 ? 0 : $iFillMode Switch $iFillMode Case 0 $hBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0x808080) $iAlpha2 = 0xA0 $iFlag = $ULW_ALPHA Case 1 $hBrush = _WinAPI_CreateBrushIndirect($BS_HATCHED, 0x808000, $HS_DIAGCROSS) $iAlpha2 = 0x30 $iFlag = $ULW_ALPHA Case 2 $hBrush = _WinAPI_CreateBrushIndirect($BS_HOLLOW, 0x000000) $iAlpha2 = 0xFF ;not needed $iFlag = $ULW_COLORKEY EndSwitch Local $hBrush_Orig = _WinAPI_SelectObject($hGfxDC, $hBrush) Else If Not BitOr($iX1, $iX2, $iY1, $iY2) Then Return SetError(4, 0, 0) EndIf Local $aMPos[5], $aMPos_old[4], $tRECT = _WinAPI_CreateRect(0, 0, 0, 0) Do If $bManual Then $aMPos[2] = 1 Else GUISetCursor(16, 1, $hGUI_Screencapture) $aMPos = GUIGetCursorInfo($hGUI_Screencapture) $aMPos_old[0] = $aMPos[0] $aMPos_old[1] = $aMPos[1] $aMPos_old[2] = MouseGetPos(0) $aMPos_old[3] = MouseGetPos(1) EndIf Switch $aMPos[2] Case 0 ;display crosshair _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) _WinAPI_DrawLine($hGfxDC, $tDest.x, $aMPos[1], $iW, $aMPos[1]) _WinAPI_DrawLine($hGfxDC, $aMPos[0], $tDest.y, $aMPos[0], $iH) _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $ULW_COLORKEY) Case 1 ;capture selected region If Not $bManual Then $tBlend.Alpha = $iAlpha2 While $aMPos[2] ;mark region GUISetCursor(14, 1, $hGUI_Screencapture) ;WinGetHandle(AutoItWinGetTitle())) $aMPos = GUIGetCursorInfo($hGUI_Screencapture) _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $CAPTUREBLT) ;clear bitmap ;draw rectangle $tRECT.Left = $aMPos_old[0] $tRECT.Top = $aMPos_old[1] $tRECT.Right = $aMPos[0] $tRECT.Bottom = $aMPos[1] _WinAPI_Rectangle($hGfxDC, $tRECT) If $iFillMode <> 2 Then _WinAPI_InvertRect($hGfxDC, $tRECT) _WinAPI_UpdateLayeredWindow($hGUI_Screencapture, $hDC, $tDest, $tSize, $hGfxDC, $tSource, 0, $tBlend, $iFlag) Sleep(10) WEnd _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hGfxDC, $hBrush_Orig) _WinAPI_DeleteObject($hBrush) GUIDelete($hGUI_Screencapture) ;capture region $aMPos[0] = MouseGetPos(0) $aMPos[1] = MouseGetPos(1) Else $aMPos_old[2] = $iX1 $aMPos_old[3] = $iY1 $aMPos[0] = $iX2 $aMPos[1] = $iY2 EndIf Local Const $hDC_Region = _WinAPI_GetDC(0) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Region) Local Const $iW_Region = Abs($aMPos[0] - $aMPos_old[2]) + 1, $iH_Region = Abs($aMPos[1] - $aMPos_old[3]) + 1 Local $hHBitmap_Captured = _WinAPI_CreateCompatibleBitmap($hDC_Region, $iW_Region, $iH_Region) $hObjOld = _WinAPI_SelectObject($hMemDC, $hHBitmap_Captured) _WinAPI_BitBlt($hMemDC, 0, 0, $iW_Region, $iH_Region, $hDC_Region, _ $aMPos[0] > $aMPos_old[2] ? $aMPos_old[2] : $aMPos[0], _ $aMPos[1] > $aMPos_old[3] ? $aMPos_old[3] : $aMPos[1], BitOR($SRCCOPY, $CAPTUREBLT)) Local $hHBitmap_Clipboard = _WinAPI_CopyImage($hHBitmap_Captured, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG)) _WinAPI_SelectObject($hHBitmap_Captured, $hObjOld) _WinAPI_DeleteDC($hHBitmap_Captured) _WinAPI_ReleaseDC(0, $hDC_Region) AutoItSetOption("MouseCoordMode", $iOld) If $bClipboard Then ;put captured region to clipboard If Not _ClipBoard_Open(0) Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(1, 0, 0) EndIf If Not _ClipBoard_Empty() Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(2, 0, 0) EndIf Local Const $hCP = _ClipBoard_SetDataEx($hHBitmap_Clipboard, $CF_BITMAP) If Not $hCP Or @error Then _WinAPI_DeleteObject($hHBitmap_Clipboard) Return SetError(3, 0, 0) EndIf _ClipBoard_Close() _WinAPI_DeleteObject($hHBitmap_Clipboard) Return 1 Else Return $hHBitmap_Clipboard EndIf EndSwitch Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI_Screencapture, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) _WinAPI_SelectObject($hGfxDC, $hPen_Orig) _WinAPI_DeleteObject($hPen) GUIDelete($hGUI_Screencapture) AutoItSetOption("MouseCoordMode", $iOld) Return -1 EndSwitch Until False EndFunc ;==>_WinAPI_MarkScreenRegionAndCapture Might be useful... Download: _WinAPI_MarkScreenRegionAndCapture.au3 (same as above in the code box) Tested only on Win10 x64 but should work also on other Window versions. If not please reply.
-
ciao, I need to scale an outlined GDI text in a GUI. The problem is that I can't do this. The outline is often out of the GUI I started from this script: https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_PathTransform.htm that fit a string to windows and I changed $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path with $aBounds = _GDIPlus_PathGetWorldBounds($hPath,$hMatrix,$hPen) ;Get bounding rectangle of the path with pen size but doesn't work so, I tried to change other thins, but nothing... Sometimes works, but if I change the string often result change This is my script: #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <array.au3> Example() Func Example() Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout, $hMatrix, $aBounds ; Create GUI $iW = 650 $iH = 300 $hGUI = GUICreate("GDI+", $iW, $iH) GUISetState(@SW_SHOW) ; Draw a string using path _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing) ;~ _GDIPlus_GraphicsClear($hGraphic, 0xFF000000) $MergedImageBackgroundColor = 0x00000000 _GDIPlus_GraphicsClear($hGraphic, $MergedImageBackgroundColor) $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200) $stroke_size = 15 $hPen = _GDIPlus_PenCreate(0xFFFFBB00, $stroke_size) ;stroke size in pixel $hPen2 = _GDIPlus_PenCreate(0xFFFFff00, 2) ;stroke size in pixel _GDIPlus_PenSetLineJoin($hPen,$GDIP_PENSETLINEJOIN_ROUND) $hPath = _GDIPlus_PathCreate() ;Create new path object ;~ $fSize = 20 $hFamily = _GDIPlus_FontFamilyCreate("Myriad Pro") ;Create font family object $tLayout = _GDIPlus_RectFCreate() ;Create string bounding rectangle X=0, Y=0 Local $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_PathAddString($hPath, "autoitForeverLollipop", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path ;~ _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $fSize, $hFormat) ; Tranform Path to fit to window $aBounds = _GDIPlus_PathGetWorldBounds($hPath) ;Get bounding rectangle of the path $aPoints = _GDIPlus_PathGetPoints($hPath) ConsoleWrite($aBounds[0] & @CRLF) ConsoleWrite($aBounds[1] & @CRLF) ConsoleWrite($aBounds[2] & @CRLF) ConsoleWrite($aBounds[3] & @CRLF) ConsoleWrite($aPoints[$aPoints[0][0]][0] & " - " & $aPoints[1][0] & " + 2*" & $stroke_size & " = " & $aPoints[$aPoints[0][0]][0]-$aPoints[1][0]+2*$stroke_size & @CRLF) ;~ $aBounds[0] = $aBounds[0] $aBoundsNp = _GDIPlus_PathGetWorldBounds($hPath,0,$hPen) ;Get bounding rectangle of the path with pen ConsoleWrite($aBoundsNp[0] & @CRLF) ConsoleWrite($aBoundsNp[1] & @CRLF) ConsoleWrite($aBoundsNp[2] & @CRLF) ConsoleWrite($aBoundsNp[3] & @CRLF) ConsoleWrite($iW & " / 2 = " & $iW / 2 & @CRLF) ConsoleWrite("$ih / 2 = " & $iH / 2 & @CRLF) ;~ ConsoleWrite($iW & " $aBounds[2] = " & $iW / $aBounds[2] & @CRLF) ConsoleWrite($iW & " $aBoundsNp[2] = " & $iW / $aBoundsNp[2] & @CRLF) ConsoleWrite($iH & " $aBoundsNp[3] = " & $iH / $aBoundsNp[3] & @CRLF) ;~ _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI) ;~ _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI) $hMatrix = _GDIPlus_MatrixCreate() $iW = $iW - $stroke_size ;+ $stroke_size $iH = $iH - $stroke_size ConsoleWrite(" -$aBounds[0]+1*$stroke_size/72 = " & -$aBounds[0]+1*$stroke_size/72 & @CRLF) ConsoleWrite(" -1.8+1*$stroke_size/72 = " & -1.8+1*$stroke_size/72 & @CRLF) _GDIPlus_MatrixTranslate($hMatrix, -$aBounds[0]+2*$stroke_size/72, -$aBounds[1]+1*$stroke_size/72) ;Translate Matrix to the offset of the bounding rectangle ;~ _GDIPlus_MatrixTranslate($hMatrix, -1.59166666666667+0*($stroke_size/72), -$aBounds[1]+1*$stroke_size/72) ;Translate Matrix to the offset of the bounding rectangle ;~ _GDIPlus_MatrixScale($hMatrix, $iW / $aBounds[2], $iH / $aBounds[3], True) ;Scale Matrix _GDIPlus_MatrixScale($hMatrix, $iW / $aBounds[2], $iH / $aBounds[3], True) ;Scale Matrix _GDIPlus_PathTransform($hPath, $hMatrix) ;Translate and Scale Path $aBoundsNp = _GDIPlus_PathGetWorldBounds($hPath,0,$hPen) ;Get bounding rectangle of the path with pen ConsoleWrite($aBoundsNp[0] & @CRLF) ConsoleWrite($aBoundsNp[1] & @CRLF) ConsoleWrite($aBoundsNp[2] & @CRLF) ConsoleWrite($aBoundsNp[3] & @CRLF) ;~ _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI) _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI) _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example if you change the line _GDIPlus_PathAddString($hPath, "autoitForeverLollipop", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path with a smaller string _GDIPlus_PathAddString($hPath, "autoitFitted", $tLayout, $hFamily);, 0, $fSize, $hFormat) ;Add the outline of the string to the path the result is ok Can someone can help me? Thankyou
-
Ciao, Is there a function to create a stroke text? I have found the solution to fill the text with a texture, to make a shadow and to make a text with glow , but I can't reproduce the stoke effect.) I have attached an example image of what I would like to reproduce I have tried to adapt this script of Malkey but with no result The Malkey script is this (I have edit some line) and the original post is here: #include <GDIPlus.au3> #include <WinAPI.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> Global $nPI = 3.1415926535897932384626433832795 Global $ghGDIPDll $hWnd = GUICreate("GDI+ Example", 800, 150) $iGlow = 2; <== Amount of Glow min = 1 Max about 5 _GDIPlus_Startup() $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics(800, 150, $hGraphicGUI) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) _GDIPlus_GraphicsClear($hGraphics, 0xff003000) ; Black-green background ;~ _GDIPlus_GraphicsClear($hGraphics, 0xffffffff) ; White Background _AntiAlias($hGraphics, 4) $hFamily = _GDIPlus_FontFamilyCreate("Arial Black") $hFont = _GDIPlus_FontCreate($hFamily, 80) $hLayout = _GDIPlus_RectFCreate(0, 0, 800, 150) $hStringFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hStringFormat, 1) For $i = 1 To 15 Step 3 $hBrush3 = _GDIPlus_BrushCreateSolid("0x" & hex($iGlow,2) & "00ff00"); <====== Glow (Transparency) For $x = 0 To 360 Step 3 DllStructSetData($hLayout, "Y", ((18 - $i)) * Sin($x * $nPI / 180)) DllStructSetData($hLayout, "X", ((18 - $i)) * Cos($x * $nPI / 180)) $hStringFormat = _GDIPlus_StringFormatCreate() _GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush3) Next Next DllStructSetData($hLayout, "Y", 0) DllStructSetData($hLayout, "X", 0) $hStringFormat = _GDIPlus_StringFormatCreate() $hBrush3 = _GDIPlus_BrushCreateSolid("0xfF00FF00") _GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush3) GUISetState() GUIRegisterMsg(0xF, "MY_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3) GUIRegisterMsg(0x85, "MY_PAINT") ; $WM_NCPAINT = 0x0085 (WindowsConstants.au3)Restore after Minimize. _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hBrush3) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _GDIPlus_Shutdown() Func _AntiAlias($hGraphics, $iMode) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_AntiAlias ;Func to redraw on PAINT MSG Func MY_PAINT($hWnd, $msg, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) _WinAPI_RedrawWindow($hWnd, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME)) ; , $RDW_ALLCHILDREN Return $GUI_RUNDEFMSG EndFunc ;==>MY_PAINT Thank you very much, Marco
-
Create simple forms from polygon is easy but its more difficult with complex forms, so... Shape2Polygon permit to get Polygon array Coordinates from a Black and White Shape for be used with _GDIPlus_GraphicsDrawPolygon. Source, compiled Version and Shape Samples are available in the download section. Hope it can help ! If you get an error while scanning, post the shape and i will try to update the script.