Skip to main content

Inkplate 5V2 – Drawing graphics

Inkplate 5V2 allows you to draw graphics on a 1280 x 720px canvas.

ℹ️
Adafruit GFX is the graphics library included in the Inkplate library for drawing graphics. For more details, refer to the official repository:

Adafruit GFX Library

The core graphics library for Inkplate library, created by Adafruit.


Drawing Geometric Shapes

Below is an example demonstrating the functions used for drawing graphics on the Inkplate 5V2:

ℹ️
The color parameter in these functions depends on the display mode. In black-and-white mode, use BLACK or WHITE. In grayscale mode, use values from 0 to 7. Refer to the display modes page for more details.
#include "Inkplate.h"
Inkplate inkplate(INKPLATE_3BIT);
void setup() {
inkplate.begin();
inkplate.clearDisplay();
inkplate.display();
// Draw a pixel
inkplate.drawPixel(100, 50, 0);
// Draw a line
inkplate.drawLine(0, 0, 1023, 757, 1);
// Draw a rectangle
inkplate.drawRect(100, 100, 200, 200, 2);
// Draw a filled rectangle
inkplate.fillRect(300, 100, 200, 300, 3);
// Draw a circle
inkplate.drawCircle(512, 100, 75, 4);
// Draw a filled circle
inkplate.fillCircle(512, 100, 75, 5);
// Draw a rounded rectangle
inkplate.drawRoundRect(310, 300, 400, 300, 10, 4);
// Draw a filled rounded rectangle
inkplate.fillRoundRect(310, 300, 400, 300, 10, 3);
// Draw a triangle
inkplate.drawTriangle(300, 500, 700, 500, 512, 200, 2);
// Draw a filled triangle
inkplate.fillTriangle(350, 467, 650, 467, 512, 250, 1);
// Update the display to render the drawings
inkplate.display();
}
void loop() {
}
Expected output on Inkplate display
Expected output on Inkplate display.

Below are the detailed references for these functions:

inkplate.drawPixel()

Draws a single pixel on the display at the specified coordinates.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the pixel.
intyThe y-coordinate of the pixel.
uint8_tcolorThe color of the pixel.

inkplate.drawLine()

Draws a straight line between two points on the display.

Returns value: none

Function parameters:

TypeNameDescription
intx0The x-coordinate of the starting point.
inty0The y-coordinate of the starting point.
intx1The x-coordinate of the ending point.
inty1The y-coordinate of the ending point.
uint8_tcolorThe color of the line.

inkplate.drawRect()

Draws a rectangle outline on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the top-left corner.
intyThe y-coordinate of the top-left corner.
intwidthThe width of the rectangle.
intheightThe height of the rectangle.
uint8_tcolorThe color of the rectangle outline.

inkplate.fillRect()

Draws a filled rectangle on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the top-left corner.
intyThe y-coordinate of the top-left corner.
intwidthThe width of the rectangle.
intheightThe height of the rectangle.
uint8_tcolorThe fill color.

inkplate.drawCircle()

Draws a circle outline on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the circle center.
intyThe y-coordinate of the circle center.
intradiusThe radius of the circle.
uint8_tcolorThe color of the circle outline.

inkplate.fillCircle()

Draws a filled circle on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the circle center.
intyThe y-coordinate of the circle center.
intradiusThe radius of the circle.
uint8_tcolorThe fill color.

inkplate.drawRoundRect()

Draws a rounded rectangle outline on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the top-left corner.
intyThe y-coordinate of the top-left corner.
intwidthThe width of the rectangle.
intheightThe height of the rectangle.
intradiusThe radius of the rounded corners.
uint8_tcolorThe color of the rectangle outline.

inkplate.fillRoundRect()

Draws a filled rounded rectangle on the display.

Returns value: none

Function parameters:

TypeNameDescription
intxThe x-coordinate of the top-left corner.
intyThe y-coordinate of the top-left corner.
intwidthThe width of the rectangle.
intheightThe height of the rectangle.
intradiusThe radius of the rounded corners.
uint8_tcolorThe fill color.

inkplate.drawTriangle()

Draws a triangle outline on the display.

Returns value: none

Function parameters:

TypeNameDescription
intx0The x-coordinate of the first vertex.
inty0The y-coordinate of the first vertex.
intx1The x-coordinate of the second vertex.
inty1The y-coordinate of the second vertex.
intx2The x-coordinate of the third vertex.
inty2The y-coordinate of the third vertex.
uint8_tcolorThe color of the triangle outline.

inkplate.fillTriangle()

Draws a filled triangle on the display.

Returns value: none

Function parameters:

TypeNameDescription
intx0The x-coordinate of the first vertex.
inty0The y-coordinate of the first vertex.
intx1The x-coordinate of the second vertex.
inty1The y-coordinate of the second vertex.
intx2The x-coordinate of the third vertex.
inty2The y-coordinate of the third vertex.
uint8_tcolorThe fill color.

Full example

Inkplate5V2_Black_And_White.ino

Full example using a black-and-white display mode on Inkplate 5V2.

Inkplate5V2_Grayscale.ino

Full example using grayscale display mode on Inkplate 5V2.