FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DC of the window
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
DC of the window
Posted: Fri Aug 12, 2022 02:39 PM

Hi,

There are several .png files. I need to get the DC of each of these files and put it in a specific position on my application window. How can I do this ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DC of the window
Posted: Fri Aug 12, 2022 04:08 PM

Dear Yuri,

A DC (device context) belongs to a window, not to a PNG file.

I guess that you have several PNG files and you want to paint them on a window, is this correct ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: DC of the window
Posted: Fri Aug 12, 2022 04:14 PM

Yes !

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DC of the window
Posted: Fri Aug 12, 2022 04:16 PM

Is it an animation ? I mean, do you want to paint them one after another, or just paint them on different locations ?

Do you need them as controls or just to paint them from the ON PAINT of the window ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: DC of the window
Posted: Fri Aug 12, 2022 04:32 PM

just paint them on different locations

just to paint them from the ON PAINT of the window

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DC of the window
Posted: Fri Aug 12, 2022 04:34 PM

oWnd:bPainted := { || oWnd:DrawImage( cPngFile, aRect )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: DC of the window
Posted: Sat Aug 13, 2022 08:21 AM

Method oWnd:DrawImage( cPngFile, aRect ) works. Is it possible to read from bitmap not all the picture, but only the required fragment ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DC of the window
Posted: Sat Aug 13, 2022 03:23 PM

Dear Yuri,

> but only the required fragment ?

A rectangular portion of it ?

what required fragment ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: DC of the window
Posted: Sat Aug 13, 2022 06:21 PM

There is a picture file of 1920x1080. For example, I need a rectangular fragment {900,500,1000,600}

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DC of the window
Posted: Sat Aug 13, 2022 10:48 PM
Natter wrote:There is a picture file of 1920x1080. For example, I need a rectangular fragment {900,500,1000,600}


Use this function:
Code (fw): Select all Collapse
function FW_TransformBitmap( hBmp, [aCrop], [nZoom], [nRotate], [nBkClr] )


Example usage:
Code (fw): Select all Collapse
hBmp := oWnd:ReadImage( cPngFile )[ 1 ]
hCropBmp := FW_TransformBitmap( hBmp, aCropRect )
DeleteObject( hBmp )
oWnd:DrawImage( hCropBmp, aRect )`
DeleteObject( hCropBmp )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: DC of the window
Posted: Sun Aug 14, 2022 10:24 AM

Yes, this is what we need.Thanks !

Continue the discussion