MGL_buildMonoMask

Create a monochrome bitmap mask given a transparent color.

Declaration

bitmap_t * MGLAPI MGL_buildMonoMask(
bitmap_t *bitmap,
color_t transparent)

Prototype In

mgraph.h

Parameters

bitmap | bitmap to build monochrome mask from
transparent | transparent color to mask out

Return Value

Pointer to allocated bitmap mask, or NULL on error.

Description

Attempts to build a monochrome bitmap mask that can be used to rasterize transparent bitmaps. This is useful for devices that have hardware BitBlt capabilities but lack hardware transparent BitBlt support. Everywhere the transparent color is found, the mask will be 0, and everywhere else it will be 1. Once you have created a monochrome bitmap mask, you can rasterize a transparent bitmap by replacing all the transparent pixels in the original bitmap with 0's, and then doing the following:

1. Set the foreground color to black and drawing the bitmap mask with MGL_putBitmapMask. Everywhere that the bitmap has data a black pixel will be used to 'punch' a hole in the display.

2. Use the MGL_bitBlt function to draw the original bitmap on the display using the MGL_OR_MODE write mode. Everywhere that a pixel is transparent in the original source bitmap, the destination will remain the same. Everywhere that a pixel is non-transparent the pixel on the destination will be replaced with the pixel in the source bitmap.

Note that only 8+ bits per pixel bitmaps are supported, and this function will fail on lower color depths.

See Also

MGL_transBltLin, MGL_putBitmapMask, MGL_bitBlt

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com