Jump to content

Ghost border on _GDIPlus_GraphicsDrawImageRectRect


Go to solution Solved by Andreik,

Recommended Posts

Posted

Hello,

When i use _GDIPlus_GraphicsDrawImageRectRect to scale up an image, my rendered image is shifted up / left and filled with blank bottom right.

There is an exemple :

#include <GDIPlus.au3>
#include <GDIPlusConstants.au3>

_GDIPlus_Startup()

Local $fileName = @ScriptDir & "\test_gdi_zoom.png"
Local $origFileName = @ScriptDir & "\test_gdi.png"

Local $hBmp = _GDIPlus_BitmapCreateFromFile($origFileName)
Local $w = _GDIPlus_ImageGetWidth($hBmp)
Local $h = _GDIPlus_ImageGetHeight($hBmp)
Local $zoom = 7

Local $hBmpRender = _GDIPlus_BitmapCreateFromScan0($w * $zoom, $h * $zoom)
Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBmpRender)

_GDIPlus_GraphicsSetInterpolationMode($hGraphics, $GDIP_INTERPOLATIONMODE_NearestNeighbor)
_GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBmp, 0, 0, $w, $h, 0, 0, $w * $zoom, $h * $zoom)
;~ _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBmp, -1, -1, $w+1, $h+1, -1 * Ceiling($zoom / 2), -1 * Ceiling($zoom / 2), ($w + 1) * $zoom, ($h + 1) * $zoom)
_GDIPlus_GraphicsDispose($hGraphics)

_GDIPlus_ImageSaveToFile($hBmpRender, $fileName)

_GDIPlus_BitmapDispose($hBmpRender)
_GDIPlus_BitmapDispose($hBmp)

_GDIPlus_Shutdown()

Put the test_gdi.png in same directory than script and run it, it will create test_gdi_zoom.png

The commented line is the workaround i use to counter it (but very annoying)

Does this is known or do i have to create a ticket ?

 

Thanks !

Edit : I know that this bug was fixed for _GDIPlus_ImageResize() -> https://www.autoitscript.com/trac/autoit/ticket/3647
But i think it also should be done in _GDIPlus_GraphicsDrawImageRectRect

test_gdi.png

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).
Posted

Perfect ! Thank you :)
 

(But is it a bug anyway ?)

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).
Posted

ok, thanks ;)

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

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
×
×
  • Create New...