Difference between revisions of "Legacy:ApplyColorMask"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110803213334/http://www.spheredev.org/wiki/ApplyColorMask)
 
(filled)
 
Line 1: Line 1:
 
 
 
Fills the whole screen with the given color.
 
Fills the whole screen with the given color.
  
Line 6: Line 4:
  
 
==Usage==
 
==Usage==
{{Usage|returns={{{returns}}}|object={{{object}}}|func=ApplyColorMask|params=color}}
+
{{Usage|func=ApplyColorMask|params=color}}
  
* '''param1''' type. param1 description
+
* '''color''' Sphere [[API:Color|Color]] object. Color to tint the screen with
* '''param2''' type. param2 description
 
* '''paramN''' type. paramN description
 
  
 
==Examples==
 
==Examples==
(examples with syntaxhighlighted code)
+
<syntaxhighlight>
 +
// 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();
 +
</syntaxhighlight>
 +
 
 +
The above shows a general usage scenario in using [[API:ApplyColorMask|ApplyColorMask]]().
  
 
==Notes==
 
==Notes==
(notes)
+
* The alpha value of the <var>color</var> 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 [[API:Color|Color]] object provided affects each pixel on the screen as follows:
 +
*: <code>new_red = old_red + (new_red - old_red) * (alpha / 255)</code>
 +
*: <code>new_green = old_green + (new_green - old_green) * (alpha / 255)</code>
 +
*: <code>new_blue = old_blue + (new_blue - old_blue) * (alpha / 255)</code>
 +
* This function should be similar in behavior to using <code>[[API:Rectangle|Rectangle]](0, 0, [[API:GetScreenWidth|GetScreenWidth]](), [[API:GetScreenHeight|GetScreenHeight]](), color)</code>, where the <var>color</var> 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 [[API:ApplyColorMask|ApplyColorMask]]() every frame.
 +
 
  
 
==See also==
 
==See also==
* see also
+
* [[API:CreateColor|CreateColor]]()
* see also
+
* [[API:Color|Color]] object
* see also
+
* [[API:FlipScreen|FlipScreen]]()
* etc
+
* [[API:GetScreenHeight|GetScreenHeight]]()
 +
* [[API:GetScreenWidth|GetScreenWidth]]()
 +
* [[API:Rectangle|Rectangle]]()
  
 
{{API:Video/navbox}}
 
{{API:Video/navbox}}

Latest revision as of 00:50, 14 June 2013

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