|
SpriteMaskColourCompression | |
SpriteMaskColourCompression ThisSprite, Mode | |
Parameters: ThisSprite = The sprite you wish to change the mask colour compression mode on Mode = The sprites maskcolour compression mode (0= OFF, 1= ON) |
|
Returns: NONE | |
SpriteMaskColourCompression lets us change the MaskColour compression mode of this sprite. What is MaskColour Compression ? Maskcolour compression is a special mode in which the sprite rendering engine uses to temporally pre-compress the sprites transformed(rotated/scaled) image. Once the image is in this temporally compressed state, we can then apply effects such tint or gouraud etc etc to the pixels without them altering the mask colour. What this does is it helps the render engine remove any redundant strips of pixels prior to applying effects. Adding effects can be pretty expressive, so we want to make sure we're not drawing anything that isn't going to be visible. Since MaskCOlour compression is ON(1) by default, seeing it's effect is difficult to see. However if you turn the Sprites transparent flag to off, then apply an effect such as SpriteTint to our sprite, you should see that the tinting only effects the pixels that are not MaskColour. If we turn mask colour compression off, then the tint will effect all the pixels in the sprite regardless. Possible Usage If you wondering why this is useful, then imagine you have a image with a mask colour $00ff00ff. Lets say you're clever an decide that rather than rotate or colour this image every frame you're going to buffer it into an animation. Reducing it's cost at run time. So your program outputs the buffered version, rather than bothering transform and apply effects to the source constantly. Which is a complete waste of time if you think about it. Now if you render the source image to a cache (another image), then we have to preserve the mask colour. This means clearing the cache image with the mask colour first then drawing the transparent version over it. This means the cost per pixel is potentially *2 due to the clear + render pass. However, with the compressed solid filler, the clear pass may not be necessary (assuming the source is big enough to fill the destination) Since the mask colour is preserved during the render and only 'solid' are processed. FACTS: * SpriteMaskColourCompression is ON(1) by default. * When SpriteMaskColourCompression is ON, the MaskColour in the sprites image will not be altered by preposting sprite draw modes, such as Tint, AlphaAdd,AlphaMult, Gouraud, even when SpriteTransparent is set to OFF. Disable SpriteMaskColourCompression if that's that you want. |
|
Example Source: Download This Example
|
Related Info: | SpriteDrawMode | SpriteTransparent : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |