Loading several bitmaps into a DC

Started by
4 comments, last by Lalle 22 years, 10 months ago
How do I load several bitmaps into a DC before I draw it on the screen? If not possible could you tell me another way to draw more than one bitmap on the screen at the same time in win32? I'm using C++. Thanks Lalle Edited by - Lalle on June 8, 2001 10:25:27 AM
Advertisement
Are you using DirectX?

"You call him Dr. Grip, doll!"
"You call him Dr. Grip, doll!"
i don''t know much about the win32 api, but isn''t it possible to load your bitmaps into memory DCs, and then perform the blit to the screen from them?
No I''m not using DX.
You can only load one bitmap into a memory DC, but I need to load several into it.
Maybe you could load a bitmap into DC nr. 1 and then load DC nr.1
into DC nr. 2 or something?
Or is there another way to do it?
You can only have one bitmap in a DC. You can copy other bitmaps into your current DC from another DC by BitBlt, which is pretty standard stuff (everybody at least does that for double-buffering).

Here''s my cheezy analogy:
The DC is like an artist''s easel. When you make a DC, you pretty much just have the easel, nothing else. If you select a bitmap into it, that''s like putting a canvas on the easel. And then you can select your drawing tools to use on the easel as well.

Now it makes sense that there''s only one canvas per easel. You can also copy another canvas onto your own (BitBlt). The weird thing is, you can''t do this without another easel (a second DC). Think of BitBlt like an artist who has two paintings on two easels in front of him, and he''s looking at one while copying it to the other. Or he can copy lots of paintings onto his current canvas--you just need to put each one on the other easel before you do it (or you can have 10 easels, and copy from each onto your own canvas). The key thing is that you can''t even look at a painting without an easel, much less draw on it.

So, back into programming terms, what you need to do is select each bitmap you want copied onto a DC (can re-use the same one or create one for each), and then BitBlt it onto your DC.
Thanks alot for all your replies, no more screen flickering!

This topic is closed to new replies.

Advertisement