MaskImage3D sprite,red,green,blue[,totalframes]

Parameters

sprite - handle of existing sprite

red - the red color value (0-255)
green -the green color value (0-255)
blue - the blue color value (0-255)

totalframes (optional) - total number of frames in an animated sprite (created with the LoadAnimImage3D() function)

Description

By default sprite textures use a mask color of 0,0,0 (black).
This command lets you apply a new mask to the sprites texture.
It works in the same manner as the 2D MaskImage command.

Example:

mysprite=LoadImage3D("TeddyBear_YellowBackground.bmp")
MaskImage3D mysprite,255,255,0 ; mask out the yellow background.

The optional totalframes parameter is used for animated sprites created with LoadAnimImage3D()
Just supply the same total number of frames as you do when loading the sprite:

TOTALFRAMES=24
myanimsprite=LoadAnimImage3D("sprite.png",TOTALFRAMES)
MaskImage3D myanimsprite ,255,255,0 , TOTALFRAMES

** Note. The MaskImage3D command will not work well on jpeg images due to compression. Use png/bmp files etc...

Thanks go to BlitzSupport for this function.

Example

Include "Sprite Control.bb"

SpriteGraphics3D 640,480

mysprite=LoadImage3D("myimage.bmp")
MaskImage3D mysprite,255,0,255

RenderWorld
Flip
WaitKey
End


Index