Difference between revisions of "Legacy:Font/getColorMask"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110803094047/http://www.spheredev.org/wiki/Font.getColorMask)
 
(filled)
 
Line 1: Line 1:
 
 
 
Get the color mask currently being used with the font.
 
Get the color mask currently being used with the font.
  
Line 6: Line 4:
  
 
==Usage==
 
==Usage==
{{Usage|returns=[[API:Color|Color]]|object=Font|func=getColorMask|params={{{params}}}}}
+
{{Usage|returns=[[API:Color|Color]]|object=Font|func=getColorMask}}
  
* '''param1''' type. param1 description
+
==Examples==
* '''param2''' type. param2 description
+
[[API:Font/getColorMask|Font.getColorMask]]() is typically used in conjunction with [[API:Font/setColorMask|Font.setColorMask]]():
* '''paramN''' type. paramN description
+
<syntaxhighlight>
 +
var font = GetSystemFont();
 +
var green = CreateColor(0, 255, 0);
 +
var red = CreateColor(255, 0, 0);
  
==Examples==
+
function game()
(examples with syntaxhighlighted code)
+
{
 +
  font.setColorMask(green);
 +
  font.drawText(0, 0, "green");
 +
 
 +
  var old_color = font.getColorMask();
 +
  font.setColorMask(red);
 +
  font.drawText(0, 15, "red");
 +
 
 +
  font.setColorMask(old_color);
 +
  font.drawText(0, 30, "green again");
 +
 
 +
  FlipScreen();
 +
  GetKey();
 +
}
 +
</syntaxhighlight>
  
 
==Notes==
 
==Notes==
(notes)
+
* To set the mask color of the font, use [[API:Font/setColorMask|Font.setColorMask]]().
  
 
==See also==
 
==See also==
* see also
+
* Sphere [[API:Font|Font]] object
* see also
+
* Sphere [[API:Color|Color]] object
* see also
+
* [[Color masking]]
* etc
+
* [[API:Font/drawText|Font.drawText]]()
 +
* [[API:Font/setColorMask|Font.setColorMask]]()
 +
* [[API:CreateColor|CreateColor]]()
 +
* [[API:FlipScreen|FlipScreen]]()
 +
* [[API:GetKey|GetKey]]()
 +
* [[API:GetSystemFont|GetSystemFont]]()
  
 
{{API:Font/navbox}}
 
{{API:Font/navbox}}

Latest revision as of 23:25, 24 June 2013

Get the color mask currently being used with the font.

Usage

Color Font.getColorMask();


Examples

Font.getColorMask() is typically used in conjunction with Font.setColorMask():

var font = GetSystemFont();
var green = CreateColor(0, 255, 0);
var red = CreateColor(255, 0, 0);

function game()
{
  font.setColorMask(green);
  font.drawText(0, 0, "green");
  
  var old_color = font.getColorMask();
  font.setColorMask(red);
  font.drawText(0, 15, "red");
  
  font.setColorMask(old_color);
  font.drawText(0, 30, "green again");
  
  FlipScreen();
  GetKey();
}

Notes

See also

API:Font/navbox