-
Posts
7,282 -
Joined
-
Last visited
-
Days Won
76
UEZ last won the day on April 7
UEZ had the most liked content!
About UEZ
- Birthday 12/03/2007
Profile Information
-
Member Title
Never say never
-
Location
Germany
-
Interests
Computer, watching movies, football (soccer), being lazy :-)
Recent Profile Visitors
UEZ's Achievements
-
faldo reacted to a post in a topic: Need help adding text atop a GDI+ object
-
NassauSky reacted to a post in a topic: Rotating Transparent Image Unclear
-
Rotating Transparent Image Unclear
UEZ replied to NassauSky's topic in AutoIt General Help and Support
The problem is that the image is semi-transparent and thus it looks good on white background. If you change the bg to black the result is the same as in your code. I don't have an idee yet how to display it with white bg but in a transparent GUI. Edit: If your bg is light then you can use: While Sleep(10) _GDIPlus_GraphicsClear($hBackbuffer, 0) ; Clear with opaque black color _GDIPlus_MatrixRotate($hMatrix, $iAngle, "False") _GDIPlus_GraphicsSetTransform($hBackbuffer, $hMatrix) _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hBG_Bitmap, -$rot_mid_x / 2, -$rot_mid_y / 2, $width / 2, $height / 2) $GDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap, 0xFFFFFFFF) _WinAPI_SelectObject($dc, $GDIBitmap) _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0xFFFFFFFF, $pBlend, 1) _WinAPI_DeleteObject($GDIBitmap) WEnd which will add white as a bg color. -
NassauSky reacted to a post in a topic: GDIPlus, need help with rotating an image
-
MarkIT reacted to a post in a topic: Microsoft Edge - WebView2, embed web code in your native application
-
Trouble with Floyd-Steinberg dithering
UEZ replied to Werty's topic in AutoIt General Help and Support
I changed it to 2 decimals, too. Now more colors will be used.- 19 replies
-
- dithering
- floyd-steinberg
-
(and 1 more)
Tagged with:
-
Trouble with Floyd-Steinberg dithering
UEZ replied to Werty's topic in AutoIt General Help and Support
Here the function in FB: Function _GDIPlus_BitmapCreateFakeGreyscale(hImage As Any Ptr, bGDI As BOOL = False) As Any Ptr Export Dim As Single iW, iH Dim As Double fGreys, fLuma Dim As Any Ptr hBitmap_Greyscale, hGDIBitmap Dim As BitmapData tBitmapData, tBitmapData_Greyscale Dim As Long iX, iY, iRowOffset, iColor, c, iR, iG, iB GdipGetImageDimension(hImage, @iW, @iH) Dim As RECT tRect = Type(0, 0, iW - 1, iH - 1) GdipCreateBitmapFromScan0(iW, iH, 0, PixelFormat32bppARGB, 0, @hBitmap_Greyscale) GdipBitmapLockBits(hBitmap_Greyscale, Cast(Any Ptr, @tRect), ImageLockModeWrite, PixelFormat32bppARGB, @tBitmapData_Greyscale) GdipBitmapLockBits(hImage, Cast(Any Ptr, @tRect), ImageLockModeRead, PixelFormat32bppARGB, @tBitmapData) For iY = 0 To iH - 1 iRowOffset = iY * iW For iX = 0 To iW - 1 iColor = Cast(ULong Ptr, tBitmapData.Scan0)[iRowOffset + iX] iR = (iColor Shr 16) And &hFF iG = (iColor Shr 8) And &hFF iB = iColor And &hFF fLuma = (iR * 213 + iG * 715 + iB * 72) / 1000 'fLuma = ((iR * 0.3) + (iG * 0.59) + (iB * 0.11) / 3) fGreys = fLuma - CUByte(fLuma) fLuma = CUByte(fLuma) iR = 0 iG = 0 iB = 0 Select Case fGreys Case 0.05 To 0.18 iB = 1 Case 0.19 To 0.34 iG = 1 Case 0.35 To 0.50 iB = 1 iG = 1 Case 0.51 To 0.66 iR = 1 Case 0.67 To 0.82 iR = 1 iB = 1 Case 0.83 To 0.95 iR = 1 iG = 1 End Select Cast(ULong Ptr, tBitmapData_Greyscale.Scan0)[iRowOffset + iX] = &hFF000000 Or ((fLuma + iR) Shl 16) Or ((fLuma + iG) Shl 8) Or (fLuma + iB) Shl 0 Next Next GdipBitmapUnlockBits(hBitmap_Greyscale, @tBitmapData_Greyscale) GdipBitmapUnlockBits(hImage, @tBitmapData) If bGDI Then GdipCreateHBITMAPFromBitmap(hBitmap_Greyscale, @hGDIBitmap, &hFF000000) GdipDisposeImage(hBitmap_Greyscale) Return hGDIBitmap EndIf Return hBitmap_Greyscale End Function I will play around with different values...- 19 replies
-
- dithering
- floyd-steinberg
-
(and 1 more)
Tagged with:
-
Trouble with Floyd-Steinberg dithering
UEZ replied to Werty's topic in AutoIt General Help and Support
Done. Check out Download the 7-Zip archive and look for _GDIPlus_BitmapApplyFilter_FakeGreyscale.au3 example.- 19 replies
-
- dithering
- floyd-steinberg
-
(and 1 more)
Tagged with:
-
Trouble with Floyd-Steinberg dithering
UEZ replied to Werty's topic in AutoIt General Help and Support
The color reducing code is based on the GDIPlus function GdipGetImagePalette which is unfortunately not the best algorithm to choose the best colors. Additionally it doesn't utilize the full color range. For example if you create a 8 bit bitmap it doesn't use the full color scope of 256 colors. The color formats which I use is 2-bit, 4-bit and 8 bit -> 2, 16 and 256 colors. Nothing in between will be calculated. @AndyG that is the reason why it looks better when $iColors is > 16. It will set it to 256 color bitmap (8 bit). @Werty the DLL is using heavily GDIPlus functions and the For/Next loops are much faster in Freebasic than in Autoit. In the DLL I added also a function call "_GDIPlus_BitmapCreateGreyscale" which converts the image to 256 greyscale colors using (iR * 213 + iG * 715 + iB * 72) / 1000 calculation. Let me add your "fake"grey to the DLL...- 19 replies
-
- dithering
- floyd-steinberg
-
(and 1 more)
Tagged with:
-
Werty reacted to a post in a topic: Trouble with Floyd-Steinberg dithering
-
ioa747 reacted to a post in a topic: Trouble with Floyd-Steinberg dithering
-
Danyfirex reacted to a post in a topic: Trouble with Floyd-Steinberg dithering
-
Trouble with Floyd-Steinberg dithering
UEZ replied to Werty's topic in AutoIt General Help and Support
@Werty I updated Just check out the example _GDIPlus_BitmapApplyFilter_Indexed.au3. This time I added also a x64 DLL but not fully tested. The result should look like this here with Floyd-Steinberg dithering:- 19 replies
-
- dithering
- floyd-steinberg
-
(and 1 more)
Tagged with:
-
ahmeddzcom reacted to a post in a topic: Get resolution from another monitor
-
An old thread: www.autoitscript.com/forum/topic/131335-convert-time-in-string-to-time-value
-
yutijang reacted to a post in a topic: GDI+ Color Transformer v0.9.7 build 2016-04-23
-
Danyfirex reacted to a post in a topic: _GDIPlus_BitmapApplyFilter v0.9.8 build 2024-04-17 beta
-
Get the binary type for exe / dll file. ;Coded by UEZ build 2024-04-08 #AutoIt3Wrapper_UseX64 = y #include <WinAPIFiles.au3> #include <WinAPIProc.au3> Global $sFile = FileOpenDialog("Select a DLL file", "", "File (*.dll;*.exe)", $FD_FILEMUSTEXIST) If @error Then Exit MsgBox($MB_ICONINFORMATION, "File Binary Type", StringRegExpReplace($sFile, ".+\\(.+)", "$1") & " = " & _WinAPI_GetBinaryType2($sFile)) ; #FUNCTION# ==================================================================================================================== ; Author.........: UEZ ; Modified.......: ; =============================================================================================================================== Func _WinAPI_GetBinaryType2($sFile) Local Const $hFile = _WinAPI_CreateFile($sFile, 2, 2) If Not $hFile Or @error Then Return SetError(1, 0, 0) Local Const $hMapping = _WinAPI_CreateFileMapping($hFile, 0, Null, $PAGE_READONLY, Null) If Not $hMapping Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, 0) EndIf Local Const $pAddress = _WinAPI_MapViewOfFile($hMapping, 0, 0, $FILE_MAP_READ) If Not $pAddress Or @error Then __ReturnGBT2($hMapping, $hFile, 3) Local $aHeader = DllCall("Dbghelp.dll", "ptr", "ImageNtHeader", "ptr", $pAddress) If @error Or IsArray($aHeader) = 0 Then Return __ReturnGBT2($hMapping, $hFile, 4) Local $tIMAGE_NT_HEADERS = DllStructCreate("dword Signature;ptr FileHeader;ptr OptionalHeader;", $aHeader[0]) If @error Or Not IsDllStruct($tIMAGE_NT_HEADERS) Then Return __ReturnGBT2($hMapping, $hFile, 5) Local $tIMAGE_FILE_HEADER = DllStructCreate("word Machine;word NumberOfSections;dword TimeDateStamp;dword PointerToSymbolTable;dword NumberOfSymbols;word SizeOfOptionalHeader;word Characteristics;", DllStructGetPtr($tIMAGE_NT_HEADERS) + 4) If @error Or Not IsDllStruct($tIMAGE_FILE_HEADER) Then Return __ReturnGBT2($hMapping, $hFile, 6) __ReturnGBT2($hMapping, $hFile, 0) Switch $tIMAGE_FILE_HEADER.Machine Case 0x014c Return "x86" Case 0x0200 Return "Intel Itanium" Case 0x8664 Return "x64" Case Else Return "Error" EndSwitch EndFunc ;==>_WinAPI_GetBinaryType2 Func __ReturnGBT2($hMapping, $hFile, $iError) _WinAPI_CloseHandle($hMapping) _WinAPI_CloseHandle($hFile) If $iError Then Return SetError($iError, 0, 0) EndFunc ;==>__ReturnGBT2
-
Cairo 2D graphics library build 2024-04-02 alpha
UEZ replied to UEZ's topic in AutoIt Example Scripts
This seems to work but you need libcairo-2.dll which can be found also on my OneDrive (x86 / x64 folders). ;Coded by UEZ build 2024-04-02 beta #AutoIt3Wrapper_UseX64=n #include "..\Cairo.au3" Cairo_Example() Func Cairo_Example() If Not Cairo_Init("libcairo-2.dll") Then ConsoleWrite(@error & @CRLF) Exit EndIf If FileExists("Example.pdf") Then FileDelete("Example.pdf") Local $MM_TO_PT = 72.0 / 25.4, $PAGE_WIDTH_A5 = 148, $PAGE_HEIGHT_A5 = 210, $PAGE_WIDTH_A4 = 210, $PAGE_HEIGHT_A4 = 297 Local Const $pSurface = Cairo_PDF_Create("Example.pdf", $PAGE_WIDTH_A5 * $MM_TO_PT, $PAGE_HEIGHT_A5 * $MM_TO_PT) Cairo_PDF_RestrictToVersion($pSurface, $CAIRO_PDF_VERSION_1_4) Local Const $pContext = Cairo_Context_Create($pSurface) Cairo_Context_SetLineWidth($pContext, 6) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_EVEN_ODD) Cairo_Context_SetSourceRGB($pContext, 0, 0.7, 0) Cairo_Context_FillPreserve($pContext) Cairo_Context_SetSourceRGB($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_Translate($pContext, 0, 128) Cairo_Context_PathAddRectangle($pContext, 12, 12, 232,70) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArc($pContext, 64, 64, 40, 0, ACos(-1) * 2) Cairo_Context_PathBeginNewSub($pContext) Cairo_Context_PathAddArcNegative($pContext, 192, 64, 40, 0, -ACos(-1) * 2) Cairo_Context_SetFillRule($pContext, $CAIRO_FILL_RULE_WINDING) Cairo_SetColor($pContext, 0, 0, 0.9) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0) Cairo_Context_Stroke($pContext) Cairo_Context_PathClear($pContext) Cairo_Context_PathAddMoveTo($pContext, 40, 150) Cairo_Font_SelectFace($pContext) Cairo_Font_SetSize($pContext, 30) Cairo_Context_PathAddText($pContext, "PDF Example") Cairo_SetColor($pContext, 0.9, 0, 0, 1) Cairo_Context_FillPreserve($pContext) Cairo_SetColor($pContext, 0, 0, 0.1, 0.5) Cairo_Context_SetLineWidth($pContext, 1.5) Cairo_Context_Stroke($pContext) Cairo_Surface_Finish($pSurface) Cairo_Surface_Flush($pSurface) ConsoleWrite(Cairo_Surface_GetStatus($pSurface) & @CRLF) Cairo_Context_Destroy($pContext) Cairo_Surface_Destroy($pSurface) Cairo_Close() ConsoleWrite(FileGetSize("Example.pdf") & @CRLF) EndFunc I seems that the Cairo.dll / Cairo64.dll doesn't work properly with PDF creation... -
Cairo 2D graphics library build 2024-04-02 alpha
UEZ replied to UEZ's topic in AutoIt Example Scripts
The functions are added but the created PDF is currently empty. When I found a way to create working PDFs I will post it. -
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.