Jump to content
UEZ

_GDIPlus_BitmapApplyFilter v0.9.6 build 2017-05-14 beta

Recommended Posts

Added 8 more filters (Convolution_Gaussian3x3, Median2, Time Warp, Fish Eye, Swirl, Wave, X-Ray, Distortion Blur).

 

Have fun. ;)

 


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hello everyone, i have been scripting for a while without the need for registration.

I have immensely benefitted from the forums with all these great examples and scripts and great support, even without asking a question!

However i had to ask a specific question about this UDF developed by UEZ, i tried to pm him but i couldn't, i'm a newbie here.

I had to use these filters for preprocessing for OCR. Specifically i need Unsharp masking with gaussian kernel that i can modify maybe add a threshold for nearby color gradients like in imagemagick example,  " -unsharp 0x6+1+0.30 ", i followed UEZ's modified dll all the way to FreeBasic. Then i have realized there is an 31. option for Convolution Filter in the dll that is not passed to UDF, is this intentional ?

Then i also need to ask, why Freebasic? Im a noob scripter, when it comes to dll's and languages i dont really understand how it benefits ?

Can we write it in autoit? Can we not add these functions to autoit itself? Do we really need a dll, and why specifically a dll written in another language?

These are my noob questions, any lead i would really appreciate.

I cannot show enough gratitude for autoit community and developers, and UEZ you are one of my favourite developer. I appreciate your efforts.

Have a good day everyone!

Share this post


Link to post
Share on other sites

Forum has a very restrictive system for newcomers, i cannot even edit my post, I have found the 31. option in the convolution filter been used for Xray filter.

Share this post


Link to post
Share on other sites
2 hours ago, novel said:

Hello everyone, i have been scripting for a while without the need for registration.

I have immensely benefitted from the forums with all these great examples and scripts and great support, even without asking a question!

However i had to ask a specific question about this UDF developed by UEZ, i tried to pm him but i couldn't, i'm a newbie here.

I had to use these filters for preprocessing for OCR. Specifically i need Unsharp masking with gaussian kernel that i can modify maybe add a threshold for nearby color gradients like in imagemagick example,  " -unsharp 0x6+1+0.30 ", i followed UEZ's modified dll all the way to FreeBasic. Then i have realized there is an 31. option for Convolution Filter in the dll that is not passed to UDF, is this intentional ?

Then i also need to ask, why Freebasic? Im a noob scripter, when it comes to dll's and languages i dont really understand how it benefits ?

Can we write it in autoit? Can we not add these functions to autoit itself? Do we really need a dll, and why specifically a dll written in another language?

These are my noob questions, any lead i would really appreciate.

I cannot show enough gratitude for autoit community and developers, and UEZ you are one of my favourite developer. I appreciate your efforts.

Have a good day everyone!

I don't know what you mean with 31. option?

The reason why had used a DLL is simple: speed.

As you might know Autoit is an interpreter which translates the commands in real-time instead of compiling the code. That means for graphical operations such as pixel manipulation the speed is simply not sufficient. Even with the DLL some operations may take some seconds.

Of course all the functions can be written with Autoit but you don't need a cup of coffee rather a bucket of coffee for the waiting time. ;) 

If you want you can try to translate these function to Autoit -> _GDIPlus_BitmapApplyFilter v0.9.7 build 2020-11-16 beta (Windows only)

Btw, I've added some more functions (e.g. Delaunay) to the DLL but didn't publish it due to lack of interest.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
1 hour ago, UEZ said:

I don't know what you mean with 31. option?

The reason why had used a DLL is simple: speed.

As you might know Autoit is an interpreter which translates the commands in real-time instead of compiling the code. That means for graphical operations such as pixel manipulation the speed is simply not sufficient. Even with the DLL some operations may take some seconds.

Of course all the functions can be written with Autoit but you don't need a cup of coffee rather a bucket of coffee for the waiting time. ;) 

If you want you can try to translate these function to Autoit -> _GDIPlus_BitmapApplyFilter v0.9.7 build 2020-11-16 beta (Windows only)

Btw, I've added some more functions (e.g. Delaunay) to the DLL but didn't publish it due to lack of interest.

Thanks for the reply, i understand now the reason behind it.

Share this post


Link to post
Share on other sites

Actually i would like to help but i couldnt move with the code in pastebin, when i tried to compile it i received several errors, one was related with the crt.bi i fixed it, i think the code is several years old and the FBEdit Ide has issues with it, i dont remember atm.

Then it didnt find delaunay lib, when i checked in freebasic forums, i couldnt compile the delaunay function because of many errors, i couldnt help myself and i have ended up here :/

Thanks anyway, i wasn't expecting a fast reply.

Share this post


Link to post
Share on other sites

Just check out this link: http://www.mediafire.com/file/7y07a02epruem4e/_GDIPlus_BitmapApplyFilter_FB_Examples_build_2020-11-16.7z/file

Within this package you should find all needed files including some FB examples.

Here the Autoit UDF for it:

;IMPORTANT: You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name!
;Distributing copies of this UDF incl. _GDIPlus_BitmapApplyFilter.dll in compiled format (exe) must be free of any fee!
;
;coded by UEZ build 2020-11-16 beta
;

#include-once
#include <GDIPlus.au3>

Global $__hDLL__FX__
Global Enum $EMBOSS1 = 1, $EMBOSS2, $EMBOSS3, $EMBOSS4, $SHARPEN1, $BOX_BLUR, $GAUSSIAN_BLUR, $TRIANGLE_BLUR, $UNSHARP, $UNSHARP5x5, _
        $EDGE_DETECTION1, $EDGE_DETECTION2, $EDGE_DETECTION3, $EDGE_DETECTION4, $EDGE_DETECTION5, $EDGE_DETECTION6, _
        $ANOTHER_BLUR, $MOTION_BLUR, $SHARPEN2, $SOBEL, $LAPLACE3x3_1, $LAPLACE3x3_2, $LAPLACE5x5, $PREWITT, $KIRSCH, _
        $OUTLINE3X3, $GAUSSIAN5X5_1, $GAUSSIAN5X5_2, $LAPLACIANOFGAUSSIAN, $SOVELVSPREWITT, $GAUSSIAN3X3


; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Open
; Description ...: Initialises the DLL and starts GDIPlus
; Syntax ........: _GDIPlus_BitmapApplyFilter_Open([$sPath = @ScriptDir & "\_GDIPlus_BitmapApplyFilter.dll"])
; Parameters ....: $sPath               - [optional] a string value. Default is @ScriptDir & "\_GDIPlus_BitmapApplyFilter.dll".
; Return values .: A dll "handle".
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Open($sPath = @ScriptDir & "\_GDIPlus_BitmapApplyFilter.dll")
    _GDIPlus_Startup()
    If @error Then Return SetError(1, 0, 0)
    If Not FileExists($sPath) Then Return SetError(2, 0, 0)
    $__hDLL__FX__ = DllOpen($sPath)
    If $__hDLL__FX__ = -1 Then Return SetError(3, 0, 0)
    Return $__hDLL__FX__
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Open

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Close
; Description ...: Shut down GDIPlus and close the DLL handle.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Close()
; Parameters ....:
; Return values .: None
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Close()
    DllClose($__hDLL__FX__)
    _GDIPlus_Shutdown()
    Return 1
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Close

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Ver
; Description ...: Displays the version information about the _GDIPlus_BitmapApplyFilter.dll in a MessageBox.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Ver()
; Parameters ....: None
; Return values .: None
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Ver()
    DllCall($__hDLL__FX__, "none", "Ver")
    Return 1
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Ver


; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour
; Description ...: A smoothing (noise reduction) filter. The SNN smoothing filter is designed to preserve edges in data and
;                  is very effective at noise reduction.
; Syntax ........: _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour($hImage, $fRadius[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fRadius             - a floating point value. The higher the value the more time will needed for calculation.
;                                         The value is limited between 1 and 25.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will
;                                         be returned, otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour($hImage, $fRadius, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour", "ptr", $hImage, "float", $fRadius, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Jitter
; Description ...: Jitters the image
; Syntax ........: _GDIPlus_BitmapApplyFilter_Jitter($hImage, $iAmount[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iAmount             - an integer value. The amount of jitter strength the image will be modified.
;                                         The higher the value the more the image will be jittered.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Jitter($hImage, $iAmount, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Jitter", "ptr", $hImage, "uint", $iAmount, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Jitter

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Median
; Description ...: A smoothing (noise reduction) filter. The median filter is well known as an edge-preserving smoothing filter.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Median($hImage, $fRadius[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fRadius             - a floating point value. The higher the value the more time will needed for calculation.
;                                         The value is limited between 1 and 25.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Median($hImage, $fRadius, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Median", "ptr", $hImage, "float", $fRadius, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Median

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Median2
; Description ...: A smoothing (noise reduction) filter. The median filter is well known as an edge-preserving smoothing filter.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Median2($hImage, $fRadius[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fRadius             - a floating point value. The higher the value the more time will needed for calculation.
;                                         The value is limited between 1 and 25.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......: This filter is faster than _GDIPlus_BitmapApplyFilter_Median but the output quality is lower!
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Median2($hImage, $fRadius, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Median2", "ptr", $hImage, "float", $fRadius, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Median2

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Kuwahara
; Description ...: A smoothing (noise reduction) filter. Like the SNN filter, the Kuwahara filter is an adaptive, edge-preserving
;                  smoothing filter.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Kuwahara($hImage, $iSize[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iSize               - an integer value. The higher the value the more time will needed for calculation.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Kuwahara($hImage, $iSize, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Kuwahara", "ptr", $hImage, "uint", $iSize, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Kuwahara

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Edges
; Description ...: An edge detecting function based on left neighbour color value.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Edges($hImage, $bMode[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iMode               - an integer value. If 1 then the colors will be negated.
;                  $bInverse            - [optional] a boolean value. Default is False. If true image will be inverted.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Edges($hImage, $iMode, $bInverse = False, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Edges", "ptr", $hImage, "uByte", $iMode, "bool", $bInverse, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Edges

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Pointillism
; Description ...: Creates an image based on filled ellipses.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Pointillism($hImage, $iRounds, $iSizeEllipse, $iAlpha[, $bBorder = False[,
;                  $bGDI_Bmp = False]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iRounds             - an integer value. The amount of drawn filled ellipses.
;                  $iSizeEllipse        - an integer value. The size of the ellipses.
;                  $iAlpha              - an integer value. Alpha color channel. Possible values are between 0 and 255 whereas
;                                         0 is transparent and 255 is opaque.
;                  $bBorder             - [optional] a boolean value. Default is False. If true ellipses will have borders.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Pointillism($hImage, $iRounds, $iSizeEllipse, $iAlpha, $bBorder = False, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Pointillism", "ptr", $hImage, "uint", $iRounds, "uint", $iSizeEllipse, "byte", $iAlpha, "bool", $bBorder, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Pointillism

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Linellism
; Description ...: Creates an image based on filled rectangles (similar to Pointillism fx).
; Syntax ........: _GDIPlus_BitmapApplyFilter_Linellism($hImage, $iRounds, $iSizeRect, $iAlpha[, $iMode = 1[, $bBorder = False[,
;                  $bGDI_Bmp = False]]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iRounds             - an integer value. The amount of drawn filled rectangles.
;                  $iSizeRect           - an integer value. The size of the rectangles.
;                  $iAlpha              - an integer value. Alpha color channel. Possible values are between 0 and 255 whereas
;                                         0 is transparent and 255 is opaque.
;                  $iMode               - [optional] an integer value. Default is 1. Direction of the rectangles.
;                                         1 = horizontal, 2 = vertical, 3 = randomly 1 and 2.
;                  $bBorder             - [optional] a boolean value. Default is False. If true ellipses will have borders.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Linellism($hImage, $iRounds, $iSizeRect, $iAlpha, $iMode = 1, $bBorder = False, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Linellism", "ptr", $hImage, "uint", $iRounds, "uint", $iSizeRect, "byte", $iAlpha, "byte", $iMode, "bool", $bBorder, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Linellism

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Convolution
; Description ...: In image processing, a kernel, convolution matrix, or mask is a small matrix useful for blurring, sharpening,
;                  embossing, edge detection, and more. This is accomplished by means of convolution between a kernel and an image.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Convolution($hImage, $fFactor, $fBias[, $iMode = 1[, $bGDI_Bmp = False]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fFactor             - a floating point value. Adjustment for the color value (the factor will be multiplied with the result).
;                  $fBias               - a floating point value. Adjustment for the color value (brightness).
;                  $iMode               - [optional] an integer value. Default is 1.
;                                         Convolution modes (matrixes):
;                                         0: Manual odd matrix -> 3x3, 5x5, 7x7, 9x9
;                                         1: Emboss 3x3
;                                         2: Emboss 45 Degree 3x3
;                                         3: Emboss Top Left Bottom Right 3x3
;                                         4: Intense Emboss 5x5
;                                         5: Sharpen 3x3
;                                         6: Box Blur (normalized) 3x3
;                                         7: Gaussian Blur (approximation) 3x3
;                                         8: Triangle Blur 3x3
;                                         9: Unsharp(with no image mask) 5x5
;                                        10: Unsharp 3x3
;                                        11: Edge Detection 1 3x3
;                                        12: Edge Detection 2 3x3
;                                        13: Edge Detection 3 3x3
;                                        14: Edge Detection 4 3x3
;                                        15: Edge Detection 5 3x3
;                                        16: Edge Detection 6 3x3
;                                        17: Another Blur 5x5
;                                        18: Motion Blur 9x9
;                                        19: Sharpen 2 3x3
;                                        20: Sobel 3x3 with 2 matrixes (h/w)
;                                        21: Laplace 3x3 v1
;                                        22: Laplace 3x3 v2
;                                        23: Laplace 5x5
;                                        24: Prewitt 3x3
;                                        25: Kirsch 3x3
;                                        26: Gaussian3x3 blur
;                                        27: Gaussian5x5 Type1 blur
;                                        28: Gaussian5x5 Type2 blur
;                                        29: Laplacian of Gaussian 5x5
;                                        30: Sovel vs Prewitt 3x3
;                  $tMatrix             - [optional] an integer value. Default is 0. You can provide a convolution matrix manually.
;                                         The struct must have same amount of columns & rows whereas columns / rows must be odd!
;                                         E.g. struct of array has following structure for a 3x3 matrix:
;                                         $iMatrix = 3 * 3
;                                         $tStruct = DllStructCreate("float Matrix[" & $iMatrix & "]")
;                                         $tStruct.Matrix((1)) = 0.1
;                                         $tStruct.Matrix((2)) = 0.2
;                                         $tStruct.Matrix((3)) = 0.3
;                                         $tStruct.Matrix((4)) = 1.1
;                                         $tStruct.Matrix((5)) = 1.2
;                                         $tStruct.Matrix((6)) = 1.3
;                                         $tStruct.Matrix((7)) = 2.1
;                                         $tStruct.Matrix((8)) = 2.2
;                                         $tStruct.Matrix((9)) = 2.3
;                                         As an array:
;                                         [0.1, 0.1, 0.1]
;                                         [1.1, 1.1, 1.1]
;                                         [2.1, 2.1, 2.1]
;                  $iMatrix             - [optional] an integer value. Default is 0. The amount of matrix elements. E.g. a 3x3 matrix
;                                         has 9 elements.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Convolution($hImage, $fFactor, $fBias, $iMode = 1, $tMatrix = 0, $iMatrix = 0, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Convolution", "ptr", $hImage, "float", $fFactor, "float", $fBias, "byte", $iMode, "struct*", $tMatrix, "ushort", $iMatrix, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Convolution

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Raster
; Description ...: Creates a raster effect based on ellipses.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Raster($hImage[, $iSizeW = 8[, $iSizeH = 8[, $fDensity = 0.0[, $fbrightness = 0[,
;                  $fBias = 0[, $iMode = 1[, $bGDI_Bmp = False]]]]]]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iSizeW              - [optional] an integer value. Default is 8. Width of the raster ellipse.
;                  $iSizeH              - [optional] an integer value. Default is 8. Height of the raster ellipse.
;                  $fDensity            - [optional] a floating point value. Default is 0.0. Represents the pixel density.
;                  $fbrightness         - [optional] a floating point value. Default is 0. Represents the brightness of the ellipse color.
;                  $fBias              - [optional] a floating point value. Default is 0. Adjusts the size of the ellipse.
;                  $iMode               - [optional] an integer value. Default is 1. 1 = colorized, >1 = b/w.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Raster($hImage, $iSizeW = 8, $iSizeH = 8, $fDensity = 0.0, $fbrightness = 10, $fBias = 0, $iMode = 1, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Raster", "ptr", $hImage, "uint", $iSizeW, "uint", $iSizeH, "float", $fDensity, "float", $fbrightness, "float", $fBias, "byte", $iMode, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Raster

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Pixelate
; Description ...: Pixelates an image.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Pixelate($hImage[, $iPixelate = 8[, $bGDI_Bmp = False]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iPixelate           - [optional] an integer value. Default is 8. The divisor for the width / height of the image.
;                                         The higher the value the more pixelated will be the image.
;                  $bGrid               - [optional] a boolean value. Default is False. If true a grid will be drawn according to the pixel size.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Pixelate($hImage, $iPixelate = 8, $bGrid = False, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Pixelate", "ptr", $hImage, "byte", $iPixelate, "bool", $bGrid, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Pixelate

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Dilatation
; Description ...: Gradually enlarges the boundaries of regions of foreground pixels (i.e. white pixels, typically).
; Syntax ........: _GDIPlus_BitmapApplyFilter_Dilate($hImage[, $iSize = 5[, $bGDI_Bmp = False]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iSize               - [optional] an integer value. Default is 5. The higher the value the more time will
;                                         needed for calculation. $iSize is limited to a value between 2 and 32.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Dilatation($hImage, $iSize = 5, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Dilatation", "ptr", $hImage, "byte", $iSize, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Dilatation

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Erosion
; Description ...: Erodes away the boundaries of regions of foreground pixels (i.e. white pixels, typically).
; Syntax ........: _GDIPlus_BitmapApplyFilter_Erosion($hImage[, $iSize = 5[, $bGDI_Bmp = False]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iSize               - [optional] an integer value. Default is 5. The higher the value the more time will
;                                         needed for calculation. $iSize is limited to a value between 2 and 32.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Erosion($hImage, $iSize = 5, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Erosion", "ptr", $hImage, "byte", $iSize, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Erosion

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_OilPainting
; Description ...: Applies an oil painting look to the image.
; Syntax ........: _GDIPlus_BitmapApplyFilter_OilPainting($hImage, $iRadius, $fIntensityLevels[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iRadius             - an integer value. The size of the brush. $iRadius is limited to a value between 1 and 32.
;                  $fIntensityLevels    - a floating point value. The higher the value the more details will be drawn and also
;                                         more time will needed for calculation. Lower values mean more solid colors.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_OilPainting($hImage, $iRadius, $fIntensityLevels, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_OilPainting", "ptr", $hImage, "byte", $iRadius, "float", $fIntensityLevels, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_OilPainting

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_ColorAccent
; Description ...: Make the image greyscale except the selected Hue value.
; Syntax ........: _GDIPlus_BitmapApplyFilter_ColorAccent($hImage[, $iHue = 0[, $fRange = 15[, $bGDI_Bmp = False]]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iHue                - [optional] an integer value. Default is 0°. A Hue value which will be skipped to be greyscale.
;                                         Range: 0° - 360°
;                  $fRange              - [optional] a floating point value. Default is 15. Range of Hue value.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.rapidtables.com/convert/color/rgb-to-hsv.htm
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_ColorAccent($hImage, $iHue = 0, $fRange = 15, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_ColorAccent", "ptr", $hImage, "ushort", $iHue, "float", $fRange, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_ColorAccent

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_PenSketch
; Description ...: A bundle of several filters to produce a pen sketch effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_PenSketch($hImage, $iThreshold[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iThreshold          - an integer value. This value is used for _GDIPlus_BitmapApplyFilter_Convolution (Sobel)
;                                         filter.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_PenSketch($hImage, $iThreshold, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_PenSketch", "ptr", $hImage, "float", $iThreshold, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_PenSketch

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_PenSketch2
; Description ...: A bundle of several filters to produce a pen sketch effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_PenSketch2($hImage, $iThreshold[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iThreshold          - an integer value. This value is used for _GDIPlus_BitmapApplyFilter_Convolution (Sobel)
;                                         filter.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_PenSketch2($hImage, $iThreshold, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_PenSketch2", "ptr", $hImage, "ubyte", $iThreshold, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_PenSketch2

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Cartoon1
; Description ...: Creates a cartoon effect image.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Cartoon1($hImage, $iRadius, $fIntensityLevels, $iThreshold[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iRadius             - an integer value. The size of the brush. $iRadius is limited to a value between 1 and 32.
;                  $fIntensityLevels    - a floating point value. The higher the value the more details will be drawn and also
;                                         more time will needed for calculation. Lower values mean more solid colors.
;                  $iThreshold          - an integer value. The lower the value the more black contour lines will be drawn.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Cartoon1($hImage, $iRadius, $fIntensityLevels, $iThreshold, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Cartoon1", "ptr", $hImage, "ubyte", $iRadius, "float", $fIntensityLevels, "ubyte", $iThreshold, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Cartoon1

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_TiltShift
; Description ...: Creates a tilf shift effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_TiltShift($hImage, $fPosY[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fPosY               - a floating point value. This value is the area in the image where no blurring occurs whereas
;                                         $fPosY is the start and $fPosY + $fPosY / 2 the end position.
;                  $iIntensity          - an integer value. The higher the value the more the image will be blurred.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_TiltShift($hImage, $fPosY, $iIntensity, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_TiltShift", "ptr", $hImage, "float", $fPosY, "uByte", $iIntensity, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_TiltShift

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_RadialBlur
; Description ...: Creates a radial blur effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_RadialBlur($hImage, $fPosX, $fPosY, $fRadius, $iIntensity[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fPosX               - a floating point value. X position if the circle.
;                  $fPosY               - a floating point value. Y position if the circle.
;                  $fRadius             - a floating point value. Radius of the non blur circle.
;                  $iIntensity          - an integer value. The higher the value the more the image will be blurred.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_RadialBlur($hImage, $fPosX, $fPosY, $fRadius, $iIntensity, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_RadialBlur", "ptr", $hImage, "float", $fPosX, "float", $fPosY, "float", $fRadius, "uByte", $iIntensity, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_RadialBlur

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_TimeWarp
; Description ...: Creates a time warp effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_TimeWarp($hImage, $fFactor, $fMidX, $fMidY[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fFactor             - a floating point value. The strength of the time warp effect
;                  $fMidX               - a floating point value. X coordinate for the center.
;                  $fMidY               - a floating point value. Y coordinate for the center.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_TimeWarp($hImage, $fFactor, $fMidX, $fMidY, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_TimeWarp", "ptr", $hImage, "float", $fFactor, "float", $fMidX, "float", $fMidY, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_TimeWarp

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_FishEye
; Description ...: Creates a fish eye effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_FishEye($hImage[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_FishEye($hImage, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_FishEye", "ptr", $hImage, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_FishEye

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Wave
; Description ...: Adds a wavy look to the image.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Wave($hImage, $fAmplitudeX, $fAmplitudeY, $fFrequencyX, $fFrequencyY[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fAmplitudeX         - a floating point value.
;                  $fAmplitudeY         - a floating point value.
;                  $fFrequencyX         - a floating point value.
;                  $fFrequencyY         - a floating point value.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Wave($hImage, $fAmplitudeX, $fAmplitudeY, $fFrequencyX, $fFrequencyY, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Wave", "ptr", $hImage, "float", $fAmplitudeX, "float", $fAmplitudeY, "float", $fFrequencyX, "float", $fFrequencyY, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Wave

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Swirl
; Description ...: Creates a swirl effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Swirl($hImage, $fDegree[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fDegree             - a floating point value.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Swirl($hImage, $fDegree, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Swirl", "ptr", $hImage, "float", $fDegree, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Swirl

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_XRay
; Description ...: Creates a x-ray effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_XRay($hImage, $iBias, $bInvert[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iBias               - an integer value. The bias value increases / decreases the brightness of the image
;                  $bInvert             - a boolean value. Inverts the colors (negative).
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_XRay($hImage, $iBias, $bInvert, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_XRay", "ptr", $hImage, "byte", $iBias, "bool", $bInvert, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_XRay

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_DistortionBlur
; Description ...: Creates a blurred / distored image effect.
; Syntax ........: _GDIPlus_BitmapApplyFilter_DistortionBlur($hImage, $iDistortFactor[, $bGDI_Bmp = False])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iDistortFactor      - an integer value. The higher the value the more the pixels will be distorted.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_DistortionBlur($hImage, $iDistortFactor, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_DistortionBlur", "ptr", $hImage, "ushort", $iDistortFactor, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_DistortionBlur

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_BWJJNDithering
; Description ...: Converts the image to a black and white image using Jarvis, Judice, and Ninke dithering
; Syntax ........: _GDIPlus_BitmapApplyFilter_BWJJNDithering($hImage[, $fErrorMultiplier = 0.3333333[, $iThreshold = 128[,
;                  $bGDI_Bmp = False]]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $fErrorMultiplier    - [optional] a floating point value. Default is 0.3333333.
;                  $iThreshold          - [optional] an integer value. Default is 128. Level between black = 0 and white = 255.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_BWJJNDithering($hImage, $fErrorMultiplier = 0.3333333, $iThreshold = 128, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    $iThreshold = $iThreshold < 0 ? 0 : $iThreshold > 255 ? 255 : $iThreshold
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_BWJJNDithering", "ptr", $hImage, "float", $fErrorMultiplier, "ubyte", $iThreshold, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_BWJJNDithering

; #FUNCTION# ====================================================================================================================
; Name ..........: _GDIPlus_BitmapApplyFilter_Indexed
; Description ...: Converts the image to 1, 16 or 256 color bitmap. Dithering is optional.
; Syntax ........: _GDIPlus_BitmapApplyFilter_Indexed($hImage[, $iColors = 256[, $iDitherStrength = 5[, $iDitherMode = 1[,
;                  $bDither = True[, $bGDI_Bmp = False]]]]])
; Parameters ....: $hImage              - a handle to a GDIPlus bitmap.
;                  $iColors             - [optional] an integer value. Default is 256. 1, 16 or 256 color are implemented yet only.
;                  $iDitherMode         - [optional] an integer value. Default is 1. 2 is calculated with Euclidean distance.
;                  $bDither             - [optional] a boolean value. Default is True. If false the dithering is disabled.
;                  $bGDI_Bmp            - [optional] a boolean value. Default is False. If false a GDIPlus bitmap handle will be returned,
;                                         otherwise a GDI bitmap handle.
; Return values .: A bitmap handle (GDI/GDI+) depending on $bGDI_Bmp value.
; Author ........: UEZ
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GDIPlus_BitmapApplyFilter_Indexed($hImage, $iColors = 256, $iDitherMode = 1, $bDither = True, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Indexed", "ptr", $hImage, "ulong", $iColors, "bool", $bDither, "ubyte",  $iDitherMode, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc   ;==>_GDIPlus_BitmapApplyFilter_Indexed

Func _GDIPlus_BitmapApplyFilter_Mosaic($hImage, $iSites, $bOrdered, $bBorder, $iCalcMode, $iBorderColor, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Mosaic", "ptr", $hImage, "ULong", $iSites, "bool", $bOrdered, "bool", $bBorder, "ubyte", $iCalcMode, "ulong", $iBorderColor, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc

Func _GDIPlus_BitmapApplyFilter_Delaunay($hImage, $iBlur = 4, $fSobel = 1.0, $iThresholdBW = 60, $iSpaceX = 4, $iSpaceY = 4, $iBorderSpaceX = 16, $iBorderSpaceY = 16, _
                                                                  $bRndPoints = False, $iRndPoints = 0, $bShowEdges = False, $iAlpha = 0x60, $bWireframe = False, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Delaunay", "ptr", $hImage, "ubyte", $iBlur, "float", $fSobel, "ubyte", $iThresholdBW, "ulong", $iSpaceX, "ulong", $iSpaceY, "ubyte", _
                                                                            $iBorderSpaceX, "ubyte", $iBorderSpaceY, "bool", $bRndPoints, "ulong", $iRndPoints, "bool", $bShowEdges, "ubyte", $iAlpha, "bool", $bWireframe, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc

Func _GDIPlus_BitmapApplyFilter_Spiral($hImage, $iMode = 1, $iBgColor = 0xFFF0F0F0, $bGreyscale = True, $bGDI_Bmp = False)
    If Not IsPtr($hImage) Then Return SetError(1, 0, 0)
    Local Const $aReturn = DllCall($__hDLL__FX__, "ptr", "_GDIPlus_BitmapApplyFilter_Spiral", "ptr", $hImage, "ubyte", $iMode, "ulong", $iBgColor, "bool", $bGreyscale, "bool", $bGDI_Bmp)
    If Not $aReturn[0] Then Return SetError(2, 0, 0)
    Return $aReturn[0]
EndFunc

You need the DLL version dated to 2020-11-16 to use the UDF properly.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Im gonna ask off topic here, but i have an idea i need to ask it.

Is it possible do turn fonts to kernels and pass it through the image to enhance structures that is similar to the font on the image?

Would such an idea work in your opinion?

Share this post


Link to post
Share on other sites
2 hours ago, novel said:

Is it possible do turn fonts to kernels and pass it through the image to enhance structures that is similar to the font on the image?

Hmm, I don't know what you mean! :huh2: 

Any example?

😷


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

While i was digging a lot to learn about raster image filters, i have discovered in imagemagick library, they write a small script that we can transfer images to kernels, even though i didnt try it, it seems to work with perl which i have no experience at all.

There is an extensive explanation about morphologies and kernels in the link. 

https://legacy.imagemagick.org/Usage/morphology/#image2kernel

Script is here: https://legacy.imagemagick.org/Usage/scripts/image2kernel

Share this post


Link to post
Share on other sites

I was thinking to use this script (somehow) to transfer fonts to kernels to use them in convolution filters to enhance (increase brightness - sharpen) the fonts in the image so it will be the best preprocessing for OCR, ofc im just imagining.

That i was thinking to iterate all the font-kernels through the image to enhance the characters in the image.

Quote

 

 

 

The default for most morphology methods is a setting of 'None'. This means that after each kernel has been applied using the morphology method given, the resulting image should be used as the source for next kernel. That is simply 're-iterate' or reuse the resulting image from applying one kernel, for the next kernel.

Quote

 

For example, if I Convolve using 2, 90 degree rotated 'Blur' kernels we get the following.



  convert pixel.gif  -morphology Convolve "Blur:0x1>" \
          -auto-level  blur_re-iterate.gif
[IM Output] * [IM Output] , [IM Output] ==> [IM Output]

 

As you can see both kernels were applied to the image one after the other, so that each kernel works with the result of the previous kernel. That is it 're-iterates' the result of one kernel with the next kernel, in sequence.

 

Share this post


Link to post
Share on other sites

I don't know if this helps but you can use a manual kernel to pass it to the _GDIPlus_BitmapApplyFilter_Convolution function.

_GDIPlus_BitmapApplyFilter_Convolution_ManualMatrix.au3

#include "_GDIPlus_BitmapApplyFilter.au3"

Global Const $STM_SETIMAGE = 0x0172

Global Const $hDLL = _GDIPlus_BitmapApplyFilter_Open()

Global Const $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Face.png")
Global Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage)
Global Const $hGUI = GUICreate("", $iW * 2, $iH)
Global $fFactor = 1, $fBias = 0, $iMode = 0, $i
Local Const $iMatrix = 9 * 9
$tStruct = DllStructCreate("float Matrix[" & $iMatrix & "]")
;create motion blur
; 1 0 0 0 0 0 0 0 1
; 0 1 0 0 0 0 0 1 0
; 0 0 1 0 0 0 1 0 0
; 0 0 0 1 0 1 0 0 0
; 0 0 0 0 1 0 0 0 0
; 0 0 0 1 0 1 0 0 0
; 0 0 1 0 0 0 1 0 0
; 0 1 0 0 0 0 0 1 0
; 1 0 0 0 0 0 0 0 1



For $i = 0 to 8
    $tStruct.Matrix((9 + 8 * $i)) = 1 ;-100
    $tStruct.Matrix((1 + 10 * $i)) = 1 ;99
Next

;~ $tStruct.Matrix((41)) = 151

TrayTip("Information", "Please wait while calculating...", 60, 1)
Global $fEndtime, $fTimer = TimerInit()
Global Const $hGDI_new = _GDIPlus_BitmapApplyFilter_Convolution($hImage, $fFactor, $fBias, $iMode, $tStruct, $iMatrix, True)
$fEndtime = TimerDiff($fTimer)

Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW - 1, $iH - 1)
Global Const $iPic_o = GUICtrlCreatePic("", $iW, 0, $iW - 1, $iH - 1)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hGDI_new))
Global Const $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic_o, $STM_SETIMAGE, $IMAGE_BITMAP, $hGDIBitmap))

WinSetTitle($hGUI, "", "_GDIPlus_BitmapApplyFilter_Convolution / " & Round($fEndtime, 2) & " ms")
GUISetState()
TrayTip("Information", "Done in " & Round($fEndtime, 2) & " ms.", 10, 1)

Do
Until GUIGetMsg() = -3

_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hGDI_new)
_WinAPI_DeleteObject($hGDIBitmap)
_GDIPlus_Shutdown()
_GDIPlus_BitmapApplyFilter_Close()
GUIDelete($hGUI)

Maybe you to have to define the kernels (matrix) and pass each kernel to the image.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gowrisankar
      Dear members of the forum,
      I'm working on a project in which I have to use Image recognition technique. 
      Due to client restrictions, I couldn't use AutoIt for this project. 
      Is there a way to use this DLL "ImageSearchDLL.dll" (which is used to do image recognition steps in AutoIt) in VB.Net to achieve the same result? 
      I have used this DLL few years before and got good results. If there is a latest version of this DLL and if you can share it, that will be helpful too.
      Any guidance is deeply appreciated.
    • By UEZ
      This project has been discontinued!
       
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from the live web site cannot be downloaded although they are visible!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.6 build 2020-09-23 beta.7z  (1557 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • By UEZ
      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.
       
    • By Bilgus
      This is an update or derivative work of Beege 's Scrolling Line Graph UDF
      https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf
       
      I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform
      High CPU usage went hand in hand with that requirement
      Another issue was just how long updating took to complete
      I've hopefully rectified that with this version
       
      There are a few changes (only 1 line per graph for instance)
      The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3)
       
      Example 2 (peak.au3)
      UDF
      Updated:
      Previous Downloads [38 / 38/ 0]
      SSLG.au3 waveform.au3 Peak.au3
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
×
×
  • Create New...