Supported Browsers Home   
SPR_mgrAddOpaqueBitmap Previous   
SPR_mgrEmpty Next   
External Functions Up   

SPR_mgrAddTransparentBitmap

Adds a source transparent bitmap to the Sprite Manager

Declaration

SPR_bitmap * MGLAPI SPR_mgrAddTransparentBitmap(
    SPR_bitmapManager *mgr,
    bitmap_t *bmp,
    color_t transparent)

Prototype In

gm/sprite.h

Parameters

mgr

Bitmap manager to add sprite to

bmp

MGL bitmap to add to the Sprite Manager

transparent

Transparent color for the bitmap

 

Return Value

Pointer to the loaded sprite object

Description

This function adds a new transparent bitmap to the Sprite Manager. When you add the bitmap, the Sprite Manager takes over ownership of the memory allocated to the bitmap and you must not call MGL_unloadBitmap on the bitmap to free the memory. Once the bitmap has been added, you can then draw the bitmap by calling SPR_draw and pass in the pointer to the bitmap returned by this function.

Note that the transparent color you pass in is a source transparent color, which means that pixels in the source bitmap that match the transparent color will not be drawn when you call SPR_draw for the returned sprite object (ie: they are transparent).

Note:    The bitmap added to the Sprite Manager must be in the same format at the device context that the bitmaps will be copied to. Hence you should add code to your program to do any necessary conversions to the destination pixel format for the bitmaps (see the Fox & Bear sample program which contains code to do this).

Note:    The Sprite Manager also maintains ownership of the SPR_bitmap object that is returned by this function, and this object will be destroyed automatically when you empty or exit the Sprite Manager. You can call SPR_destroyBitmap if you wish to destroy the bitmap.

See Also

SPR_mgrAddOpaqueBitmap, SPR_draw, SPR_mgrEmpty, SPR_destroyBitmap

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