FWH 18.03 : MakeYourBitmap(...)

FWH 18.03 : MakeYourBitmap(...)

Postby nageswaragunupudi » Mon Apr 16, 2018 5:46 am

FWH 18.03 introduces a new function
FW_MakeYourBitmap( nWidth, nHeight, bDraw ) --> hBitmap


The function creates a blank bitmap with size nWidth, nHeight pixels and calls bDraw with parameters hDC, nWidth, nHeight.
In this codeblock programmer can draw/write any text, images, lines, etc on hDC. The function finally returns hBitmap consisting all the elements draw in bDraw.

Example:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oWnd, hBmp

   hBmp  := FW_MakeYourBitmap( 352, 450, { |hDC, w, h| MyBitmap( hDC, w, h ) } )

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd ON PAINT oWnd:DrawImage( hBmp )

   DeleteObject( hBmp )

return nil

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

function MyBitmap( hDC, nWidth, nHeight )

   local aRect    := { 0, 0, nHeight, nWidth }
   local oFont

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-48

   FW_DrawImage( hDC, "c:\fwh\bitmaps\olga1.jpg", aRect )
   FW_SayText( hDC, "OLGA", aRect, "LT", oFont, CLR_WHITE )
   FW_DrawImage( hDC, "c:\fwh\bitmaps\pngs\dvd.png", aRect, nil, nil, nil, nil, "B" )
   RELEASE FONT oFont

return nil
 


Image

Possibilities are unlimited.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH 18.03 : MakeYourBitmap(...)

Postby rhlawek » Wed Apr 18, 2018 7:46 pm

Nice.

Do you know how to save the resulting file as .tga format instead of .bmp?

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: FWH 18.03 : MakeYourBitmap(...)

Postby nageswaragunupudi » Wed Apr 18, 2018 10:28 pm

You need to have FreeImage.dll in the exe path.

Code: Select all  Expand view  RUN
hBmp := FW_MakeYourBitmap( ... )
FW_SaveImage( hBmp, "filename.tga" )  // FWH 18.03
DeleteObject( hBmp )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests