upm  0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions | Data Fields | Protected Attributes
GFX Class Referenceabstract

GFX helper class. More...

Detailed Description

This file 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_t 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 
)

Instanciates a GFX object

Parameters
widthscreen width
heightscreen height
screenBufferpointer to screen buffer
fontpointer to 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

Set 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

Send pixel collor (RGB) to the chip. Must be implemented by inherited class.

Parameters
xaxis on horizontal scale
yaxis on vertical scale
colorrgb value

Implemented in ST7735.

virtual void refresh ( )
pure virtual

Copy the buffer to the chip via SPI interface.

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 horizontal scale
yaxis on vertical scale
datacharacter to write
colorcharacter's color
bgcharacter's 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)

Print the message to the screen

Parameters
msgmessage which will be printed

Here is the call graph for this function:

mraa_result_t setPixel ( int  x,
int  y,
uint16_t  color 
)

Print the message to the screen

Parameters
xaxis on horizontal scale
yaxis on vertical scale
colorpixel's color

Here is the caller graph for this function:

void fillScreen ( uint16_t  color)

Fill screen with selected color

Parameters
colorselected's 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 
)

Fill rectangle with selected color

Parameters
xaxis on horizontal scale (top left corner)
yaxis on 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 
)

Draw line in vertical scale.

Parameters
xaxis on horizontal scale
yaxis on 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 
)

Draw 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 
)

Draw 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 
)

Draw a circle

Parameters
xcenter of circle on X scale
ycenter of circle on Y scale
rradius of circle
colorcolor of circle

Here is the call graph for this function:

void setCursor ( int16_t  x,
int16_t  y 
)

Set cursor for text message

Parameters
xaxis on horizontal scale
yaxis on vertical scale
void setTextColor ( uint16_t  textColor,
uint16_t  textBGColor 
)

Set text color for the message

Parameters
textColorfont color
textBGColorbackground color
void setTextSize ( uint8_t  size)

Set the size of the font

Parameters
sizefont size
void setTextWrap ( uint8_t  wrap)

Wrap 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: