ezpresso
ezpresso

Reputation: 8126

How to get access to an internal bitmap of a window?

I am concerned after reading an article about how to render to a device context with AGG library.

The article reads:

A device context is not a real render target, it is just a data structure holding information about a render target. When you use a GDI function to render to a DC, the function will only use the DC to obtain information how and where it has to set its pixels. The actual render target is a in-memory bitmap which is selected into the device context.

The AGG library uses a bitmap buffer as a render target. I need to render graphics to the window. The most obvious way is to create a memory bitmap and BitBlt it to the window DC.

But is there a better way? Is it possible to get access to the internal bitmap of a window to render to it?

Upvotes: 1

Views: 327

Answers (1)

NGLN
NGLN

Reputation: 43649

If you do not select a bitmap into the DC by yourself, then you can obtain the current selected bitmap in that DC with GetCurrentObject(DC, OBJ_BITMAP). If the result is NULL, then you have to create and select a bitmap yourself first.

Use that bitmap handle in the AGG Attach routine.

Upvotes: 2

Related Questions