Color 0 transparent blit
I've been going nuts today trying to do what I thought was a simple graphics
operation but which just doesn't seem to want to work. Basically, given a
source with some pixels set to Color 0 (the background color), I want to be
able to copy all the pixels which are NOT that color over top of another image.
Like So:
Where '#' is source imagery, '+' is dest imagery, and '-' is Color 0 pixels:
Source Original Dest Result
—-#—- +++++++++ ++++#++++
—###— +++++++++ +++###+++
–#####– +++++++++ ++#####++
—###— +++++++++ +++###+++
—-#—- +++++++++ ++++#++++
Now, I've tried to do this a number of ways. Simply ClipBlitting it with a
minterm of 0x60 didn't seem to me as likely, but that was labeled a "cookie
cut" blit, so I tried it, with awful results. (I suspect it did what I wanted,
but on a per-bit-plane basis, so that not every bitplane was overwritten with
the source imagery…)
I tried using BltMaskBitMapRastPort with a minterm of 0xC0, which I thought
would do the job correctly, and it did indeed copy the exact Source imagery
into the destination correctly, but it seems to change the area not covered by
the mask to something else also. (I'm not sure what, exactly – the remaining
destination bits all seem to be set to a solid color, NOT Color 0…)
Since this has been giving me a headache and I'm packing it in for the
afternoon, I figured I'd post a message here to see if anyone else has done
this and can help. I know it's possible – Deluxe Paint, for example, uses it
all over the place with it's brushes…
–>Steve Bennett