Edano Posted May 16, 2013 Posted May 16, 2013 (edited) i searched the forum, but didn't find anything. has anyone an idea or ever done it with autoit ? simple image transforming, like sharpness, brightness, blurring etc. ? maybe, does gdiplus.dll feature that ? here is a tutorial on how to do it the hard (mathematical) way. http://lodev.org/cgtutor/filtering.html before i try that, i wanted to know if there is already an existing project or an idea or anyone has experiences. thx Edited May 21, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
UEZ Posted May 16, 2013 Posted May 16, 2013 GDI+ is the thing you are searching for. Have a look to 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Edano Posted May 16, 2013 Author Posted May 16, 2013 (edited) will go look. thx. this is not in the standard includes ? Edit: wow. several cool impressing things, and so fast. it's time that someone puts together all the pieces. Edited May 16, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Malkey Posted May 16, 2013 Posted May 16, 2013 If you want to use a colour matrix to manipulate an image, you might find interesting.
Edano Posted May 16, 2013 Author Posted May 16, 2013 (edited) @malkey: yes yes, exactly, matrices and convolutions is what i think of. there is a but i don't get the FASM functions to work would be nice to get sth done like this: http://www.codeproject.com/Articles/2008/Image-Processing-for-Dummies-with-C-and-GDI-Part-2 thank you malkey and uez Edited May 16, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Edano Posted May 16, 2013 Author Posted May 16, 2013 @malkey your example script is excellent ! just what i need. will be trying different matrices. thx [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
UEZ Posted May 17, 2013 Posted May 17, 2013 (edited) Here some more stuff to play with: expandcollapse popup;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534056(v=vs.85).aspx #AutoIt3Wrapper_UseX64=n #include <GDIPlus.au3> #include <Memory.au3> Opt("MustDeclareVars", 1) Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}" Global Const $GDIP_BRIGHTNESSCONTRASTEFFECT = "{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}" Global Const $GDIP_COLORBALANCEEFFECT = "{537E597D-251E-48da-9664-29CA496B70F8}" Global Const $GDIP_COLORCURVEEFFECT = "{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}" Global Const $GDIP_COLORLUTEFFECT = "{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}" Global Const $GDIP_COLORMATRIXEFFECT = "{718F2615-7933-40e3-A511-5F68FE14DD74}" Global Const $GDIP_HUESATURATIONLIGHTNESSEFFECT = "{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}" Global Const $GDIP_LEVELSEFFECT = "{99C354EC-2A31-4f3a-8C34-17A803B33A25}" Global Const $GDIP_REDEYECORRECTIONEFFECT = "{74D29D05-69A4-4266-9549-3CC52836B632}" Global Const $GDIP_SHARPENEFFECT = "{63CBF3EE-C526-402c-8F71-62C540BF5142}" Global Const $GDIP_TINTEFFECT = "{1077AF00-2848-4441-9489-44AD4C2D7A2C}" _GDIPlus11_Startup() If @error Then Exit MsgBox(0x40010, "Error", "GDI+ Effect Collection can run on operating systems Vista or newer only!") Global $hBitmap = _GDIPlus_BMPFromMemory(_RedEye()) Global $iW = _GDIPlus_ImageGetWidth($hBitmap) Global $iH = _GDIPlus_ImageGetHeight($hBitmap) Global $hGUI = GUICreate("GDI+ v1.1 Effect Collection by UEZ 2013", $iW * 2, $iH, -1 , 100) GUISetState() Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $iW, 0, $iW, $iH) Global $hEffect Global $tRECTF = DllStructCreate($tagGDIPRECTF) DllStructSetData($tRECTF, "X", 0) DllStructSetData($tRECTF, "Y", 0) DllStructSetData($tRECTF, "Width", $iW) DllStructSetData($tRECTF, "Height", $iH) ;Color LUT Global Const $tagCOLORLUTPARAMS = "byte ColorChannelLUTB[256];byte ColorChannelLUTG[256];byte ColorChannelLUTR[256];byte ColorChannelLUTA[256]" Global $tColorLUT = DllStructCreate($tagCOLORLUTPARAMS), $tColorColorChannelLUT For $i = 192 To 256 DllStructSetData($tColorLUT, "ColorChannelLUTR", 0xA0, $i) DllStructSetData($tColorLUT, "ColorChannelLUTG", 0xB0, $i) DllStructSetData($tColorLUT, "ColorChannelLUTB", 0xC0, $i) Next $hEffect = _GDIPlus_ColorLUT($tColorLUT) ConsoleWrite("Color LUT" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Blur Global Const $tagBLURPARAMS = "float radius;bool expandEdge" ;0-255; False/True Global $tBlur = DllStructCreate($tagBLURPARAMS) $hEffect = _GDIPlus_Blur($tBlur, 10) ConsoleWrite("Blur" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Brightness Contrast Global Const $tagBRIGHTNESSCONTRASTPARAMS = "int brightnessLevel;int contrastLevel" ;-255-255; -100-100 Global $tBrightnessContrast = DllStructCreate($tagBRIGHTNESSCONTRASTPARAMS) $hEffect = _GDIPlus_BrightnessContrast($tBrightnessContrast, -60, 90) ConsoleWrite("Brightness Contrast" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Color Balance Global Const $tagCOLORBALANCEPARAMS = "int cyanRed;int magentaGreen;int yellowBlue" ;-100-100; -100-100; -100-100 Global $tColorBalance = DllStructCreate($tagCOLORBALANCEPARAMS) $hEffect = _GDIPlus_ColorBalance($tColorBalance, 60, -50, 20) ConsoleWrite("Color Balance" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Color Curve Global Enum $iAdjustExposure = 0, $iAdjustDensity, $iAdjustContrast, $iAdjustHighlight, $iAdjustShadow, _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534098(v=vs.85).aspx $iAdjustMidtone, $iAdjustWhiteSaturation, $iAdjustBlackSaturation Global Enum $iCurveChannelAll = 0, $iCurveChannelRed, $iCurveChannelGreen, $iCurveChannelBlue ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534100(v=vs.85).aspx Global Const $tagCOLORCURVEEFFECTPARAMS = "int type;int channel;int value" Global $tColorCurve = DllStructCreate($tagCOLORCURVEEFFECTPARAMS) ; Value ranges for adjustment parameters ; $iAdjustExposure, $iAdjustDensity -255 - 255 ; $iAdjustContrast, $iAdjustHighlight, $iAdjustShadow, $iAdjustMidtone -100 - 100 ; $iAdjustWhiteSaturation, $iAdjustBlackSaturation 0 - 255 $hEffect = _GDIPlus_ColorCurve($tColorCurve, $iAdjustHighlight, $iCurveChannelAll, 90) ConsoleWrite("Color Curve" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Color Matrix Global Const $tagGDIPCOLORMATRIXPARAMS = "float m[25];" Global $tColorMatrix = DllStructCreate($tagGDIPCOLORMATRIXPARAMS) Global $fRed = 0.66, $fGreen = 0.5, $fBlue = 0.5, $fAlpha = 1 $hEffect = _GDIPlus_ColorMatrix($tColorMatrix, $fRed, $fGreen, $fBlue, $fAlpha) ConsoleWrite("Color Matrix" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Hue Saturation Lightness Global Const $tagHUESATURATIONLIGHTNESSPARAMS = "int hueLevel;int saturationLevel;int lightnessLevel" ;-180-180; -100-100; -100-100 Global $tHueSaturationLightness = DllStructCreate($tagHUESATURATIONLIGHTNESSPARAMS) $hEffect = _GDIPlus_HueSaturationLightness($tHueSaturationLightness, 90, -50, 20) ConsoleWrite("Hue Saturation Lightness" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Levels Global Const $tagLEVELSPARAMS = "int highlight;int midtone;int shadow" ;0-100; -100-100; 0-100 Global $tLevels = DllStructCreate($tagLEVELSPARAMS) $hEffect = _GDIPlus_Levels($tLevels, 60, -50, 20) ConsoleWrite("Levels" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Sharpen Global Const $tagSHARPENPARAMS = "float radius;float amount" ;0-255; 0-100 Global $tSharpen = DllStructCreate($tagSHARPENPARAMS) $hEffect = _GDIPlus_Sharpen($tSharpen, 60, 90) ConsoleWrite("Sharpen" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Tint Global Const $tagTINTPARAMS = "int hue;int amount" ;-180-180; -100-100 Global $tTint = DllStructCreate($tagTINTPARAMS) $hEffect = _GDIPlus_Tint($tTint, 60, 40) ConsoleWrite("Tint" & @CRLF) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect) _GDIPlus_EffectDispose($hEffect) Sleep(3000) ;Red Eye -> http://msdn.microsoft.com/en-us/library/windows/desktop/ms534928(v=vs.85).aspx Global $nNumRects = 2 Global $tRECTs = DLLStructCreate("long[" & $nNumRects * 4 & "];") DllStructSetData($tRECTs, 1, 50, 1) DllStructSetData($tRECTs, 1, 64, 2) DllStructSetData($tRECTs, 1, 50 + 22, 3) DllStructSetData($tRECTs, 1, 64 + 18, 4) DllStructSetData($tRECTs, 1, 155, 5) DllStructSetData($tRECTs, 1, 64, 6) DllStructSetData($tRECTs, 1, 155 + 21, 7) DllStructSetData($tRECTs, 1, 64 + 18, 8) Global Const $pRECTs = DllStructGetPtr($tRECTs) Global Const $tagREDEYECORRECTIONPARAMS = "uint numberOfAreas;ptr areas;" Global $tRedEye = DllStructCreate($tagREDEYECORRECTIONPARAMS) DllStructSetData($tRedEye, "numberOfAreas", $nNumRects) DllStructSetData($tRedEye, "areas", $pRECTs) Global $pEffect = _GDIPlus_EffectCreate($GDIP_REDEYECORRECTIONEFFECT) ConsoleWrite("Red Eye" & @CRLF) _GDIPlus_EffectsSetParameters($pEffect, $tRedEye, (DllStructGetSize($tRECTs) + DllStructGetSize($tRedEye)) / DllStructGetSize($tRedEye)) _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $pEffect) ;~ $hBitmap_Effect = _GDIPlus_BitmapCreateApplyEffect($hBitmap, $pEffect) ;~ _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Effect, 0, 0) $tBlur = 0 $tTint = 0 $tColorCurve = 0 $tSharpen = 0 $tColorMatrix = 0 $tBrightnessContrast = 0 $tLevels = 0 $tColorBalance = 0 $tColorColorChannelLUT = 0 $tRedEye = 0 $tRECTF = 0 MsgBox(0, "", "Done", 15) Do Until GUIGetMsg() = -3 _GDIPlus_BitmapDispose($hBitmap) ;~ _GDIPlus_BitmapDispose($hBitmap_Effect) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit 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_BrightnessContrast($tBrightnessContrast, $iBrightnessLevel, $iContrastLevel) If Not IsDllStruct($tBrightnessContrast) Then Return SetError(1, @error, 0) DllStructSetData($tBrightnessContrast, "brightnessLevel", $iBrightnessLevel) DllStructSetData($tBrightnessContrast, "contrastLevel", $iContrastLevel) Local $pEffect = _GDIPlus_EffectCreate($GDIP_BRIGHTNESSCONTRASTEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tBrightnessContrast) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_ColorBalance($tColorBalance, $iCyanRed, $iMagentaGreen, $iYellowBlue) If Not IsDllStruct($tColorBalance) Then Return SetError(1, @error, 0) DllStructSetData($tColorBalance, "cyanRed", $iCyanRed) DllStructSetData($tColorBalance, "magentaGreen", $iMagentaGreen) DllStructSetData($tColorBalance, "yellowBlue", $iYellowBlue) Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORBALANCEEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tColorBalance) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_ColorCurve($tColorCurve, $iType, $iChannel, $iValue) If Not IsDllStruct($tColorCurve) Then Return SetError(1, @error, 0) DllStructSetData($tColorCurve, "type", $iType) DllStructSetData($tColorCurve, "channel", $iChannel) DllStructSetData($tColorCurve, "value", $iValue) Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORCURVEEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tColorCurve) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_ColorLUT($tColorLUT) If Not IsDllStruct($tColorLUT) Then Return SetError(1, @error, 0) Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORLUTEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tColorLUT) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_ColorMatrix($tColorMatrix, $fRed, $fGreen, $fBlue, $fAlpha) If Not IsDllStruct($tColorMatrix) Then Return SetError(1, @error, 0) DllStructSetData($tColorMatrix, "m", $fRed, 1) DllStructSetData($tColorMatrix, "m", $fGreen, 7) DllStructSetData($tColorMatrix, "m", $fBlue, 13) DllStructSetData($tColorMatrix, "m", $fAlpha, 19) DllStructSetData($tColorMatrix, "m", 1, 25) ;the element in the fifth row and fifth column of a 5×5 homogeneous matrix must be 1, and all of the other elements in the fifth column must be 0 Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORMATRIXEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tColorMatrix) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_HueSaturationLightness($tHueSaturationLightness, $iHueLevel, $iSaturationLevel, $iLightnessLevel) If Not IsDllStruct($tHueSaturationLightness) Then Return SetError(1, @error, 0) DllStructSetData($tHueSaturationLightness, "hueLevel", $iHueLevel) DllStructSetData($tHueSaturationLightness, "saturationLevel", $iSaturationLevel) DllStructSetData($tHueSaturationLightness, "lightnessLevel", $iLightnessLevel) Local $pEffect = _GDIPlus_EffectCreate($GDIP_HUESATURATIONLIGHTNESSEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tHueSaturationLightness) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_Levels($tLevels, $iHighlight, $iMidtone, $iShadow) If Not IsDllStruct($tLevels) Then Return SetError(1, @error, 0) DllStructSetData($tLevels, "highlight", $iHighlight) DllStructSetData($tLevels, "midtone", $iMidtone) DllStructSetData($tLevels, "shadow", $iShadow) Local $pEffect = _GDIPlus_EffectCreate($GDIP_LEVELSEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tLevels) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_Sharpen($tSharpen, $fRadius, $fAmount) If Not IsDllStruct($tSharpen) Then Return SetError(1, @error, 0) DllStructSetData($tSharpen, "radius", $fRadius) DllStructSetData($tSharpen, "amount", $fAmount) Local $pEffect = _GDIPlus_EffectCreate($GDIP_SHARPENEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tSharpen) If @error Then Return SetError(3, @error, 0) Return $pEffect EndFunc Func _GDIPlus_Tint($tTint, $iHue, $iAmount) If Not IsDllStruct($tTint) Then Return SetError(1, @error, 0) DllStructSetData($tTint, "hue", $iHue) DllStructSetData($tTint, "amount", $iAmount) Local $pEffect = _GDIPlus_EffectCreate($GDIP_TINTEFFECT) If @error Then Return SetError(2, @error, 0) _GDIPlus_EffectsSetParameters($pEffect, $tTint) If @error Then Return SetError(3, @error, 0) Return $pEffect 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_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_BitmapCreateApplyEffect($hBitmap, $pEffect, $pROI = 0, $tOutRect = 0, $hBmpOutput = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", _ "ptr*", $hBitmap, _ "int", 1, _ "ptr", $pEffect, _ "ptr", $pROI, _ "struct*", $tOutRect, _ "int*", $hBmpOutput, _ "int", 0, "ptr*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, $aResult[6]) EndFunc ;==>_GDIPlus_BitmapCreateApplyEffect Func _GDIPlus_EffectDispose($pEffect) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "ptr", $pEffect) If @error Then Return SetError(@error, @extended, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_EffectDispose Func _GDIPlus_BitmapApplyEffect($hBitmap, $pEffect, $pROI = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "handle", $hBitmap, "ptr", $pEffect, "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 ;==>_GDIPlus_BitmapApplyEffect 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 _GDIPlus11_Startup() ;code by Authenticity - modified by UEZ Local $pInput, $tInput, $pToken, $tToken, $aResult, $sGDIPDLL, $sVer $giGDIPRef += 1 If $giGDIPRef > 1 Then Return True Switch @OSVersion Case "WIN_VISTA", "WIN_2008" $sGDIPDLL = @WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll" Case Else $sGDIPDLL = @SystemDir & "\gdiplus.dll" EndSwitch $sVer = FileGetVersion($sGDIPDLL) If $sVer < "6.0" Then Return SetError(1, 0, False) ;For XP you need a GDIPlus.dll v1.1 in the script directory, refer to: http://www.winsxs.org/?OtherTech/thread-13-1-1 $ghGDIPDll = DllOpen($sGDIPDLL) $tInput = DllStructCreate($tagGDIPSTARTUPINPUT) $tToken = DllStructCreate("int Data") DllStructSetData($tInput, "Version", 1) $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0) If @error Then Return SetError(2, @extended, False) $giGDIPToken = DllStructGetData($tToken, "Data") Return $aResult[0] = 0 EndFunc ;==>_GDIPlus11_Startup #region Example Image ;====================================================================================== ; Function Name: _GDIPlus_BMPFromMemory ; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap ; ; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+ ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created ; ; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format ; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown() ; ; Requirement(s): GDIPlus.au3, Memory.au3 and _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format), ; Error: 0 ; Error codes: 1: $bImage is not a binary string ; 2: unable to create stream on HGlobal ; 3: unable to create bitmap from stream ; ; Author(s): UEZ ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and ; Yashied for _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Version: v0.98 Build 2012-08-29 Beta ;======================================================================================= Func _GDIPlus_BMPFromMemory($bImage, $hHBITMAP = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBITMAP Then Local Const $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_BMPFromMemory Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported) Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0 $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($aRet[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate( 'dword bV5Size;long bV5Width;long bV5Height;word bV5Planes;word bV5BitCount;dword bV5Compression;' & _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/dd183381(v=vs.85).aspx 'dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;' & _ 'dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;' & _ 'int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;' & _ 'dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved') DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'bV5Width', $aRet[2]) DllStructSetData($tBIHDR, 'bV5Height', $aRet[3]) DllStructSetData($tBIHDR, 'bV5Planes', 1) DllStructSetData($tBIHDR, 'bV5BitCount', 32) DllStructSetData($tBIHDR, 'bV5Compression', 0) ; $BI_BITFIELDS = 3, $BI_RGB = 0, $BI_RLE8 = 1, $BI_RLE4 = 2, $RGBA = 0x41424752 DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride')) DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000) DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2 DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) $tData = 0 $tBIHDR = 0 Return $hResult EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap ;Code below was generated by: 'File to Base64 String' Code Generator v1.11 Build 2012-10-13 Func _RedEye($bSaveBinary = False) Local $RedEye $RedEye &= '/9j/4AAQSkZJRgABAQEBLAEsAAD//gBERmlsZSBzb3VyY2U6IGh0dHA6Ly9jb21tb25zLndpa2ltZWRpYS5vcmcvd2lraS9GaWxlOkJvbGRSZWRFeWUuSlBH/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgApgDcAwERAAIRAQMRAf/EABwAAAIDAQEBAQAAAAAAAAAAAAQFAgMGAQcACP/EADoQAAEDAwMCBAQFAwMDBQAAAAECAxEABCESMUEFURMiYXEGMoGhFCORweFCsfAHFdFSYvEkMzRygv/EABsBAAMBAQEBAQAAAAAAAAAAAAABAgMEBQYH/8QALREBAQACAgICAQIFAwUAAAAAAAECEQMhEjEEQVEiYQUGExRxQoGhJDJSkfD/2gAMAwEAAhEDEQA/APz48gpdSFxsNhGKxl3F+jDp6PNrAGpPyzx61GS4eWQyCdRjJ9TWTVorJtRhMDURPtSBkhARhBlXekqdmVqyTGoTUqhm00MYNGj2MbTkE49qcidi29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TjahmKQ4AN5o2VVOrzMZqbVYqyed6AiZJM8cUz2taQCRjNJGVGttpKIj9KuMrX3hxxinobWBseHPP8Aeke+wbqYXMDNRemsvSl19LbjaVTKsAxTt0vDC5S2LgrO0UqlJK4pbC8Lx6VUqUVq82aez+gziSTj2oPYR48Zg9jTOBFqkiSByZoOhn9iRsMY7U2VoF0AvQSkgEA/Srxc2d6DXylpWYASdMgRtxV2ucht2g+lThVEqxisNb7dmONs6ZD4P6i89069bfWta0veIVkzMiumyS9OG2+W6e4UsGIkgCOPKDtUVthTK0mTxmKixvKaW6sEZxUVriZMrIUJpVriPaOUig9mFucJ9aSbRBUYEUk7cnaeaBKiFSfQUj2mkSByfWmW1rf2EU5E0e2sBkECrnplfbhdEHFGzkSS7qSMR2o9wa0oeTmDzU2HMgq0hwDUNjik2xysfJKisgxAxUn9Jp3PtS2m1NKiFAb0wm4cA0ylDPKg01TsC6rWJ43FNfoK5kCQNJmnCtDkkygGABNNjnfsvcUUztG3rNaRz53ZX1G40NPOpEeQx6YoyvTKTt5v1jrvULbqLrNq8W2kQNMcwKMMJZtr/Uyx6j//2Q==' Local $bString = Binary(_Base64Decode($RedEye)) If $bSaveBinary Then Local $hFile = FileOpen(@ScriptDir & "\220px-BoldRedEye.JPG", 18) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_RedEye Func _Base64Decode($sB64String) Local $struct = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, "") Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode #endregionRequirements: Vista or higher operating systems! Br,UEZ Edited May 23, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Edano Posted May 18, 2013 Author Posted May 18, 2013 (edited) Hello Everyone with XP ! Here are instructions on How to make GdiPlus.dll v1.1 work on an XP computer. if you have any objections, or you think it belongs to a different topic, or it is redundant, please tell me and i will move/remove the post. - i refer to an existing Win7 system, and that is just all you need. Vista and Win8 work the same. these instructions do not make any changes to the system or to autoit, so you don't have to worry to undo any changes. 1.) follow the steps described here: http://www.winsxs.org/?OtherTech/thread-13-1-1 . only the paragraph "How to make an available GDI+ 1.1 DLL for Windows XP" is important. don't download the attachments. the directories on Win7 where you find the gdiplus.dll and the .manifest may have different version names. be sure you choose corresponding directories that contain the same "xxx_1.1.xxx" version number. important: when you use the hex-editor on gdiplus.dll to exchange "_ftol2" and"_ftol2_sse" to "ftol", use zero [00] bytes to replace "2" resp. "2_sse". do not use the replace function of the hex editor. 2.) make changes to your scripts that are supposed to use the gdiplus 1.1 functionalities: add your own "__GDIPlus_Startup()" function to your script (note, only the @scriptdir is added (and several existing bugs repaired) and use it instead of "_GDIPlus_Startup()": . Func __GDIPlus_Startup() $giGDIPRef += 1 If $giGDIPRef > 1 Then Return True ; check system version first Global $ghGDIP_DLL_location="GDIPlus.dll"; sometimes needed eg for convolution.au3 If Number(FileGetVersion($ghGDIP_DLL_location))<6 Then; OS Vista or higher v 6.x.x.x ; OS XP v 5.x.x.x $ghGDIP_DLL_location=@ScriptDir&"\GDIPlus.dll"; check local If Number(FileGetVersion($ghGDIP_DLL_location))<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($ghGDIP_DLL_location) If $ghGDIPDll = -1 Then $giGDIPRef = 0 Return SetError(1, 2, False) EndIf Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT) Local $tToken = DllStructCreate("ulong_ptr Data") DllStructSetData($tInput, "Version", 1) 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 . 3.) put the three files from 1.) into your script directory. (GdiPlus.dll, msvaaa.dll, and Microsoft.Windows.GdiPlus.MANIFEST). make sure you "fileinstall" them to your script for using in other places. that's all. it's not really much to do and i tested it and it works 100%. have fun Edit: no changes needed for the includes ! Edit: updated __GDIPlus_Startup() script Edited June 7, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Edano Posted May 18, 2013 Author Posted May 18, 2013 @UEZ, if you come along, no matter what OS (i have xp, vista, win7 for testing), i always get an error on this line: Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0) i would love to get your example working .... [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
UEZ Posted May 18, 2013 Posted May 18, 2013 @UEZ, if you come along, no matter what OS (i have xp, vista, win7 for testing), i always get an error on this line: Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0) i would love to get your example working .... What is the error message? Anybody else with problems? 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Edano Posted May 18, 2013 Author Posted May 18, 2013 @extended = 0, @error = 1. how can i obtain a more detailed error message ? [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
UEZ Posted May 18, 2013 Posted May 18, 2013 http://msdn.microsoft.com/en-us/library/windows/desktop/ms534175(v=vs.85).aspx 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Malkey Posted May 18, 2013 Posted May 18, 2013 The error message I get revealed by pressing the "View problem details" button of the "Check online ...""Close the program" popup window displays:- Problem signature: Problem Event Name: APPCRASH Application Name: autoit3_x64.exe Application Version: 3.3.8.1 Application Timestamp: 4f25bafd Fault Module Name: gdiplus.dll Fault Module Version: 6.1.7601.17825 Fault Module Timestamp: 4f9242bf Exception Code: c0000005 Exception Offset: 0000000000046322 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 3081 Additional Information 1: ea36 Additional Information 2: ea360d0a44299c1a12e49ee0269325a4 Additional Information 3: ecc7 Additional Information 4: ecc7684e41a60fe1ac69846f6d066351 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\System32\en-USerofflps.txt Running on AutoIt Beta version works fine.
UEZ Posted May 18, 2013 Posted May 18, 2013 (edited) Using x64 mode the app crashes for me, too! Use at the top of the script #AutoIt3Wrapper_UseX64=n You need the full SciTE package! Br, UEZ Edited May 18, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Edano Posted May 18, 2013 Author Posted May 18, 2013 oh boy ... scripting was easier in pre-vista times ... [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Edano Posted May 20, 2013 Author Posted May 20, 2013 (edited) i fear i need another GDIPlus push from you. please help me understand it. here is what i made so far, it's not much flip/rotate and zoom an image. what i want to add is: brightness, contrast, sharpen, maybe blur and emboss if possible, and possibly matrix operations, but i don't get all the examples together. in fact, any effect would be nice. i would like to preserve the given idea to use a pic control, because it has no problem with repainting issues. expandcollapse popup#Include <GDIPlus.au3> $Path=FileOpenDialog("Choose an Image (preferably smaller than your desktop)",@ScriptDir,"Images (*.gif;*.png;*.jpg;*.bmp;*.tif)") If $Path="" Then Exit $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) $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","ready") ; more effects ? _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 _Drag() DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0) EndFunc . i would love to understand the logic. i found this excellent documentation: http://www.jose.it-berater.org/gdiplus/iframe/index.htm Edit: i forgot Opt("GUIOnEventMode",1) in the script . Edited May 20, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Edano Posted May 21, 2013 Author Posted May 21, 2013 imo, there is a bug in uez's example script. according to msdn and http://www.jose.it-berater.org/gdiplus/iframe/index.htm , GdipGetEffectParameterSize needs a pointer to the effect structure, not a handle. so, the line Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0) changed into Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "ptr", $hEffectObject, "uint*", 0) does not throw out an error, but a reasonable value for $aSize[2]=1024 (for blur). the same must be true for GdipSetEffectParameters. still, the example does not work for me, but at least i am one step forward. and i don't understand why it works for other people, but i keep working on it. [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
UEZ Posted May 21, 2013 Posted May 21, 2013 Thanks for the hint. The conversation from MSN might be buggy. If you find some bugs please report it. Currently I'm writing a tool with all the effects from above and some more. When it's finished I will post it to the example section. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Edano Posted May 21, 2013 Author Posted May 21, 2013 i just wonder why it only crashes for me, i am working parallel on three OS , xp, vista and win7. with "ptr" everything is fine even on xp. [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Edano Posted May 21, 2013 Author Posted May 21, 2013 a little bug i found is that you use the same line If Not IsDllStruct($tBlur) Then Return SetError(1, @error, 0) in several effect functions, where it should be $tBrightnessContrast or $tColorBalance instead. [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now