FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to keep IMAGE-quality using => ResizeBmp(... ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

How to keep IMAGE-quality using => ResizeBmp(... ?

Posted: Tue Jun 29, 2010 01:42 PM
Hello,

Is there a way, to keep the Quality of a resized Image, used as Brush ?
It works, but the Quality is very bad.
Maybe there is still another Solution ?

DEFINE IMAGE oTmp FILENAME c_path + "\SYSTEM\" + W_IMAGE
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, 580, 400 ) )


Brush called from Dialog
DEFINE DIALOG oDlg FROM 150, 150 TO 520, 650 PIXEL ICON oIco BRUSH oBrush



Using :
DEFINE BRUSH oBrush FILENAME c_path + "\SYSTEM\" + W_IMAGE
the Quality is OK, but I have to adjust the Image to the Dialog

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: How to keep IMAGE-quality using => ResizeBmp(... ?

Posted: Tue Jun 29, 2010 01:59 PM

Uwe:

ResizeBmp( oTmp:hBitmap, 580, 400, .T. ) // last parameter switch to max Quality, by default is FALSE

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to keep IMAGE-quality using => ResizeBmp(... ?

Posted: Tue Jun 29, 2010 02:24 PM
Daniel,

Thank You very much.
I added .T. but there is no difference. I tested with another Image ( Jpg )

Defined as WINDOW-Background



from inside the same Image used as DIALOG-Background



Maybe the Parameter .T. doesn't work ?
DEFINE IMAGE oTmp FILENAME c_path + "\SYSTEM\" + W_IMAGE
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, 580, 400 ), .T. )

DEFINE DIALOG oDlg FROM 150, 150 TO 520, 650 PIXEL ICON oIco BRUSH oBrush ;
TITLE "Transparent STSAY on Dialog from code"

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM

Re: How to keep IMAGE-quality using => ResizeBmp(... ?

Posted: Tue Jun 29, 2010 03:10 PM
Uwe:

Daniel Garcia-Gil wrote:ResizeBmp( oTmp:hBitmap, 580, 400, .T. ) // last parameter switch to max Quality, by default is FALSE


the parameter is to ResizeBmp no to Brush

oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, 580, 400, .T. ) )
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to keep IMAGE-quality using => ResizeBmp(... ?

Posted: Tue Jun 29, 2010 04:01 PM
Daniel,

Thank You very much. It works perfect now.

My Final working Solution to adjust the Image ( Brush ) to Dialog-Size :

STATIC FUNCTION FDIALOG()
LOCAL oDlg, oBrush, oTmp
...
...
DEFINE DIALOG oDlg FROM 150, 150 TO 520, 650 PIXEL ICON oIco BRUSH oBrush ;
TITLE "Transparent STSAY on Dialog from code"

// used after Dialog-define, to get Dialog-Size for Brush-resizing
// ------------------------------------------------------------------------
DEFINE IMAGE oTmp FILENAME c_path + "\SYSTEM\" + W_IMAGE
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oDlg:nWidth, oDlg:nHeight, .T. ) )
oDlg:Setbrush( oBrush )
Release Brush oBrush

ACTIVATE DIALOG oDlg ;
ON INIT oDlg:Move( 120, 120, oDlg:nWidth, oDlg:nHeight, .f. )

RETURN NIL


With Resources works different :

...
ACTIVATE DIALOG oDlg ;
ON INIT ( oDlg:Move( 120, 120, oDlg:nWidth, oDlg:nHeight, .f. ), ;
RES_BRUSH( oDlg ) )
RETURN( NIL )

// -------------------

FUNCTION RES_BRUSH(oDlg)
LOCAL oBrush, oTmp

DEFINE IMAGE oTmp FILENAME c_path + "\SYSTEM\" + W_IMAGE
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oDlg:nWidth, oDlg:nHeight, .T. ) )
oDlg:Setbrush( oBrush )
Release Brush oBrush

RETURN ( NIL )




This Solution solved another Problem :



DEFINE IMAGE oTmp FILENAME c_path + "\SYSTEM\" + W_IMAGE
oBrush5 := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, oDlg9:nWidth / 2, oDlg9:nHeight, .T. ) )
oDlg9:Setbrush( oBrush5 )
Release Brush oBrush5

Working on this Post, a few times a got a Forum-error :




Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion