Screen Base Class
This base class defines the required screen API. The API includes all the functions that the sensor needs to render on a display, including text and geometry operations.
- class firmware.screen_base.ScreenBase
Bases:
objectThis class defines the screen API, which is uniform among all displays that can be passed to the sensor code. This defines methods for drawing text and shapes on a surface, whether real or emulated.
- BLACK = 0
Black color definition that should be overridden in derived class implementations
- BLUE = 0
Blue color definition that should be overridden in derived class implementations
- GRAY = 0
Gray color definition that should be overridden in derived class implementations
- GREEN = 0
Green color definition that should be overridden in derived class implementations
- RED = 0
Red color definition that should be overridden in derived class implementations
- WHITE = 0
White color definition that should be overridden in derived class implementations
- YELLOW = 0
Yellow color definition that should be overridden in derived class implementations
- circle(point: tuple, radius: int, color: int) None
This function draws a hollow circle at the given point and radius, with the given color
- Parameters:
point – Center point of the circle
radius – Radius of the circle
color – Color of the circle
- Returns:
Nothing
- draw_qr(y_offset: int, qr_bits: list, scale: int = 3) None
This function can render a set of bits as black and white, such as a QR code.
- Parameters:
y_offset – The top margin above the rendered bits
qr_bits – The bits to render, as a list of lists of ones and zeroes
scale – The render scale to make it show up easier on the screen
- Returns:
Nothing
- fill(color: int) None
This function fills the draw surface with the provided color.
- Parameters:
color – The color to fill
- Returns:
Nothing
- fillrect(point: tuple, size: tuple, color: int) None
This function draws a filled rectangle at the given point and size, with the given color
- Parameters:
point – Top left point of the rectangle
size – The size (width, height) of the rectangle box
color – The rectangle fill color
- Returns:
Nothing
- hline(point: tuple, length: int, color: int) None
This function draws a horizontal line at the given point, with the given length and color
- Parameters:
point – Left point of the horizontal line
length – Length of the line to draw
color – Line color
- Returns:
Nothing
- rect(point: tuple, size: tuple, color: int) None
This function draws a hollow rectangle at the given point and size, with the given color
- Parameters:
point – Top left point of the rectangle
size – The size (width, height) of the rectangle box
color – The rectangle outline color
- Returns:
Nothing
- text(point: tuple, text: str, color: int, size: int = 1, nowrap: bool = True) None
This function renders text at the given point with the given color and size
- Parameters:
point – Top left point of the text string
text – The text string to render
color – The text color
size – The size of the font
nowrap – A flag to determine whether to not wrap text
- Returns:
Nothing
- vline(point: tuple, length: int, color: int) None
This function draws a vertical line at the given point, with the given length and color
- Parameters:
point – Top point of the horizontal line
length – Length of the line to draw
color – Line color
- Returns:
Nothing