tempman Posted September 27, 2013 Share Posted September 27, 2013 Hi, I need a simpe solution that screen capture and then resize it for 200%.I am confused with _GDIPlus_GraphicsDrawImageThanks! Link to comment Share on other sites More sharing options...
FireFox Posted September 27, 2013 Share Posted September 27, 2013 Hi,Take a look at the _GDIPlus_ScaleImage function (available on the forum or in the beta version).Br, FireFox. Link to comment Share on other sites More sharing options...
tempman Posted September 27, 2013 Author Share Posted September 27, 2013 I am still sitting in the dark, any simple example, please. Link to comment Share on other sites More sharing options...
FireFox Posted September 27, 2013 Share Posted September 27, 2013 I am still sitting in the dark, any simple example, please. :'(In the beta helpfile there is an example AND in the forum there is necessarily an example on its use.Br, FireFox. Link to comment Share on other sites More sharing options...
tempman Posted September 27, 2013 Author Share Posted September 27, 2013 It is obvious that I can't find it AND this is the second thread where you are giving me the theoretical solution istead of usable one... Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted September 27, 2013 Moderators Solution Share Posted September 27, 2013 FireFox,I think you will find that _GDIPlus_ImageScale (note title word order) will be in the next beta to be released. And on the forum I can only find it in UEZ's "New GDI+" thread which is not visible to the OP. tempman,This is the example to which FireFox was referring:expandcollapse popup#include <GUIConstantsEx.au3> #include <Constants.au3> #include <ScreenCapture.au3> Example() Func Example() _GDIPlus_Startup() Local Const $iW = @DesktopWidth / 4, $iH = @DesktopHeight / 4 Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iW, $iH) ;create a GDI bitmap by capturing 1/8 of desktop Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI bitmap to GDI+ bitmap _WinAPI_DeleteObject($hHBmp) ;release GDI bitmap resource because not needed anymore Local $iScale = 2.75 ;1.0 is without any scaling Local $hBitmap_Scaled = _GDIPlus_ImageScale($hBitmap, $iScale, $iScale, $GDIP_INTERPOLATIONMODE_NEARESTNEIGHBOR) ;scale image by 275% (magnify) Local $hGUI = GUICreate("GDI+ test", $iW * $iScale, $iH * $iScale, -1, -1) ;create a test gui to display the rotated image GUISetState() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Scaled, 0, 0) ;display scaled image While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;cleanup resources _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hBitmap_Scaled) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>ExampleAnd here is the function itself:Func _GDIPlus_ImageScale($hImage, $iScaleW, $iScaleH, $iInterpolationMode = $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) Local $iWidth = _GDIPlus_ImageGetWidth($hImage) * $iScaleW If @error Then Return SetError(1, 0, 0) Local $iHeight = _GDIPlus_ImageGetHeight($hImage) * $iScaleH If @error Then Return SetError(2, 0, 0) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) If @error Then Return SetError(3, 0, 0) Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) If @error Then _GDIPlus_BitmapDispose($hBitmap) Return SetError(4, 0, 0) EndIf _GDIPlus_GraphicsSetInterpolationMode($hBmpCtxt, $iInterpolationMode) If @error Then _GDIPlus_GraphicsDispose($hBmpCtxt) _GDIPlus_BitmapDispose($hBitmap) Return SetError(5, 0, 0) EndIf _GDIPlus_GraphicsDrawImageRect($hBmpCtxt, $hImage, 0, 0, $iWidth, $iHeight) If @error Then _GDIPlus_GraphicsDispose($hBmpCtxt) _GDIPlus_BitmapDispose($hBitmap) Return SetError(6, 0, 0) EndIf _GDIPlus_GraphicsDispose($hBmpCtxt) Return $hBitmap EndFunc ;==>_GDIPlus_ImageScaleI hope that helps. 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...
FireFox Posted September 27, 2013 Share Posted September 27, 2013 very hard to search for _GDIPlus_ScaleImage. Link to comment Share on other sites More sharing options...
FireFox Posted September 27, 2013 Share Posted September 27, 2013 (edited) And on the forum I can only find it in UEZ's "New GDI+" thread which is not visible to the OP. My link shows the contrary.Edit: When I meant example, it's how the function is used (e.g: in the link I posted) that can be an example. Edited September 27, 2013 by FireFox Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 27, 2013 Moderators Share Posted September 27, 2013 FireFox,I was searching for _GDIPlus_ImageScale - that is what the function is called in the next Beta. Neither name features in the current Beta, which is where you suggested it could be found and where I went looking. But anyway the OP has got his function now. 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...
FireFox Posted September 27, 2013 Share Posted September 27, 2013 Yeah no problem 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