|
SpriteTint | |
SpriteTint ThisSprite, ThisRGB | |
Parameters: ThisSprite = The Sprite that you want to change the diffuse colouring of ThisRGB = The RGB colour that the sprite will be tinted with. Default is ARGB(255,255,255,255) |
|
Returns: NONE | |
SpriteTint sets the sprites base Tint (diffuse) colour. Changing the tint colour allows us to dynamically alter the colouring of the sprites image (See SpriteImage), without changing the image itself. The tint process can be quite an expensive one. Basically each pixel in the sprites are being sepreately multiplied by the Sprites Tint colour prior to being drawn. All this multiplication adds some extra overhead to the sprite. You can emulate the process yourself, by running through an image and reading each pixel colour from the image (Point), then applying RgbAlphaMULT to it, then drawing it back. Since the sprite images colour channels are multiplied separately, we can think of the tint colour as scalars for the separate R,G,Bs in the image. So setting the Tint colour of RGB(255,255,0), will leave the R & G channels as is, but completely remove the B channel from it. Setting Tint to RGB(128,128,128) will reduce the colours by half. Bellow we have some examples of how the tint values alters the output. The top left is the sprite with the default tint. In this mode the rendering engine just draws the image as is. Then we're applying various tint values to the rest of sprites. FACTS: * Sprites default tint colour is ARGB(255,255,255,255) (white). * When a tinted sprite is drawn, the sprites image pixels are each multiplied by the tint colour. This can impact really render performance on big sprites, so it's best used sparingly. * See SpriteDrawMode for more effects that can be combined with sprite tint. * Tint and be used with control the ALPHA LEVEL when the sprites using an AFX formatted image. Mini Tutorial: |
|
Example Source: Download This Example
|
Related Info: | GetSpriteTint | SpriteDrawMode : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |