algiuxas 11 Posted January 6, 2016 (edited) Hello,I have problem with _GDIPlus_GraphicsDrawImageRect, here is picture: Untitled.bmpI set _GDIPlus_GraphicsSetInterpolationMode to 5.I can see it moves to top half pixel, and it moves to left half pixel too.I need to fix space between images, anybody can help me fix it? Thanks! Edited January 6, 2016 by algiuxas Share this post Link to post Share on other sites
UEZ 1,265 Posted January 6, 2016 Post your code that we can see what you did. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
algiuxas 11 Posted January 7, 2016 (edited) Post your code that we can see what you did.expandcollapse popup$IMAGE = "test.bmp";DIRECTORY OF VERY SMALL IMAGE(I recommend use 3x3 size image) $ExitTimer = 12;Exit in 12 secounds #include <GDIPlus.au3> #include <Math.au3> #include <Misc.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> Global $GraphicsSizeX, $GraphicsSizeY, $Font, $GUI, $TestIMAGE, _ $Graphics, $Bitmap, $GfxCtxt, $BkColor, $SpaceBetweenGUICorners $SpaceBetweenGUICorners = 64 $BkColor = 0xFF0000 $GraphicsSizeX = 600 $GraphicsSizeY = 600 $Font = "Century Gothic" $GUI = GUICreate( "TEST", $GraphicsSizeX+$SpaceBetweenGUICorners*2, $GraphicsSizeY+$SpaceBetweenGUICorners*2, -1, -1) _GDIPlus_Startup() $TestIMAGE = _GDIPlus_ImageLoadFromFile($IMAGE) $Graphics = _GDIPlus_GraphicsCreateFromHWND($GUI) $Bitmap = _GDIPlus_BitmapCreateFromGraphics($GraphicsSizeX, $GraphicsSizeY, $Graphics) $GfxCtxt = _GDIPlus_ImageGetGraphicsContext($Bitmap) GUISetFont(8.5,400,1,$Font) $Timer = TimerInit() GUISetState() Do _GDIPlus_GraphicsClear($GfxCtxt, 0xFF000000+$BkColor) ;----------------------#1----------------------; _GDIPlus_GraphicsSetInterpolationMode ( $GfxCtxt, 5 ) DrawIMG($TestIMAGE,0,0,$GraphicsSizeX/2,$GraphicsSizeY/2) DrawText("#1 InterpolationMode = 5(Nearest-neighbor)",0,0) ;----------------------#2----------------------; _GDIPlus_GraphicsSetInterpolationMode ( $GfxCtxt, 1 ) DrawIMG($TestIMAGE,$GraphicsSizeX/2,0,$GraphicsSizeX/2,$GraphicsSizeY/2) DrawText("#2 InterpolationMode = 1(Low-quality)",$GraphicsSizeX/2,0) ;----------------------#3----------------------; _GDIPlus_GraphicsSetInterpolationMode ( $GfxCtxt, 3 ) DrawIMG($TestIMAGE,0,$GraphicsSizeY/2,$GraphicsSizeX/2,$GraphicsSizeY/2) DrawText("#3 InterpolationMode = 3{Bilinear)",0,$GraphicsSizeY/2) ;----------------------#4----------------------; _GDIPlus_GraphicsSetInterpolationMode ( $GfxCtxt, 5 ) DrawIMG($TestIMAGE,$GraphicsSizeX/2,$GraphicsSizeY/2,$GraphicsSizeX/2,$GraphicsSizeY/2) DrawText("#4 InterpolationMode = 5(Nearest-neighbor)",$GraphicsSizeX/2,$GraphicsSizeY/2) ;----------------------------------------------; $TimerSec = Round(TimerDiff($Timer)/1000,1) If $TimerSec > $ExitTimer then $TimerSec = $ExitTimer DrawText($ExitTimer-$TimerSec&"s",0,20) _GDIPlus_GraphicsDrawImage($Graphics, $Bitmap, $SpaceBetweenGUICorners, $SpaceBetweenGUICorners) Sleep(250) Until $TimerSec >= $ExitTimer ;Exit after 12 secounds _GDIPlus_BitmapDispose($Bitmap) _GDIPlus_Shutdown() GUIDelete() exit Func DrawIMG($IMG,$PosX,$PosY,$SizeX=1,$SizeY=1) ;~ $PosR = IG_GetPosBS($PosX,$PosY) ;~ _GDIPlus_GraphicsDrawImageRect($GfxCtxt, $IMG, $PosR[0], $PosR[1], _ ;~ NormalizeGraphicsN($DefSize*$SizeX,0), NormalizeGraphicsN($DefSize*$SizeY,1)) _GDIPlus_GraphicsDrawImageRect($GfxCtxt, $IMG, $PosX, $PosY, _ $SizeX, $SizeY) _GDIPlus_GraphicsDrawLine($GfxCtxt,$PosX,$PosY,$PosX,$PosY+$SizeY) _GDIPlus_GraphicsDrawLine($GfxCtxt,$PosX,$PosY,$PosX+$SizeX,$PosY+$SizeY) _GDIPlus_GraphicsDrawLine($GfxCtxt,$PosX,$PosY,$PosX+$SizeY,$PosY) _GDIPlus_GraphicsDrawLine($GfxCtxt,$PosX+$SizeY,$PosY,$PosX+$SizeY,$PosY) ;~ Return $PosR EndFunc Func DrawText($Text,$PosX,$PosY) ;Make GDIPlus DrawString text in center ;~ $L0 = GUICtrlCreateLabel($Text,0,-25) ;~ $L0C = ControlGetPos( $GUI, "", $L0 )[2]-5 ;~ GUICtrlDelete($L0) $L0C = 0 ;~ $PosR = IG_GetPosBS($PosX,$PosY) ;~ _GDIPlus_GraphicsDrawString($GfxCtxt, $Text, $PosR[0]-$L0C/2,$PosR[1], $Font, 8.5 ) _GDIPlus_GraphicsDrawString($GfxCtxt, $Text, $PosX-$L0C/2,$PosY, $Font, 10 ) ;~ Return $PosR EndFuncImage(3x3 size): test.bmptest.bmp Edited January 7, 2016 by algiuxas Share this post Link to post Share on other sites
UEZ 1,265 Posted January 7, 2016 Add this line just after $GfxCtxt = _GDIPlus_ImageGetGraphicsContext($Bitmap) and it should work$GfxCtxt = _GDIPlus_ImageGetGraphicsContext($Bitmap) _GDIPlus_GraphicsSetPixelOffsetMode($GfxCtxt, 2) ;this line GUISetFont(8.5,400,1,$Font) 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites