RE: Completely erasing memory DC
- From: SteveS <SteveSpencer@xxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Feb 2006 04:59:26 -0800
The DC doesn't have contents as such. It does have a bitmap (or drawing
surface) selected into it.
Typically you'll (1) create a memory dc,
(2) create a bitmap,
(3) select it into the dc,
(4) do whatever drawing you need,
(5) blit to your output dc,
(6) reselect the original bitmap (which was a 1x1 monochrome one),
(7) delete the bitmap and
(8) delete the dc.
If you want a 'clean' picture, you can use redo steps 2-7 without recreating
the DCs,
or do as Kellie suggests, and wipe it that way. An alternative is ExtTextOut
with ETO_OPAQUE flag set, and an empty string, which will fill with the
current background colour.
If the PNG is a 32bit bpp with transparency, you might want to work with
AlphaBlend or similar stuff. I do something like that with an MP3 player I
have, which fades in/out the cover art for 'now playing' track.
--
Steve S
"David Ching" wrote:
Hello, is there a way to completely erase the image within a memory device.
context, such that the device context becomes empty, just like when it was
first created?
The reason I ask is that I want to replace the contents of a memory device
context with a translucent picture I loaded from a .png file. Becomes the
picture contains areas that are not 100% opaque, painting this picture into
the device context does not erase what was there before. To the extent the
picture is transparent, the old contents of the device context remain.
I intend to use the memory device context in a call to
UpdateLayeredWindow(), so the contents need to be the translucent picture
(and ONLY the translucent picture) I want to show on the screen.
The only way I've gotten to work is by starting with a new (and empty)
memory DC each time. But this is wasteful; I want to reuse the old one. So
is there a way to clear the old memory DC of its previous contents?
Thanks,
David
http://www.dcsoft.com
- References:
- Completely erasing memory DC
- From: David Ching
- Completely erasing memory DC
- Prev by Date: Completely erasing memory DC
- Next by Date: Re: Completely erasing memory DC
- Previous by thread: Completely erasing memory DC
- Next by thread: Re: Completely erasing memory DC
- Index(es):
Relevant Pages
|
Loading