PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

co-operating with GDI

Just getting started with GapiDraw...I have a bunch of sprites that I'd like to update with GDI and then composite with GapiDraw.

I suppose I create the sprite surfaces with GapiDraw and then use GetDC to access them from GDI. Is that right?

Can I hang on to the DC handles I get from GetDC indefinitely? Or need I call ReleaseDC often - it seems a bit expensive?
Hi,

What you suggest is not recommended use of GapiDraw. I would recommend using GapiDraw for your entire background and then use GetDC on the background. Calling GetDC on surfaces might be really slow in some cases, and it will lock the surface for all operations (such as CGapiSurface::DrawLine etc) so you cannot hold on to the DC.

Check the GDIDemo sample for an example on how to use GapiDraw in GDI mode - GapiDraw should ideally be responsible for the entire back buffer.

//Johan
Thanks for the reply.

I'd like to use GDI to e.g. occasionally update text into the sprites, but then use gapidraw to move and fade the sprites.

Is there no trick to get around this? Multiple GapiDisplays as sprites? Cases where GetDC won't do a copy?

It seems logical to me to want richer but slower GDI based drawing libraries to draw offscreen, and not have to draw every frame.