Jump to content

Image Filters / Graphical Effects ?


Recommended Posts

I already updated the code from post #7 yesterday but not for the ptr issue yet.

Br,

UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

@UEZ

i have a request for your image editor example script (i think you will be faster than me :)): instead of parsing the @OSVersion, it is better to check the gdiplus.dll version. i made an appropriate startup function:

.

Func __GDIPlus_Startup()
    If $giGDIPRef > 0 Then Return True

    ; check version first
    Local $tGDIPDLL="GDIPlus.dll"
    If Number(FileGetVersion($tGDIPDLL))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $tGDIPDLL=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($tGDIPDLL))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($tGDIPDLL)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    $giGDIPRef += 1

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $pInput = DllStructGetPtr($tInput)
    Local $tToken = DllStructCreate("int Data")
    Local $pToken = DllStructGetPtr($tToken)
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)
    ;Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup

.

i updated my no changes to includes necessary.

i also noticed the existing bugs in the _GDIPlus_Startup() function. it always returns false, even in the latest beta. i used your improved function instead. i guess a bug report is not necessary anymore ?

Edit: updated script

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Ok, I will add the DLL check instead of the OS check.

Currently I'm at the very beginning of the GUI creation code. Afterwards I will add the GDI+ stuff.

 

It will take some time until it will finished.

Br,

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Ok, I will add the DLL check instead of the OS check.

Currently I'm at the very beginning of the GUI creation code. Afterwards I will add the GDI+ stuff.

 

It will take some time until it will finished.

Br,

UEZ

 

looking forward to it :)

i think the gdiplus functions only waited to get thoroughly explored

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

in the startup function, i am still not sure about the $giGDIPRef handling.

normally i would assume, only one instance of the dll per script can be initialized. so $giGDIPRef can only be 0 or 1. but i may be wrong.

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Hi guys,

just a short info. Therre is a free available library called FreeImage. There are some infos here on the forum. I used it to move and rotate/scale some pictures but there are also some functions for color manipulations ...

Edited by Sundance
Link to comment
Share on other sites

Hi guys,

just a short info. Therre is a free available library called FreeImage. There are some infos here on the forum. I used it to move and rotate/scale some pictures but there are also some functions for color manipulations ...

 

And?

Br,

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

i still owed you a proof that gdiplus 1.1 effects work on XP. now here is a working example with blurring an image (i used and altered an example script from the forum, credits to unknown )

.

#include <GDIPlus.au3>

Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}"
Global Const $GDIP_SHARPENEFFECT = "{63CBF3EE-C526-402c-8F71-62C540BF5142}"
Global Const $GDIP_COLORMATRIXEFFECT = "{718F2615-7933-40e3-A511-5F68FE14DD74}"
Global Const $GDIP_COLORLUTEFFECT = "{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}"
Global Const $GDIP_BRIGHTNESSCONTRASTEFFECT = "{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}"
Global Const $GDIP_HUESATURATIONLIGHTNESSEFFECT = "{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}"
Global Const $GDIP_LEVELSEFFECT = "{99C354EC-2A31-4f3a-8C34-17A803B33A25}"
Global Const $GDIP_TINTEFFECT = "{1077AF00-2848-4441-9489-44AD4C2D7A2C}"
Global Const $GDIP_COLORBALANCEEFFECT = "{537E597D-251E-48da-9664-29CA496B70F8}"
Global Const $GDIP_REDEYECORRECTIONEFFECT = "{74D29D05-69A4-4266-9549-3CC52836B632}"
Global Const $GDIP_COLORCURVEEFFECT = "{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}"

If __GDIPlus_Startup() = False Then Exit; v6  v5 version abfragen

Local $hGUI, $hGraphics, $hImage, $hBlurredImage,  $hEffect

$Path=FileOpenDialog("Choose an Image",@ScriptDir,"Images (*.gif;*.png;*.jpg;*.bmp;*.tif)")
If $Path="" Then Exit

$hImage = _GDIPlus_ImageLoadFromFile($Path)
$iw=_GDIPlus_ImageGetWidth($hImage)
$ih=_GDIPlus_ImageGetHeight($hImage)

$hGUI = GUICreate("Blur on XP example", $iw, $ih)
GUISetState()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)

_GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)

MsgBox(0,"Blur on XP example",".....and now blurred     ")

$hEffect = _GDIPlus_EffectCreate($GDIP_BLUREFFECT)
$hBlurredImage = _GDIPlus_BitmapCreateWithEffect($hImage, $hEffect)

_GDIPlus_GraphicsDrawImage($hGraphics, $hBlurredImage, 0, 0)

Do
Until GUIGetMsg() = -3

_GDIPlus_BitmapDispose($hBlurredImage)
_GDIPlus_EffectDispose($hEffect)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphics)

_GDIPlus_Shutdown()


Func _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect, $pROI = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "hwnd", $hBitmap, "hwnd", $hEffect, "ptr", $pROI, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func _GDIPlus_BitmapCreateWithEffect($hBitmap, $hEffect, $pROI = 0, $pOutRect = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", "ptr*", $hBitmap, "int", 1, "hwnd", $hEffect, "ptr", $pROI, "ptr", $pOutRect, "int*", 0, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[6])
EndFunc

Func _GDIPlus_EffectCreate($sEffectGUID)
    Local $iI, $tGUID, $pGUID, $tElem, $aElem[4], $aResult

    $tGUID = _WinAPI_GUIDFromString($sEffectGUID)
    $pGUID = DllStructGetPtr($tGUID)

    $tElem = DllStructCreate("int[4]", $pGUID)
    For $iI = 1 To 4
        $aElem[$iI-1] = DllStructGetData($tElem, 1, $iI)
    Next

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateEffect", "int", $aElem[0], "int", $aElem[1], "int", $aElem[2], "int", $aElem[3], "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[5])
EndFunc

Func _GDIPlus_EffectDispose($hEffect)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "hwnd", $hEffect)

    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func __GDIPlus_Startup()
    If $giGDIPRef > 0 Then Return True

    ; check version first
    Local $tGDIPDLL="GDIPlus.dll"
    If Number(FileGetVersion($tGDIPDLL))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $tGDIPDLL=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($tGDIPDLL))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($tGDIPDLL)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    $giGDIPRef += 1

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $pInput = DllStructGetPtr($tInput)
    Local $tToken = DllStructCreate("int Data")
    Local $pToken = DllStructGetPtr($tToken)
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)
    ;Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup

.

and thank you Sundance for hinting to the other library. looks quite useful on first sight.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

i have to push it some more. i still need help very badly !

how do i get the bitmap with the blur effect into the Pic control ?

.

#Include <GDIPlus.au3>

Opt("GUIOnEventMode",1)


$Path=FileOpenDialog("Choose an Image  (preferably smaller than your desktop)",@ScriptDir,"Images (*.gif;*.png;*.jpg;*.bmp;*.tif)")
If $Path="" Then Exit

;MsgBox(0,"GDIPlus Version","System: "&FileGetVersion(@SystemDir&"\GDIPlus.dll")&@CRLF&"Local: "&FileGetVersion(@ScriptDir&"\GDIPlus.dll")&@CRLF&"Vista: "&FileGetVersion("C:\Install\TepcoPlotter\gdiplus1.1\Vista\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6001.22170_none_76fff8857c6d0501\GDIPlus.dll")&@CRLF&"Win7: "&FileGetVersion("C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6001.22170_none_76fff8857c6d0501\GDIPlus.dll"))

$RFB_Child=GUICreate("",100,100,85,85,0x80800000);BitOR($WS_BORDER,$WS_POPUP))
$RFB_Pic=GUICtrlCreatePic("",0,0,100,100)
GUICtrlSetResizing(-1,102)
GUICtrlSetCursor(-1,0)

__GDIPlus_Startup()

$hImage=_GDIPlus_ImageLoadFromFile($Path)
;$hImage = _GDIPlus_ImageLoadFromFile("flowers.jpg")
$iw=_GDIPlus_ImageGetWidth($hImage)
$ih=_GDIPlus_ImageGetHeight($hImage)

WinMove($RFB_Child,"",(@DesktopWidth-$iw)/2,(@DesktopHeight-$ih)/2+8,$iw+2,$ih+2)

_SetImage()

GUISetOnEvent(-7,"_Drag")
GUISetState()

MsgBox(0,"GDIPlus effects","now flip")
;    $RotateNoneFlipNone = 0 , _
;    $Rotate90FlipNone = 1 , _
;    $Rotate180FlipNone = 2 , _
;    $Rotate270FlipNone = 3 , _
;    $RotateNoneFlipX = 4 , _
;    $Rotate90FlipX = 5 , _
;    $Rotate180FlipX = 6 , _
;    $Rotate270FlipX = 7 , _
;    $RotateNoneFlipY = 6 , _
;    $Rotate90FlipY = 7 , _
;    $Rotate180FlipY = 4 , _
;    $Rotate270FlipY = 5 , _
;    $RotateNoneFlipXY = 6 , _
;    $Rotate90FlipXY = 7 , _
;    $Rotate180FlipXY = 0 , _
;    $Rotate270FlipXY = 1
DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",6)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","now zoom ...")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw*2,"int",$ih*2,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","... and restore")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw,"int",$ih,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","Blur")
$hBitmap=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hWnd=GUICtrlGetHandle($RFB_Pic)
;_GDIPlus_ImageDispose($hImage)
_WinAPI_SetWindowLong($hWnd,0xFFFFFFF0,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFF0),0x0E));$__SS_BITMAP;; $GWL_STYLE)
_WinAPI_DeleteObject(_SendMessage($hWnd,0x0172,0,$hBitmap));$__STM_SETIMAGE
_WinAPI_DeleteObject($hBitmap);das global behalten ???


MsgBox(0,"Please need help","How do i get the blurred image into the Pic control ???")

Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}"
$hEffect = _GDIPlus_EffectCreate($GDIP_BLUREFFECT)
$hBitmap=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)
$hBlurredImage = _GDIPlus_BitmapCreateWithEffect($hImage, $hEffect)


;   ??????????  please help here


    $hWnd=GUICtrlGetHandle($RFB_Pic)
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFF0,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFF0),0x0E));$__SS_BITMAP;; $GWL_STYLE)
    _WinAPI_DeleteObject(_SendMessage($hWnd,0x0172,0,$hBitmap));$__STM_SETIMAGE
    _WinAPI_DeleteObject($hBitmap);das global behalten ???
    _GDIPlus_EffectDispose($hEffect)
    _GDIPlus_ImageDispose($hImage)


MsgBox(0,"Please help me",":)")


_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()



Func _SetImage()
    $hBitmap=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hWnd=GUICtrlGetHandle($RFB_Pic)
    ;_GDIPlus_ImageDispose($hImage)
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFF0,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFF0),0x0E));$__SS_BITMAP;; $GWL_STYLE)
    _WinAPI_DeleteObject(_SendMessage($hWnd,0x0172,0,$hBitmap));$__STM_SETIMAGE
    _WinAPI_DeleteObject($hBitmap);das global behalten ???
EndFunc


Func _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect, $pROI = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "hwnd", $hBitmap, "hwnd", $hEffect, "ptr", $pROI, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func _GDIPlus_BitmapCreateWithEffect($hBitmap, $hEffect, $pROI = 0, $pOutRect = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", "ptr*", $hBitmap, "int", 1, "hwnd", $hEffect, "ptr", $pROI, "ptr", $pOutRect, "int*", 0, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[6])
EndFunc

Func _GDIPlus_EffectCreate($sEffectGUID, $pEffect = 0)
    Local $iI, $tGUID, $pGUID, $tElem, $aElem[4], $aResult
    $tGUID = _WinAPI_GUIDFromString($sEffectGUID)
    $pGUID = DllStructGetPtr($tGUID)
    $tElem = DllStructCreate("uint[4]", $pGUID)
    For $iI = 1 To 4
        $aElem[$iI - 1] = DllStructGetData($tElem, 1, $iI)
    Next
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateEffect", "uint", $aElem[0], "uint", $aElem[1], "uint", $aElem[2], "uint", $aElem[3], "uint*", $pEffect)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[5])
EndFunc   ;==>_GDIPlus_EffectCreate

Func _GDIPlus_EffectDispose($hEffect)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "hwnd", $hEffect)

    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func _Drag()
    DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0)
EndFunc

Func __GDIPlus_Startup()
    If $giGDIPRef > 0 Then Return True

    ; check version first
    Local $tGDIPDLL="GDIPlus.dll"
    If Number(FileGetVersion($tGDIPDLL))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $tGDIPDLL=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($tGDIPDLL))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($tGDIPDLL)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    $giGDIPRef += 1

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $pInput = DllStructGetPtr($tInput)
    Local $tToken = DllStructCreate("int Data")
    Local $pToken = DllStructGetPtr($tToken)
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)
    ;Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup

.

please help me i am stuck. i want the bitmap in the pic control because of the painting issues. i need the solution for a semi-professional script to display x-ray films. no matter what i try, it doesn't work. i really need a helping hand.

.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

What a chaotic code! ;)

#Include <GDIPlus.au3>

Opt("GUIOnEventMode",1)


$Path=FileOpenDialog("Choose an Image  (preferably smaller than your desktop)",@ScriptDir,"Images (*.gif;*.png;*.jpg;*.bmp;*.tif)")
If $Path="" Then Exit

;MsgBox(0,"GDIPlus Version","System: "&FileGetVersion(@SystemDir&"\GDIPlus.dll")&@CRLF&"Local: "&FileGetVersion(@ScriptDir&"\GDIPlus.dll")&@CRLF&"Vista: "&FileGetVersion("C:\Install\TepcoPlotter\gdiplus1.1\Vista\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6001.22170_none_76fff8857c6d0501\GDIPlus.dll")&@CRLF&"Win7: "&FileGetVersion("C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6001.22170_none_76fff8857c6d0501\GDIPlus.dll"))

$RFB_Child=GUICreate("",100,100,85,85,0x80800000);BitOR($WS_BORDER,$WS_POPUP))
$RFB_Pic=GUICtrlCreatePic("",0,0,100,100)
GUICtrlSetResizing(-1,102)
GUICtrlSetCursor(-1,0)

__GDIPlus_Startup()

$hImage=_GDIPlus_ImageLoadFromFile($Path)
;$hImage = _GDIPlus_ImageLoadFromFile("flowers.jpg")
$iw=_GDIPlus_ImageGetWidth($hImage)
$ih=_GDIPlus_ImageGetHeight($hImage)

Global $tRECTF = DllStructCreate($tagGDIPRECTF)
DllStructSetData($tRECTF, "X", 0)
DllStructSetData($tRECTF, "Y", 0)
DllStructSetData($tRECTF, "Width", $iW)
DllStructSetData($tRECTF, "Height", $iH)

WinMove($RFB_Child,"",(@DesktopWidth-$iw)/2,(@DesktopHeight-$ih)/2+8,$iw+2,$ih+2)

_SetImage()

GUISetOnEvent(-7,"_Drag")
GUISetState()

MsgBox(0,"GDIPlus effects","now flip")
;    $RotateNoneFlipNone = 0 , _
;    $Rotate90FlipNone = 1 , _
;    $Rotate180FlipNone = 2 , _
;    $Rotate270FlipNone = 3 , _
;    $RotateNoneFlipX = 4 , _
;    $Rotate90FlipX = 5 , _
;    $Rotate180FlipX = 6 , _
;    $Rotate270FlipX = 7 , _
;    $RotateNoneFlipY = 6 , _
;    $Rotate90FlipY = 7 , _
;    $Rotate180FlipY = 4 , _
;    $Rotate270FlipY = 5 , _
;    $RotateNoneFlipXY = 6 , _
;    $Rotate90FlipXY = 7 , _
;    $Rotate180FlipXY = 0 , _
;    $Rotate270FlipXY = 1
DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",6)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","now zoom ...")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw*2,"int",$ih*2,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
;~     _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","... and restore")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw,"int",$ih,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
;~     _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","Blur")

Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}"
Global Const $tagBLURPARAMS = "float radius;bool expandEdge" ;0-255; False/True
Global $tBlur = DllStructCreate($tagBLURPARAMS)
$hEffect = _GDIPlus_Blur($tBlur, 10)
Global $hBitmap_Blur = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iw, $ih)
Global $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap_Blur)
_GDIPlus_DrawImageFX($hGraphics, $hImage, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphics)
$hImage = $hBitmap_Blur
_SetImage()

MsgBox(0,"Please help me",":)")


_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()



Func _SetImage()
    $hBitmap=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hWnd=GUICtrlGetHandle($RFB_Pic)
    ;_GDIPlus_ImageDispose($hImage)
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFF0,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFF0),0x0E));$__SS_BITMAP;; $GWL_STYLE)
    _WinAPI_DeleteObject(_SendMessage($hWnd,0x0172,0,$hBitmap));$__STM_SETIMAGE
    _WinAPI_DeleteObject($hBitmap);das global behalten ???
EndFunc


Func _GDIPlus_Blur($tBlur, $fRadius, $bExpandEdge = False)
    If Not IsDllStruct($tBlur) Then Return SetError(1, @error, 0)
    DllStructSetData($tBlur, "radius", $fRadius)
    DllStructSetData($tBlur, "expandEdge", $bExpandEdge)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_BLUREFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tBlur)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $pEffect, $hMatrix = 0, $pImgAttributes = 0, $iUnit = 2)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDrawImageFX", "handle", $hGraphics, _
            "handle", $hBitmap, _
            "struct*", $tRECTF, _
            "handle", $hMatrix, _
            "ptr", $pEffect, _
            "ptr", $pImgAttributes, _
            "uint", $iUnit)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_DrawImageFX

Func _GDIPlus_EffectsSetParameters($pEffectObject, $tEffectParameters, $iSizeAdj = 1)
    Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "ptr", $pEffectObject, "uint*", 0)
    Local $iSize = $aSize[2] * $iSizeAdj
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetEffectParameters", "ptr", $pEffectObject, "struct*", $tEffectParameters, "uint", $iSize)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[3])
EndFunc   ;==>_GDIPlus_EffectsSetParameters

Func _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect, $pROI = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "hwnd", $hBitmap, "hwnd", $hEffect, "ptr", $pROI, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func _GDIPlus_BitmapCreateWithEffect($hBitmap, $hEffect, $pROI = 0, $pOutRect = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", "ptr*", $hBitmap, "int", 1, "hwnd", $hEffect, "ptr", $pROI, "ptr", $pOutRect, "int*", 0, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

    Return SetError($aResult[0], 0, $aResult[6])
EndFunc

Func _GDIPlus_EffectCreate($sEffectGUID, $pEffect = 0)
    Local $iI, $tGUID, $pGUID, $tElem, $aElem[4], $aResult
    $tGUID = _WinAPI_GUIDFromString($sEffectGUID)
    $pGUID = DllStructGetPtr($tGUID)
    $tElem = DllStructCreate("uint[4]", $pGUID)
    For $iI = 1 To 4
        $aElem[$iI - 1] = DllStructGetData($tElem, 1, $iI)
    Next
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateEffect", "uint", $aElem[0], "uint", $aElem[1], "uint", $aElem[2], "uint", $aElem[3], "uint*", $pEffect)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[5])
EndFunc   ;==>_GDIPlus_EffectCreate

Func _GDIPlus_EffectDispose($hEffect)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "hwnd", $hEffect)

    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc

Func _Drag()
    DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0)
EndFunc

Func __GDIPlus_Startup()
    If $giGDIPRef > 0 Then Return True

    ; check version first
    Local $tGDIPDLL="GDIPlus.dll"
    If Number(FileGetVersion($tGDIPDLL))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $tGDIPDLL=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($tGDIPDLL))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($tGDIPDLL)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    $giGDIPRef += 1

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $pInput = DllStructGetPtr($tInput)
    Local $tToken = DllStructCreate("int Data")
    Local $pToken = DllStructGetPtr($tToken)
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)
    ;Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup

Gruß,

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

it doesn't blur for me :( and i agree the code is very chaotic because i tried out so many different things. keine ahnung, aber es wird nicht blurred ... neither on xp nor on win7

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
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
 Share

×
×
  • Create New...