Drawing graphics
Inkplate 6 MOTION allows you to draw graphics on a 1024x758px canvas.
Adafruit GFX Library
The core graphics library for Inkplate MOTION, created by Adafruit.
Drawing Geometric Shapes
Below is an example demonstrating functions used for drawing graphics on the Inkplate 6 MOTION:
BLACK
or WHITE
. In grayscale mode, use values from 0 to 15. Refer to the display modes page for more details.inkplate.begin(INKPLATE_BLACKWHITE); // Initialize Inkplate
// Draw a single pixel
inkplate.drawPixel(100, 50, BLACK);
// Draw a line
inkplate.drawLine(0, 0, 1023, 757, BLACK);
// Draw a rectangle
inkplate.drawRect(300, 300, 400, 300, BLACK);
// Draw a filled rectangle
inkplate.fillRect(300, 300, 400, 300, BLACK);
// Draw a circle
inkplate.drawCircle(512, 379, 75, BLACK);
// Draw a filled circle
inkplate.fillCircle(512, 379, 75, BLACK);
// Draw a rounded rectangle
inkplate.drawRoundRect(300, 300, 400, 300, 10, BLACK);
// Draw a filled rounded rectangle
inkplate.fillRoundRect(300, 300, 400, 300, 10, BLACK);
// Draw a triangle
inkplate.drawTriangle(300, 500, 700, 500, 512, 200, BLACK);
// Draw a filled triangle
inkplate.fillTriangle(350, 467, 650, 467, 512, 250, BLACK);
inkplate.display(); // Update the display to render the drawings
Below are the detailed references for these functions:
inkplate.drawPixel()
Draws a single pixel on the display at the specified coordinates.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the pixel. |
int | y | The y-coordinate of the pixel. |
uint8_t | color | The color of the pixel. |
inkplate.drawLine()
Draws a straight line between two points on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x0 | The x-coordinate of the starting point. |
int | y0 | The y-coordinate of the starting point. |
int | x1 | The x-coordinate of the ending point. |
int | y1 | The y-coordinate of the ending point. |
uint8_t | color | The color of the line. |
inkplate.drawRect()
Draws a rectangle outline on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the top-left corner. |
int | y | The y-coordinate of the top-left corner. |
int | width | The width of the rectangle. |
int | height | The height of the rectangle. |
uint8_t | color | The color of the rectangle outline. |
inkplate.fillRect()
Draws a filled rectangle on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the top-left corner. |
int | y | The y-coordinate of the top-left corner. |
int | width | The width of the rectangle. |
int | height | The height of the rectangle. |
uint8_t | color | The fill color. |
inkplate.drawCircle()
Draws a circle outline on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the circle center. |
int | y | The y-coordinate of the circle center. |
int | radius | The radius of the circle. |
uint8_t | color | The color of the circle outline. |
inkplate.fillCircle()
Draws a filled circle on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the circle center. |
int | y | The y-coordinate of the circle center. |
int | radius | The radius of the circle. |
uint8_t | color | The fill color. |
inkplate.drawRoundRect()
Draws a rounded rectangle outline on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the top-left corner. |
int | y | The y-coordinate of the top-left corner. |
int | width | The width of the rectangle. |
int | height | The height of the rectangle. |
int | radius | The radius of the rounded corners. |
uint8_t | color | The color of the rectangle outline. |
inkplate.fillRoundRect()
Draws a filled rounded rectangle on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x | The x-coordinate of the top-left corner. |
int | y | The y-coordinate of the top-left corner. |
int | width | The width of the rectangle. |
int | height | The height of the rectangle. |
int | radius | The radius of the rounded corners. |
uint8_t | color | The fill color. |
inkplate.drawTriangle()
Draws a triangle outline on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x0 | The x-coordinate of the first vertex. |
int | y0 | The y-coordinate of the first vertex. |
int | x1 | The x-coordinate of the second vertex. |
int | y1 | The y-coordinate of the second vertex. |
int | x2 | The x-coordinate of the third vertex. |
int | y2 | The y-coordinate of the third vertex. |
uint8_t | color | The color of the triangle outline. |
inkplate.fillTriangle()
Draws a filled triangle on the display.
Returns: none
Function parameters:
Type | Name | Description |
---|---|---|
int | x0 | The x-coordinate of the first vertex. |
int | y0 | The y-coordinate of the first vertex. |
int | x1 | The x-coordinate of the second vertex. |
int | y1 | The y-coordinate of the second vertex. |
int | x2 | The x-coordinate of the third vertex. |
int | y2 | The y-coordinate of the third vertex. |
uint8_t | color | The fill color. |
Full examples
Inkplate_6_Motion_Simple_BW
Example on how to draw simple graphics in black and white mode
Inkplate_6_Motion_Simple_Grayscale
Example on how to draw simple graphics in grayscale