zeehteam Posted January 30, 2014 Share Posted January 30, 2014 Hi, can this DrawReflection code be translated to autoit? Thank you. Zeehteam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 30, 2014 Moderators Share Posted January 30, 2014 zeehteam,Welcome to the AutoIt forum. The answer to your question is "quite likely". What have you done so far to try and get it to work? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
zeehteam Posted January 30, 2014 Author Share Posted January 30, 2014 I'm afraid I'll have to learn more about GDI+ to use it with Autoit... where can I get good information about it? Zeehteam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 30, 2014 Moderators Share Posted January 30, 2014 zeehteam,Looking in the Help file, searching the forum for GDI+ code threads, asking specific questions rather then giving the impression that you expect someone to do it all for you - there are lots of ways. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution UEZ Posted January 30, 2014 Solution Share Posted January 30, 2014 (edited) I didn't fully understand the C# code so here a way which is similar to the code (AutoIt version 3.3.10.x needed):#include <GDIPlus.au3> _GDIPlus_Startup() Global Const $hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://www.touchscreengadget.com/wp-content/uploads/2008/02/windowslivewriternewsonyericssontouchscreenunveils-b1ddg700i-1-3.jpg")) Global Const $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage) Global Const $iReflectivity = 40 Global $hBmp_Reflection = _GDIPlus_ImageDrawReflection($hImage, 0xFFFFFFFF, $iReflectivity) _GDIPlus_ImageSaveToFile($hBmp_Reflection, @ScriptDir & "\Test.png") _GDIPlus_BitmapDispose($hBmp_Reflection) _GDIPlus_Shutdown() ShellExecute(@ScriptDir & "\Test.png") Func _GDIPlus_ImageDrawReflection($hBitmap, $iBgColor, $iReflectivity, $iDeltaY = 2, $iAlpha = 0xD0) ;coded by UEZ build 2014-01-30 If $iReflectivity < 0 Then $iReflectivity = 0 If $iReflectivity > 0xFF Then $iReflectivity = 0xFF Local Const $iW = _GDIPlus_ImageGetWidth($hBitmap), $iH = _GDIPlus_ImageGetHeight($hBitmap) Local Const $iHeight = $iH + $iH * $iReflectivity / 255 + $iDeltaY Local Const $hBitmap_new = _GDIPlus_BitmapCreateFromScan0($iW, $iHeight) Local Const $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap_new) _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsClear($hGraphics, $iBgColor) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW,$iH) Local Const $fReflectionHeight = $iH * $iReflectivity / 255 Local Const $hBitmap_reflectedImage = _GDIPlus_BitmapCreateFromScan0($iW, $fReflectionHeight) Local Const $hGraphics_reflectedImage = _GDIPlus_ImageGetGraphicsContext($hBitmap_reflectedImage) _GDIPlus_GraphicsDrawImageRectRect($hGraphics_reflectedImage, $hBitmap, 0, $iH - $fReflectionHeight, $iW, $fReflectionHeight, 0, 0, $iW, $fReflectionHeight) _GDIPlus_ImageRotateFlip($hBitmap_reflectedImage, 6) Local Const $hBrush = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $fReflectionHeight, $iAlpha * 0x01000000 + BitAND(0x00FFFFFF, $iBgColor), 0xFF000000 + BitAND(0x00FFFFFF, $iBgColor)) _GDIPlus_GraphicsFillRect($hGraphics_reflectedImage, 0, 0, $iW, $fReflectionHeight, $hBrush) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBitmap_reflectedImage, 0, 0, $iW, $fReflectionHeight, 0, $iH + $iDeltaY, $iW, $fReflectionHeight) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics_reflectedImage) _GDIPlus_BitmapDispose($hBitmap_reflectedImage) _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap_new EndFuncSorry M23, that I did it for him but I couldn't resist. Information: Beta 3.3.11.3 has a bug in _GDIPlus_BitmapCreateFromMemory() function - don't use the beta!!! Br,UEZ Edited January 30, 2014 by UEZ zeehteam 1 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 More sharing options...
Moderators Melba23 Posted January 30, 2014 Moderators Share Posted January 30, 2014 UEZ,No problem at all. I rather thought that you might find it difficult not to produce some code! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
zeehteam Posted January 30, 2014 Author Share Posted January 30, 2014 UEZ, thank you so much Link to comment Share on other sites More sharing options...
zeehteam Posted January 31, 2014 Author Share Posted January 31, 2014 After taking a look at GDIPlusConstants.au3 file (Autoit 3.3.10.2), I've noticed an error in $GDIP_PXF32PARGB declaration. Global Const $GDIP_PXF32PARGB = 0x000D200B should be Global Const $GDIP_PXF32PARGB = 0x000E200B GdiPlusPixelFormats.h: #define PixelFormatGDI 0x00020000 #define PixelFormatAlpha 0x00040000 #define PixelFormatPAlpha 0x00080000 #define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI) Zeehteam Link to comment Share on other sites More sharing options...
UEZ Posted January 31, 2014 Share Posted January 31, 2014 (edited) Thanks for the hint. Seems to be a typo. -> http://msdn.microsoft.com/en-us/library/cc230858.aspx Also PixelFormat64bppPARGB is wrong. Br, UEZ Edited January 31, 2014 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 More sharing options...
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