Skip to main content

Inkplate 13SPECTRA MicroPython - Drawing Graphics

Inkplate 13SPECTRA allows you to draw different geometric shapes anywhere on its 1600 x 1200px canvas. The shapes can be filled or hollow.


Drawing shapes

Below is a example that demonstates how to draw basic shapes in different colors.

from inkplate13SPECTRA import Inkplate
import time

inkplate = Inkplate()
inkplate.begin()
inkplate.clearDisplay()
inkplate.display()

inkplate.drawPixel(800, 600, inkplate.BLACK);

inkplate.drawRect(60, 60, 1480, 1080, inkplate.BLACK);
inkplate.drawRect(80, 80, 1440, 1040, inkplate.BLUE);
inkplate.drawRoundRect(110, 110, 1380, 980, 40, inkplate.YELLOW);

inkplate.drawLine(60, 60, 1540, 1140, inkplate.BLACK);
inkplate.drawLine(1540, 60, 60, 1140, inkplate.BLACK);

inkplate.drawFastHLine(60, 600, 1480, inkplate.RED);
inkplate.drawFastVLine(800, 60, 1080, inkplate.GREEN);

inkplate.drawCircle(400, 300, 120, inkplate.BLUE);
inkplate.fillCircle(1200, 300, 120, inkplate.GREEN);
inkplate.drawCircle(1200, 300, 120, inkplate.BLACK);

inkplate.fillRoundRect(220, 760, 420, 300, 35, inkplate.YELLOW);
inkplate.drawRoundRect(220, 760, 420, 300, 35, inkplate.BLACK);

inkplate.fillRect(980, 760, 420, 300, inkplate.WHITE);
inkplate.drawRect(980, 760, 420, 300, inkplate.BLACK);

inkplate.drawTriangle(800, 140, 680, 360, 920, 360, inkplate.RED);
inkplate.fillTriangle(800, 520, 650, 720, 950, 720, inkplate.BLUE);
inkplate.drawTriangle(800, 520, 650, 720, 950, 720, inkplate.BLACK);

inkplate.drawFastHLine(200, 180, 1200, inkplate.YELLOW);
inkplate.drawFastHLine(200, 1020, 1200, inkplate.YELLOW);
inkplate.drawFastVLine(220, 200, 800, inkplate.BLUE);
inkplate.drawFastVLine(1380, 200, 800, inkplate.BLUE);

inkplate.fillCircle(100, 100, 18, inkplate.RED);
inkplate.fillCircle(1500, 100, 18, inkplate.GREEN);
inkplate.fillCircle(100, 1100, 18, inkplate.BLUE);
inkplate.fillCircle(1500, 1100, 18, inkplate.BLACK);

inkplate.drawRect(50, 50, 75, 75, inkplate.BLUE);
inkplate.drawCircle(200, 200, 30, inkplate.GREEN);
inkplate.fillCircle(300, 300, 30, inkplate.BLACK);
inkplate.drawFastHLine(20, 100, 50, inkplate.RED);
inkplate.drawFastVLine(100, 20, 50, inkplate.BLACK);
inkplate.drawLine(100, 100, 400, 400, inkplate.BLACK);
inkplate.drawRoundRect(100, 10, 100, 100, 10, inkplate.YELLOW);
inkplate.fillRoundRect(10, 100, 100, 100, 10, inkplate.BLACK);
inkplate.drawTriangle(300, 100, 400, 150, 400, 100, inkplate.BLACK);


inkplate.display()
Example output displayed on e-paper display
Example output displayed on e-paper display

inkplate.drawPixel()

Set a single pixel in the frame buffer.

Function parameters:

TypeNameDescription
NumberxX coordinate.
NumberyY coordinate.
ConstcolorColor constant (BLACK or WHITE in BW mode).

inkplate.drawRect()

Draw an unfilled rectangle outline.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberwWidth in pixels.
NumberhHeight in pixels.
ConstcolorOutline color.

inkplate.drawCircle()

Draw an unfilled circle.

Function parameters:

TypeNameDescription
Numberx0Center X.
Numbery0Center Y.
NumberrRadius in pixels.
ConstcolorOutline color.

inkplate.fillCircle()

Draw a filled circle.

Function parameters:

TypeNameDescription
Numberx0Center X.
Numbery0Center Y.
NumberrRadius in pixels.
ConstcolorFill color.

inkplate.drawFastHLine()

Draw a horizontal line quickly.

Function parameters:

TypeNameDescription
NumberxStart X.
NumberyY position.
NumberwLine width in pixels.
ConstcolorLine color.

inkplate.drawFastVLine()

Draw a vertical line quickly.

Function parameters:

TypeNameDescription
NumberxX position.
NumberyStart Y.
NumberhLine height in pixels.
ConstcolorLine color.

inkplate.drawLine()

Draw a line from one point to another.

Function parameters:

TypeNameDescription
Numberx0Start X.
Numbery0Start Y.
Numberx1End X.
Numbery1End Y.
ConstcolorLine color.

inkplate.drawRoundRect()

Draw an unfilled rectangle with rounded corners.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberwWidth in pixels.
NumberhHeight in pixels.
NumberradiusCorner radius in pixels.
ConstcolorOutline color.

inkplate.fillRoundRect()

Draw a filled rectangle with rounded corners.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberwWidth in pixels.
NumberhHeight in pixels.
NumberradiusCorner radius in pixels.
ConstcolorFill color.

inkplate.drawTriangle()

Draw a triangle outline using three vertices.

Function parameters:

TypeNameDescription
Numberx0Vertex A X.
Numbery0Vertex A Y.
Numberx1Vertex B X.
Numbery1Vertex B Y.
Numberx2Vertex C X.
Numbery2Vertex C Y.
ConstcolorOutline color.