upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
This file is used by the screen.
Public Member Functions | |
GFX (int16_t w, int16_t h) | |
virtual void | drawPixel (int16_t x, int16_t y, uint16_t color)=0 |
virtual void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) |
virtual void | drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color) |
virtual void | drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color) |
virtual void | drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
virtual void | fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
virtual void | fillScreen (uint16_t color) |
virtual void | invertDisplay (bool i) |
void | drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color) |
void | drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color) |
void | fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color) |
void | fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color) |
void | drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) |
void | fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) |
void | drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color) |
void | fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color) |
void | drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size) |
int16_t | getCursorX (void) const |
int16_t | getCursorY (void) const |
void | setCursor (int16_t x, int16_t y) |
void | setTextColor (uint16_t c) |
void | setTextColor (uint16_t c, uint16_t bg) |
void | setTextSize (uint8_t s) |
void | setTextWrap (bool w) |
uint8_t | getRotation (void) const |
void | setRotation (uint8_t r) |
void | cp437 (bool x) |
virtual void | write (uint8_t c) |
void | print (std::string msg) |
int16_t | width (void) const |
int16_t | height (void) const |
GFX (int width, int height, uint8_t *screenBuffer, const unsigned char *font) | |
~GFX () | |
virtual void | setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)=0 |
virtual void | drawPixel (int16_t x, int16_t y, uint16_t color)=0 |
virtual void | refresh ()=0 |
void | drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size) |
void | print (std::string msg) |
mraa::Result | setPixel (int x, int y, uint16_t color) |
void | fillScreen (uint16_t color) |
void | fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
void | drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color) |
void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) |
void | drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color) |
void | drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color) |
void | setCursor (int16_t x, int16_t y) |
void | setTextColor (uint16_t textColor, uint16_t textBGColor) |
void | setTextSize (uint8_t size) |
void | setTextWrap (uint8_t wrap) |
Data Fields | |
int | m_height |
int | m_width |
int | m_textSize |
int | m_textColor |
int | m_textBGColor |
int | m_cursorX |
int | m_cursorY |
int | m_wrap |
uint8_t * | m_map |
Static Protected Attributes | |
static const unsigned char | font [] |
GFX | ( | int | width, |
int | height, | ||
uint8_t * | screenBuffer, | ||
const unsigned char * | font | ||
) |
Instantiates a GFX object
width | Screen width |
height | Screen height |
screenBuffer | Pointer to the screen buffer |
font | Pointer to the font map |
|
pure virtual |
Sends a pixel color (RGB) to the driver chip. This must be defined by the subclass (pure virtual function).
x | Axis on the horizontal scale |
y | Axis on the vertical scale |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
Implemented in ST7735, and ILI9341.
|
virtual |
Draw a line.
x0 | Start of line x coordinate |
y0 | Start of line y coordinate |
x1 | End of line x coordinate |
y1 | End of line y coordinate |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
|
virtual |
Draws a vertical line using minimal SPI writes.
x | Axis on the horizontal scale to begin line |
y | Axis on the vertical scale to begin line |
h | Height of line in pixels |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
Reimplemented in ILI9341.
|
virtual |
Draws a horizontal line using minimal SPI writes.
x | Axis on the horizontal scale to begin line |
y | Axis on the vertical scale to begin line |
w | Width of line in pixels |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
Reimplemented in ILI9341.
|
virtual |
Draws a rectangle (not filled).
x | Position of upper left corner on horizontal axis |
y | Position of upper left corner on vertical axis |
w | Width of rectangle |
h | Height of rectangle RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
|
virtual |
Draw a filled rectangle.
x | Axis on the horizontal scale of upper-left corner |
y | Axis on the vertical scale of upper-left corner |
w | Width of rectangle in pixels |
h | Height of rectangle in pixels |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
Reimplemented in ILI9341.
|
virtual |
Fill the screen with a single color.
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
Reimplemented in ILI9341.
|
virtual |
void drawCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draw a circle outline.
x0 | Center point of circle on x-axis |
y0 | Center point of circle on y-axis |
r | Radius of circle |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void drawCircleHelper | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint8_t | cornername, | ||
uint16_t | color | ||
) |
Used to draw rounded corners.
x0 | Center point of circle on x-axis |
y0 | Center point of circle on y-axis |
r | Radius of circle |
cornername | Mask of corner number (1, 2, 4, 8) |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void fillCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draws a filled circle.
x0 | Center point of circle on x-axis |
y0 | Center point of circle on y-axis |
r | Radius of circle |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void fillCircleHelper | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint8_t | cornername, | ||
int16_t | delta, | ||
uint16_t | color | ||
) |
Used to draw a filled circle and rounded rectangles.
x0 | Center point of circle on x-axis |
y0 | Center point of circle on y-axis |
r | Radius of circle |
cornername | Mask of corner number (1, 2, 4, 8) |
delta | Line offset |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void drawTriangle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2, | ||
uint16_t | color | ||
) |
Draw a triangle.
x0 | First point coordinate on x-axis |
y0 | First point coordinate on y-axis |
x1 | Second point coordinate on x-axis |
y1 | Second point coordinate on y-axis |
x2 | Third point coordinate on x-axis |
y2 | Third point coordinate on y-axis |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void fillTriangle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2, | ||
uint16_t | color | ||
) |
Draw a filled triangle.
x0 | First point coordinate on x-axis |
y0 | First point coordinate on y-axis |
x1 | Second point coordinate on x-axis |
y1 | Second point coordinate on y-axis |
x2 | Third point coordinate on x-axis |
y2 | Third point coordinate on y-axis |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void drawRoundRect | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | w, | ||
int16_t | h, | ||
int16_t | radius, | ||
uint16_t | color | ||
) |
Draw a rectangle with rounded corners
x0 | X-axis coordinate of top-left corner |
y0 | Y-axis coordinate of top-left corner |
w | Width of rectangle |
h | height of rectangle |
radius | Radius of rounded corners |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void fillRoundRect | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | w, | ||
int16_t | h, | ||
int16_t | radius, | ||
uint16_t | color | ||
) |
Draw a filled rectangle with rounded corners
x0 | X-axis coordinate of top-left corner |
y0 | Y-axis coordinate of top-left corner |
w | Width of rectangle |
h | height of rectangle |
radius | Radius of rounded corners |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void drawChar | ( | int16_t | x, |
int16_t | y, | ||
unsigned char | c, | ||
uint16_t | color, | ||
uint16_t | bg, | ||
uint8_t | size | ||
) |
Draw a character at the specified point.
x | X-axis coordinate of the top-left corner |
y | Y-axis coordinate of the top-left corner |
c | Character to draw |
color | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
bg | Background color (16-bit RGB) |
size | Font size |
int16_t getCursorX | ( | void | ) | const |
Get the x-axis coordinate of the upper-left corner of the cursor.
int16_t getCursorY | ( | void | ) | const |
Get the y-axis coordinate of the upper-left corner of the cursor.
void setCursor | ( | int16_t | x, |
int16_t | y | ||
) |
Set the cursor for writing text.
x | X-axis coordinate of the top-left corner of the cursor |
y | Y-axis coordinate of the top-left corner of the cursor |
void setTextColor | ( | uint16_t | c | ) |
Set the color for text.
c | RGB (16-bit) color (R[0-4], G[5-10], B[11-15] |
void setTextColor | ( | uint16_t | c, |
uint16_t | bg | ||
) |
Set the color for text and text background (highlight).
c | Text color (RGB, 16-bit) |
bg | Background text color (RGB, 16-bit) |
void setTextSize | ( | uint8_t | s | ) |
Set the size of the text.
s | Font size (multiples of 8 pixel text height) |
void setTextWrap | ( | bool | w | ) |
Enable or disable text wrapping.
w | True to wrap text. False to truncate. |
uint8_t getRotation | ( | void | ) | const |
Get the current rotation configuration of the screen.
void setRotation | ( | uint8_t | r | ) |
Sets the rotation of the screen. Can be overridden with another screen-specific definition.
r | Rotation 0-3 |
void cp437 | ( | bool | x | ) |
Enable (or disable) Code Page 437-compatible charset.
x | True to enable CP437 charset. False to disable. |
|
virtual |
Write a character at the current cursor position. Definition can be overridden with board-specific code.
c | Character to draw |
Reimplemented in ST7735.
void print | ( | std::string | msg | ) |
Prints a string to the screen.
s | Message to print |
int16_t width | ( | void | ) | const |
Get the current width of the screen.
int16_t height | ( | void | ) | const |
Get the current height of the screen.
|
pure virtual |
Sets the window address
x0 | First coordinate |
y0 | First coordinate |
x1 | Second coordinate |
y1 | Second coordinate |
Implemented in ST7735.
|
pure virtual |
|
pure virtual |
Copies the buffer to the chip via the SPI.
Implemented in ST7735.
void drawChar | ( | int16_t | x, |
int16_t | y, | ||
uint8_t | data, | ||
uint16_t | color, | ||
uint16_t | bg, | ||
uint8_t | size | ||
) |
x | Axis on the horizontal scale |
y | Axis on the vertical scale |
data | Character to write |
color | Character color |
bg | Character background color |
size | Size of the font |
void print | ( | std::string | msg | ) |
Prints a message on the screen
msg | Message to print |
mraa::Result setPixel | ( | int | x, |
int | y, | ||
uint16_t | color | ||
) |
Prints a message on the screen
x | Axis on the horizontal scale |
y | Axis on the vertical scale |
color | Pixel color |
void fillScreen | ( | uint16_t | color | ) |
Fills the screen with a selected color
color | Selected color |
void fillRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Fills a rectangle with a selected color
x | Axis on the horizontal scale (top-left corner) |
y | Axis on the vertical scale (top-left corner) |
w | Distanse from x |
h | Distanse from y |
color | Selected color |
void drawFastVLine | ( | int16_t | x, |
int16_t | y, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Draws a line on the vertical scale
x | Axis on the horizontal scale |
y | Axis on the vertical scale |
h | Distanse from y |
color | Selected color |
void drawLine | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
uint16_t | color | ||
) |
Draws a line from coordinate C0 to coordinate C1
x0 | First coordinate |
y0 | First coordinate |
x1 | Second coordinate |
y1 | Second coordinate |
color | selected color |
void drawTriangle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
int16_t | x2, | ||
int16_t | y2, | ||
uint16_t | color | ||
) |
Draws a triangle
x0 | First coordinate |
y0 | First coordinate |
x1 | Second coordinate |
y1 | Second coordinate |
x2 | Third coordinate |
y2 | Third coordinate |
color | Selected color |
void drawCircle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draws a circle
x | Center of the circle on the horizontal scale |
y | Center of the circle on the vertical scale |
r | Radius of the circle |
color | Color of the circle |
void setCursor | ( | int16_t | x, |
int16_t | y | ||
) |
Sets the cursor for a text message
x | Axis on the horizontal scale |
y | Axis on the vertical scale |
void setTextColor | ( | uint16_t | textColor, |
uint16_t | textBGColor | ||
) |
Sets a text color for a message
textColor | Font color |
textBGColor | Background color |
void setTextSize | ( | uint8_t | size | ) |
Sets the size of the font
size | Font size |
void setTextWrap | ( | uint8_t | wrap | ) |
Wraps a printed message
wrap | True (0x1) or false (0x0) |
int m_height |
Screen height
int m_width |
Screen width
int m_textSize |
Printed text size
int m_textColor |
Printed text color
int m_textBGColor |
Printed text background color
int m_cursorX |
Cursor X coordinate
int m_cursorY |
Cursor Y coordinate
int m_wrap |
Wrapper flag (true or false)
uint8_t* m_map |
Screens buffer