upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | Data Fields | Protected Attributes
GFX Class Referenceabstract

GFX helper class. More...

Detailed Description

This file is used by the screen.

Public Member Functions

 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
 

Protected Attributes

const int16_t WIDTH
 
const int16_t HEIGHT
 
const unsigned char * m_font
 

Constructor & Destructor Documentation

GFX ( int  width,
int  height,
uint8_t *  screenBuffer,
const unsigned char *  font 
)

Instantiates a GFX object

Parameters
widthScreen width
heightScreen height
screenBufferPointer to the screen buffer
fontPointer to the font map
~GFX ( )

GFX object destructor

Member Function Documentation

virtual void setAddrWindow ( uint8_t  x0,
uint8_t  y0,
uint8_t  x1,
uint8_t  y1 
)
pure virtual

Sets the window address

Parameters
x0First coordinate
y0First coordinate
x1Second coordinate
y1Second coordinate

Implemented in ST7735.

virtual void drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)
pure virtual

Sends a pixel color (RGB) to the chip. Must be implemented by the inherited class.

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
colorRGB value

Implemented in ST7735.

virtual void refresh ( )
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 
)
Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
dataCharacter to write
colorCharacter color
bgCharacter background color
sizeSize of the font

Here is the call graph for this function:

Here is the caller graph for this function:

void print ( std::string  msg)

Prints a message on the screen

Parameters
msgMessage to print

Here is the call graph for this function:

mraa::Result setPixel ( int  x,
int  y,
uint16_t  color 
)

Prints a message on the screen

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
colorPixel color

Here is the caller graph for this function:

void fillScreen ( uint16_t  color)

Fills the screen with a selected color

Parameters
colorSelected color

Here is the call graph for this function:

Here is the caller graph for this function:

void fillRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Fills a rectangle with a selected color

Parameters
xAxis on the horizontal scale (top-left corner)
yAxis on the vertical scale (top-left corner)
wDistanse from x
hDistanse from y
colorSelected color

Here is the call graph for this function:

Here is the caller graph for this function:

void drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
uint16_t  color 
)

Draws a line on the vertical scale

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
hDistanse from y
colorSelected color

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
x0First coordinate
y0First coordinate
x1Second coordinate
y1Second coordinate
colorselected color

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
x0First coordinate
y0First coordinate
x1Second coordinate
y1Second coordinate
x2Third coordinate
y2Third coordinate
colorSelected color

Here is the call graph for this function:

void drawCircle ( int16_t  x,
int16_t  y,
int16_t  r,
uint16_t  color 
)

Draws a circle

Parameters
xCenter of the circle on the horizontal scale
yCenter of the circle on the vertical scale
rRadius of the circle
colorColor of the circle

Here is the call graph for this function:

void setCursor ( int16_t  x,
int16_t  y 
)

Sets the cursor for a text message

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
void setTextColor ( uint16_t  textColor,
uint16_t  textBGColor 
)

Sets a text color for a message

Parameters
textColorFont color
textBGColorBackground color
void setTextSize ( uint8_t  size)

Sets the size of the font

Parameters
sizeFont size
void setTextWrap ( uint8_t  wrap)

Wraps a printed message

Parameters
wrapTrue (0x1) or false (0x0)

Field Documentation

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

Inheritance diagram for GFX:
Inheritance graph
[legend]

The documentation for this class was generated from the following files: