Arduboy Documentation

Drawing

Basic drawing functions

The core has many functions for drawing simple shapes such as drawPixel, drawCircle, drawRect, drawTriangle, and drawLine. The API has more details about these and similar functions.

Examples:

// X and Y are the center of the circle.
arduboy.drawCircle(10, 10, 5, WHITE);
arduboy.drawLine(1, 1, 50, 50, WHITE);

Drawing filled shapes

Almost all of the aforementioned functions also have an equivalent for drawing filled shapes: fillCircle, fillRect, fillTriangle, and fillScreen. These are used the same as their unfilled variants.

Examples:

// X and Y are the center of the circle.
arduboy.fillCircle(10, 10, 5, WHITE);
arduboy.fillRect(50, 50, 75, 60, WHITE);

Drawing lines

The library offers a drawLine(x1, x2, y1, y2, color) function for drawing arbitrary lines. However there are specialized functions if you need to draw horizontal or vertical lines, called drawFastVLine and drawFastHLine. It is preferable to use these if you can.

As shown below, these functions take one less argument as they only require a starting point and a length to indicating how far to draw the line.

arduboy.drawFastHLine(10, 10, 50, WHITE);
arduboy.drawFastVLine(10, 10, 50, WHITE);