The result of ResizeImg() is slightly different in width and height if compared with ResizeBmp() and PalBmpDraw().
EMG
The result of ResizeImg() is slightly different in width and height if compared with ResizeBmp() and PalBmpDraw().
EMG
Is it related to last FWH build 4 ?
Marco,
no, it was there in the previous builds too.
EMG
Unfortunately, there is no source code for ResizeImg() so I can't try to fix the problem. ![]()
EMG
Enrico,
I send you its source code by email, thanks
Antonio,
thank you. I'll do some experiment with it.
EMG
iRateW = ( DOUBLE ) iNewWidth / ( DOUBLE ) bm.bmWidth * 100 + 1;
iRateH = ( DOUBLE ) iNewHeight / ( DOUBLE ) bm.bmHeight * 100 + 1; iRateW = ( DOUBLE ) iNewWidth / ( DOUBLE ) bm.bmWidth * 100;
iRateH = ( DOUBLE ) iNewHeight / ( DOUBLE ) bm.bmHeight * 100;I spoke too fast. It GPFs, I don't know why. I continue to experiment...
EMG
iRateW = ( DOUBLE ) iNewWidth / ( DOUBLE ) bm.bmWidth * 100 + 0.9;
iRateH = ( DOUBLE ) iNewHeight / ( DOUBLE ) bm.bmHeight * 100 + 0.9;Enrico,
Could you please provide an example to test it ? thanks
#include "Fivewin.ch"
FUNCTION MAIN()
TEST( .T. )
TEST( .F. )
RETURN NIL
STATIC FUNCTION TEST( lImg )
LOCAL oDlg
DEFINE DIALOG oDlg;
STYLE NOR( WS_POPUP, WS_DLGFRAME, DS_MODALFRAME );
SIZE 800, 600
ACTIVATE DIALOG oDlg;
ON PAINT DRAWIMG( "c:\fwh\bitmaps\magic.bmp", hDC, oDlg:nWidth, oDlg:nHeight, lImg );
CENTER
RETURN NIL
STATIC FUNCTION DRAWIMG( cFile, hDC, nWidth, nHeight, lImg )
LOCAL hImg := LOADIMG( cFile )
LOCAL hImg2
IF lImg
hImg2 = RESIZEIMG( hImg, nWidth, nHeight )
ELSE
hImg2 = RESIZEBMP( hImg, nWidth, nHeight )
ENDIF
ABPAINT( hDC, 0, 0, hImg2, 255 )
DELETEOBJECT( hImg2 )
DELETEOBJECT( hImg )
RETURN NIL
STATIC FUNCTION LOADIMG( cFile )
IF !FILE( cFile )
RETURN 0
ENDIF
RETURN GDIP_IMAGEFROMFILE( cFile, .T. )Another request. ![]()
ResizeImg() is a bit slower, probably due to the two nested loops involved. How to speed it up?
EMG
Enrico,
Do you need to resize the bitmap or simply paint it larger ?
Antonio,
yes, paint it larger (or smaller). But ABPaint() doesn't support resize.
EMG
Enrico,
Not sure if we can speed up the loop