|
SpriteAlphaLevel | ||
SpriteAlphaLevel SpriteIndex, AlphaLevel# | ||
Parameters: SpriteIndex = The identifier of the sprite you wish to alter of the Draw Mode of AlphaLevel# = The Alpha Blending level for this sprite. |
||
Returns: NONE | ||
SpriteAlphaLevel sets the Alpha blending level property of a sprite. For this property to take any visible effect, the sprite must be is set to render in AlphaMode (see SpriteDrawMode). Alpha Blending is a process where each pixel in the sprites image is being scaling and then added to pixel it's going to overwrite, which has been inversely scaled. This process makes the blended sprite image appear to be translucent, rather than opaque. While the process blends with the backdrop, the sprite image isn't altered. AlphaLevel Ranges (0.0 to 1.0) 0.00 = Blend is completely the background 0.25 = Blend is 75% background and 25% foreground 0.50 = Blend is 50% back and foreground 0.75 = Blend is 75% foreground and 25% background 1.00 = Blend is completely the foreground Bellow is an example of ship blending with a blue-ish coloured background. The sprite is blending by 10 percent each time through the full range of 0.0 to 1.0 and back again to 0.0. FACTS: * When AlphaLevel is set to zero. The sprite is not draw at all. * When AlphaLevel is set to one or above. The sprite will be drawn in normal BlitMode. * Drawing sprite in Alpha Mode requires that the sprites image to be stored in FX format. See PrepareFXImage, LoadFxImage * Drawing Alpha Blended sprites directly to the screen (in PlayBASIC V1.64 and bellow) can be a slow process. Due to PlayBasic needing to read video memory. This can be overcome by rendering to a screen size FX image, then transferring this image to the screen. (The attached example uses this approach) Mini Tutorial: This example creates a blank FX image, creates a new sprite, sets the sprite to alpha blend mode with a Alpha Blend Level of %50 (0.5). It then displays the sprite and the blend level.
This example would output.
|
||
Example Source: Download This Example
|
Related Info: | DrawAllSprites | DrawSprite | PrepareFXImage | SpriteDrawMode : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |