31.3. Transparent bitmaps

We have the option with the cSpriteIcon of giving it a ‘transparent background.’ The reason we’ll be interested in transparent backgrounds is that we want to have a cSpriteIcon that shows a bitmap sliding around like a little live creature. If you have two normal bitmaps pasted on the screen close to each other, then the background region of one bitmap is likely to cut an unattractive white corner out of the other bitmap’s central image.

How is this effect to be achieved? Since there is a simple way to make text and dotted line backgrounds transparent with the CDC::SetBkMode(TRANSPARENT) call, you might think it’s easy to make bitmaps have transparent backgrounds. But this is not the case. Making bitmaps with transparent ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.