Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BitBlt(,,,,,,,,dwRop)

0 views
Skip to first unread message

William

unread,
Mar 14, 2006, 1:56:55 AM3/14/06
to
Env: VC++6.00

I am making bitmap(8bit depth DIB format) pasting operation from clipboard
to my app.

One of pasting mode I need is as follows,
only these positions whose color = 0 on destination bitmap will be changed
by source bitmap(here is clipboard).
That is to say, if color != 0, color will keep unchanged.

Can I do that by BitBlt(,,,,,,,,dwRop)?
If yes, how should I set dwRop parameter?

TIA

William

John Carson

unread,
Mar 16, 2006, 7:41:38 AM3/16/06
to
"William" <po...@mx15.freecom.ne.jp> wrote in message
news:OaCWBSzR...@TK2MSFTNGP10.phx.gbl

I don't believe BitBlt can do it directly.

What you could do is the following. Get the "destination" bitmap and the
"source" bitmap into memory device contexts (making whatever conversions are
necessary). Then use TransparentBlt to copy from the "destination" memory DC
to the "source" memory DC using black as the transparent color. The result
of this will be that the "source" memory DC has the "destination's"
non-black pixels and retains its own pixels where the "destination" is
black. This would seem to be the combination you are after.

For Windows version where TransparentBlt doesn't exist or leaks memory, you
can use the following workaround:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B79212


--
John Carson


William

unread,
Mar 19, 2006, 7:04:10 PM3/19/06
to
Thanks John Carson.
I will try it.
William

Feng Yuan [MSFT]

unread,
Apr 26, 2006, 3:01:26 AM4/26/06
to
You should use StretchDIBits when working with DIB.

If the source bitmap is only black and white, you can use a single
StretchDIBits call with the right ROP; otherwise you need to read the source
bitmap first.

Feng Yuan

0 new messages