Inkplate 5v2 MicroPython - Drawing Graphics
Inkplate 5v2 allows you to draw different geometric shapes anywhere on its 1280 x 720 px canvas. The shapes can be filled or hollow
Drawing Shapes
Below is a example that demonstrates how to draw basic shapes in Black-White display mode.
inkplate.BLACK use a numeric value: 0-3from inkplate5v2 import Inkplate
import time
inkplate = Inkplate(Inkplate.INKPLATE_1BIT)
inkplate.begin()
inkplate.clearDisplay()
inkplate.display()
inkplate.drawPixel(100, 100, inkplate.BLACK)
inkplate.drawRect(50, 50, 75, 75, inkplate.BLACK)
inkplate.drawCircle(200, 200, 30, inkplate.BLACK)
inkplate.fillCircle(300, 300, 30, inkplate.BLACK)
inkplate.drawFastHLine(20, 100, 50, inkplate.BLACK)
inkplate.drawFastVLine(100, 20, 50, inkplate.BLACK)
inkplate.drawLine(100, 100, 400, 400, inkplate.BLACK)
inkplate.drawRoundRect(100, 10, 100, 100, 10, inkplate.BLACK)
inkplate.fillRoundRect(10, 100, 100, 100, 10, inkplate.BLACK)
inkplate.drawTriangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)
inkplate.display()
inkplate.drawPixel()
Set a single pixel in the frame buffer.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | X coordinate. |
Number | y | Y coordinate. |
Const | color | Color constant (BLACK or WHITE in BW mode). |
inkplate.drawRect()
Draw an unfilled rectangle outline.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | Left X. |
Number | y | Top Y. |
Number | w | Width in pixels. |
Number | h | Height in pixels. |
Const | color | Outline color. |
inkplate.drawCircle()
Draw an unfilled circle.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x0 | Center X. |
Number | y0 | Center Y. |
Number | r | Radius in pixels. |
Const | color | Outline color. |
inkplate.fillCircle()
Draw a filled circle.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x0 | Center X. |
Number | y0 | Center Y. |
Number | r | Radius in pixels. |
Const | color | Fill color. |
inkplate.drawFastHLine()
Draw a horizontal line quickly.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | Start X. |
Number | y | Y position. |
Number | w | Line width in pixels. |
Const | color | Line color. |
inkplate.drawFastVLine()
Draw a vertical line quickly.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | X position. |
Number | y | Start Y. |
Number | h | Line height in pixels. |
Const | color | Line color. |
inkplate.drawLine()
Draw a line from one point to another.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x0 | Start X. |
Number | y0 | Start Y. |
Number | x1 | End X. |
Number | y1 | End Y. |
Const | color | Line color. |
inkplate.drawRoundRect()
Draw an unfilled rectangle with rounded corners.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | Left X. |
Number | y | Top Y. |
Number | w | Width in pixels. |
Number | h | Height in pixels. |
Number | radius | Corner radius in pixels. |
Const | color | Outline color. |
inkplate.fillRoundRect()
Draw a filled rectangle with rounded corners.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x | Left X. |
Number | y | Top Y. |
Number | w | Width in pixels. |
Number | h | Height in pixels. |
Number | radius | Corner radius in pixels. |
Const | color | Fill color. |
inkplate.drawTriangle()
Draw a triangle outline using three vertices.
Function parameters:
| Type | Name | Description |
|---|---|---|
Number | x0 | Vertex A X. |
Number | y0 | Vertex A Y. |
Number | x1 | Vertex B X. |
Number | y1 | Vertex B Y. |
Number | x2 | Vertex C X. |
Number | y2 | Vertex C Y. |
Const | color | Outline color. |
