DC of the window

DC of the window

Postby Natter » Fri Aug 12, 2022 2: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 ?
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: DC of the window

Postby Antonio Linares » Fri Aug 12, 2022 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DC of the window

Postby Natter » Fri Aug 12, 2022 4:14 pm

Yes !
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: DC of the window

Postby Antonio Linares » Fri Aug 12, 2022 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DC of the window

Postby Natter » Fri Aug 12, 2022 4:32 pm

just paint them on different locations

just to paint them from the ON PAINT of the window
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: DC of the window

Postby Antonio Linares » Fri Aug 12, 2022 4:34 pm

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DC of the window

Postby Natter » Sat Aug 13, 2022 8:21 am

Method oWnd:DrawImage( cPngFile, aRect ) works. Is it possible to read from bitmap not all the picture, but only the required fragment ?
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: DC of the window

Postby Antonio Linares » Sat Aug 13, 2022 3:23 pm

Dear Yuri,

> but only the required fragment ?

A rectangular portion of it ?

what required fragment ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DC of the window

Postby Natter » Sat Aug 13, 2022 6:21 pm

There is a picture file of 1920x1080. For example, I need a rectangular fragment {900,500,1000,600}
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: DC of the window

Postby nageswaragunupudi » 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: Select all  Expand view
function FW_TransformBitmap( hBmp, [aCrop], [nZoom], [nRotate], [nBkClr] )


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

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

Re: DC of the window

Postby Natter » Sun Aug 14, 2022 10:24 am

Yes, this is what we need.Thanks !
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 93 guests