fillRect()
[Graphics]
void fillRect (int x, int y, int width, int height);
Description
Draws a filled rectangle on the chip.
Parameters
x
: the x-coordinate of the center of the rectangle.
y
: the y-coordinate of the center of the rectangle.
width
: the width of the rectangle.
height
: the height of the rectangle.
Returns
Nothing.
Example Code
The code draws a filled rectangle in the center of the chip, with a width of 10 pixels and a height of 20 pixels.
void setup() {
int width = chipWidth(); // gets the width of the chip
int height = chipHeight(); // gets the height of the chip
// draws a filled rectangle in the center of the chip, with a
// width of 10 pixels and a height of 20 pixels
(width / 2, height / 2, 10, 20);
fillRect}
void loop() {
}
Notes and Warnings
All coordinates must be inside the chip boundaries, use the functions
chipWidth()
and chipHeight()
to get the chip
dimensions.