Inkplate 6COLOR – Drawing colorful shapes
Colorful Shapes Example

# Let's draw some shapes!
# This example will draw shapes around the upper left corner, and then rotate the screen
# This creates a symmetrical-looking pattern of various shapes
for r in range(4):
# Sets the screen rotation
display.setRotation(r)
# Drawing objects
inkplate.drawPixel(100, 100, inkplate.BLACK)
inkplate.drawRect(50, 50, 75, 75, inkplate.GREEN)
inkplate.fillRect(50, 50, 50, 60, inkplate.GREEN)
inkplate.drawCircle(200, 200, 30, inkplate.BLUE)
inkplate.fillCircle(200, 200, 15, inkplate.BLUE)
inkplate.fillCircle(300, 300, 30, inkplate.RED)
inkplate.drawFastHLine(20, 100, 50, inkplate.BLACK)
inkplate.drawFastVLine(100, 20, 50, inkplate.ORANGE)
inkplate.drawLine(100, 100, 400, 400, inkplate.ORANGE)
inkplate.drawRoundRect(100, 10, 100, 100, 10, inkplate.BLACK)
inkplate.fillRoundRect(10, 100, 100, 100, 10, inkplate.ORANGE)
inkplate.fillRoundRect(35, 125, 50, 50, 10, inkplate.BLACK)
inkplate.drawTriangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)
inkplate.fillTriangle(350, 100, 400, 175, 400, 100, inkplate.YELLOW)
# Reset the rotation
display.setRotation(0)
# Show on the display
display.display()
inkplate.setRotation()
Sets the rotation of the screen, adjusting the (x, y) coordinate origin point
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | Value from 0 to 3 (1 rotates by 90 degrees, 2 by 180 degrees, 3 by 270 degrees, 0 is default rotation) |
inkplate.drawPixel()
Sets pixel data on given (x, y) position
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | c | Pixel color |
inkplate.drawRect()
Function to draw a rectangle
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | width | Rectangle width |
int | height | Rectangle height |
int | c | Rectangle color |
inkplate.drawCircle()
Function to draw a circle
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | r | Circle radius |
int | c | Circle color |
inkplate.fillCircle()
Function to draw a filled circle with specified color
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | r | Circle radius |
int | c | Circle fill color |
inkplate.drawFastHLine()
Function to draw a horizontal line
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X start coordinate |
int | y | Y start coordinate |
int | width | Line width to set how many pixels to draw |
int | c | Line color |
inkplate.drawFastVLine()
Function to draw a vertical line
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | width | Line width to set how many pixels to draw |
int | c | Line color |
inkplate.drawLine()
Function to draw a line from start to end
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x0 | X coordinate for first point |
int | y0 | Y coordinate for first point |
int | x1 | X coordinate for second point |
int | y1 | Y coordinate for second point |
int | width | Line width |
int | c | Line color |
inkplate.drawRoundRect()
Function to draw a rectangle with rounded edges
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | width | Rectangle width |
int | height | Rectangle height |
int | radius | Border radius |
int | c | Rectangle color |
inkplate.fillRoundRect()
Function to draw a rounded rectangled filled with specified color
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x | X coordinate |
int | y | Y coordinate |
int | width | Rectangle width |
int | height | Rectangle height |
int | radius | Border radius |
int | c | Rectangle color |
inkplate.drawTriangle()
Function to draw a triangle
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x0 | X coordinate for first point |
int | y0 | Y coordinate for first point |
int | x1 | X coordinate for second point |
int | y1 | Y coordinate for second point |
int | x2 | X coordinate for third point |
int | y2 | Y coordinate for third point |
int | c | Triangle color |
inkplate.fillTriangle()
Function to draw a triangle filled with specified color
Returns value: None
Function parameters:
| Type | Name | Description |
|---|---|---|
int | x0 | X coordinate for first point |
int | y0 | Y coordinate for first point |
int | x1 | X coordinate for second point |
int | y1 | Y coordinate for second point |
int | x2 | X coordinate for third point |
int | y2 | Y coordinate for third point |
int | c | Triangle fill color |