Hi ppl,
How I do to resize a loaded bitmap? For example:
hBmp = LoadBitmap( GetResources(), cBitmap )
hBmp is a 16x16 loaded image and I need resize it to 32x32, without display it, only resize loaded hBmp, something like:
hBmp = BitmapResize( hBmp, 32, 32 )
Thanks in advance and best regards,
Toninho.
How to resize a bitmap ?
-
- Posts: 172
- Joined: Tue Oct 18, 2005 10:01 am
Natter wrote:TImage():New( nTop, nLeft, nWidth, nHeight, cResName, cBmpFile, lNoBorder, oWnd, bLClicked, bRClicked, lScroll, lStretch, oCursor,;
cMsg, lUpdate, bWhen, lPixel, bValid, lDesign )
lStretch:=.T.
Thanks, but I need it in a different way. I need a new Handle with stretched bitmap.
Regards,
Toninho.
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
Toninho,
You have to use Windows API StretchBlt()
You have to use Windows API StretchBlt()
Last edited by Antonio Linares on Sun Nov 09, 2008 5:44 am, edited 1 time in total.
-
- Posts: 172
- Joined: Tue Oct 18, 2005 10:01 am
Re: How to resize a bitmap ?
Maybe a possible solution, to use
StretchBlt()
for the new Brush-functions in FWH-9.06, to get the Image-Brush adjusted to the Dialog ???

//--------- IMAGE - BRUSH ------------------------
STATIC FUNCTION DB_IMAGE( oDlg5, hDC, cFile )
LOCAL oBrush, oImg1
// cFile = Image-JPG-Background
DEFINE BRUSH oBrush FILE cFile
SET BRUSH OF oDlg5 TO oBrush
RELEASE BRUSH oBrush
// nWidth := oDlg5:nWidth()
// nHeight := oDlg5:nHeight()
// DEFINE IMAGE oImg1 FILENAME cFile
//oBrush := TBrush():New( , , cFile, , ) ????
RETURN NIL
The old Function with adjusted Image :

//--------- IMAGE - LOGO ------------------------
STATIC FUNCTION DL_IMAGE( oDlg5, hDC, cFile )
LOCAL oImage1
cImage := c_path + "\images\FANTASY7.jpg"
DEFINE IMAGE oImage1 FILENAME cImage
PalBmpDraw( hDC, 0, 0, oImage1:hBitmap, , oDlg5:nWidth(), oDlg5:nHeight(), , .T. )
RETURN NIL
Best Regards
Uwe
StretchBlt()
for the new Brush-functions in FWH-9.06, to get the Image-Brush adjusted to the Dialog ???

//--------- IMAGE - BRUSH ------------------------
STATIC FUNCTION DB_IMAGE( oDlg5, hDC, cFile )
LOCAL oBrush, oImg1
// cFile = Image-JPG-Background
DEFINE BRUSH oBrush FILE cFile
SET BRUSH OF oDlg5 TO oBrush
RELEASE BRUSH oBrush
// nWidth := oDlg5:nWidth()
// nHeight := oDlg5:nHeight()
// DEFINE IMAGE oImg1 FILENAME cFile
//oBrush := TBrush():New( , , cFile, , ) ????
RETURN NIL
The old Function with adjusted Image :

//--------- IMAGE - LOGO ------------------------
STATIC FUNCTION DL_IMAGE( oDlg5, hDC, cFile )
LOCAL oImage1
cImage := c_path + "\images\FANTASY7.jpg"
DEFINE IMAGE oImage1 FILENAME cImage
PalBmpDraw( hDC, 0, 0, oImage1:hBitmap, , oDlg5:nWidth(), oDlg5:nHeight(), , .T. )
RETURN NIL
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: How to resize a bitmap ?
bmpResized := ResizeBmp( hOldBmp, nNewWidth, nNewHeight )
The ResizeBmp function internally uses StretchBlt(). So using resizebmp is like using stretchblt().
So, I prefer this approach:
DEFINE BRUSH oTmp FILE cMyImage
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, nDlgWidth, nDlgHeight ) )
oTmp:End()
and assign the oBrush to the dialog, This is simple.
Maybe a possible solution, to use
StretchBlt()
for the new Brush-functions in FWH-9.06, to get the Image-Brush adjusted to the Dialog ???
The ResizeBmp function internally uses StretchBlt(). So using resizebmp is like using stretchblt().
So, I prefer this approach:
DEFINE BRUSH oTmp FILE cMyImage
oBrush := TBrush():new( ,,,, ResizeBmp( oTmp:hBitmap, nDlgWidth, nDlgHeight ) )
oTmp:End()
and assign the oBrush to the dialog, This is simple.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India