Legacy:ApplyColorMask

From Spherical
Revision as of 00:50, 14 June 2013 by Apollolux (talk | contribs) (filled)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Fills the whole screen with the given color.

Usage

ApplyColorMask(color);


  • color Sphere Color object. Color to tint the screen with

Examples

// Draw stuff to be tinted here.
// ...

// Tint screen bluish.
// Note alpha (last parameter) is between 0 and 255.
ApplyColorMask(CreateColor(0, 0, 255, 128));

// Draw stuff you don't want tinted.
// ...

// Make it all visible
FlipScreen();

The above shows a general usage scenario in using ApplyColorMask().

Notes

  • The alpha value of the color argument affects the 'strength' of the screen tint. Zero (0) represents no tint, while 255 makes the color completely opaque over the screen, obscuring all of video surface. A value in-between will provide what most users are after.
  • As with all blend style drawing functions, the alpha value of the Color object provided affects each pixel on the screen as follows:
    new_red = old_red + (new_red - old_red) * (alpha / 255)
    new_green = old_green + (new_green - old_green) * (alpha / 255)
    new_blue = old_blue + (new_blue - old_blue) * (alpha / 255)
  • This function should be similar in behavior to using Rectangle(0, 0, GetScreenWidth(), GetScreenHeight(), color), where the color arguments match up.
  • Using this function only applies the effect once for each call. To make it take effect continuously, you will need to call ApplyColorMask() every frame.


See also

API:Video/navbox