Difference between revisions of "Gb.display.setColor"

From Gamebuino Wiki
Jump to: navigation, search
(Description: INVERT doesn't work with circles)
(gray added)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
Changes the color used to draw on the screen by all the display functions.
 
Changes the color used to draw on the screen by all the display functions.
  
The colors can be either <code>WHITE</code>, <code>BLACK</code> or <code>INVERT</code>.
+
The colors can be either <code>WHITE</code>, <code>BLACK</code>, <code>GRAY</code> or <code>INVERT</code>.
  
 
Most of the display functions only have one color, the foreground color. But some functions also have a background color:
 
Most of the display functions only have one color, the foreground color. But some functions also have a background color:
Line 17: Line 17:
  
 
== Parameters ==
 
== Parameters ==
* foregroundColor : <code>WHITE</code>, <code>BLACK</code> or <code>INVERT</code>
+
* foregroundColor : <code>WHITE</code>, <code>BLACK</code>, <code>GRAY</code> or <code>INVERT</code>
* backgroundColor ''(optional)'' : <code>WHITE</code>, <code>BLACK</code> or <code>INVERT</code>. If no background color is specified, the background is transparent.
+
* backgroundColor ''(optional)'' : <code>WHITE</code>, <code>BLACK</code>, <code>GRAY</code> or <code>INVERT</code>. If no background color is specified, the background is transparent.
  
 
== Returns ==
 
== Returns ==
Line 24: Line 24:
  
 
== Example ==
 
== Example ==
 +
<gistit>https://github.com/Rodot/Gamebuino/blob/beta/libraries/Gamebuino/examples/5.Reference/display/color/color.ino</gistit>
  
 
== See also ==
 
== See also ==

Latest revision as of 2015-04-06T10:52:39

Description

Changes the color used to draw on the screen by all the display functions.

The colors can be either WHITE, BLACK, GRAY or INVERT.

Most of the display functions only have one color, the foreground color. But some functions also have a background color:

INVERT color won't work with the drawCircle and fillCircle function, because the algorithm they use passes several times over the same pixel, so the color will toggle several times and be inconsistent.

Syntax

gb.display.setColor(foregroundColor, backgroundColor);

Parameters

  • foregroundColor : WHITE, BLACK, GRAY or INVERT
  • backgroundColor (optional) : WHITE, BLACK, GRAY or INVERT. If no background color is specified, the background is transparent.

Returns

none

Example

See also