modtronix H / modtronix_im4OLED

Fork of Adafruit_GFX by Neal Horman

Embed: (wiki syntax)

« Back to documentation index

MxGfx Class Reference

MxGfx Class Reference

This is a Text and Graphics element drawing class. More...

#include <mx_gfx.h>

Inherited by MxSSD1306.

Public Member Functions

virtual void drawPixel (int16_t x, int16_t y, uint16_t color)=0
 Paint one BLACK or WHITE pixel in the display buffer.
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Draw a Horizontal Line.
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw a rectangle.
virtual void fillScreen (uint16_t color)
 Fill the entire display.
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle.
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw and fill a circle.
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.
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw and fill a triangle.
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw a rounded rectangle.
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw and fill a rounded rectangle.
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 Draw a bitmap.
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Draw a line.
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Draw a vertical line.
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw and fill a rectangle.
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 Draw a text character at a specified pixel location.
size_t writeChar (uint8_t)
 Draw a text character at the text cursor location.
int16_t width (void)
 Get the width of the display in pixels.
int16_t height (void)
 Get the height of the display in pixels.
void setTextCursor (int16_t x, int16_t y)
 Set the text cursor location, based on the size of the text.
void setTextSize (uint8_t s)
 Set the size of the text to be drawn.
void setTextColor (uint16_t c)
 Set the text foreground and background colors to be the same.
void setTextColor (uint16_t c, uint16_t b)
 Set the text foreground and background colors independantly.
void setTextWrap (bool w)
 Set text wraping mode true or false.
void setRotation (uint8_t r)
 Set the display rotation, 1, 2, 3, or 4.
uint8_t getRotation (void)
 Get the current rotation.

Detailed Description

This is a Text and Graphics element drawing class.

These functions draw to the display buffer.

Display drivers should be derived from here. The Display drivers push the display buffer to the hardware based on application control.

Definition at line 44 of file mx_gfx.h.


Member Function Documentation

void drawBitmap ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Draw a bitmap.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 360 of file mx_gfx.cpp.

void drawChar ( int16_t  x,
int16_t  y,
unsigned char  c,
uint16_t  color,
uint16_t  bg,
uint8_t  size 
)

Draw a text character at a specified pixel location.

Definition at line 399 of file mx_gfx.cpp.

void drawCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Draw a circle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 25 of file mx_gfx.cpp.

void drawFastHLine ( int16_t  x,
int16_t  y,
int16_t  w,
uint16_t  color 
) [virtual]

Draw a Horizontal Line.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 228 of file mx_gfx.cpp.

void drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
uint16_t  color 
) [virtual]

Draw a vertical line.

Note:
GFX_ENABLE_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in im4oled_config.h

Definition at line 195 of file mx_gfx.cpp.

void drawLine ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
uint16_t  color 
) [virtual]

Draw a line.

Note:
GFX_ENABLE_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in im4oled_config.h

Definition at line 151 of file mx_gfx.cpp.

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

Paint one BLACK or WHITE pixel in the display buffer.

Implemented in MxSSD1306.

void drawRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
) [virtual]

Draw a rectangle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 220 of file mx_gfx.cpp.

void drawRoundRect ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
int16_t  radius,
uint16_t  color 
)

Draw a rounded rectangle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 240 of file mx_gfx.cpp.

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.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 266 of file mx_gfx.cpp.

void fillCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Draw and fill a circle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 107 of file mx_gfx.cpp.

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

Draw and fill a rectangle.

The rectangle starts at given point, and extends DOWN(h) and RIGHTH(w)

Note:
GFX_ENABLE_ABSTRACTS or GFX_SIZEABLE_TEXT must be defined in im4oled_config.h
Parameters:
xX coordinate, a value from 0 - (width-1)
yY coordinate, a value from 0 - (height-1)
wWidth from given x,y coordinate. Extends to the Right of given x,y
hHeight from given x,y coordinate. Extends Down of given x,y
colorFor monochrome display, 0=off, 1=on

Definition at line 210 of file mx_gfx.cpp.

void fillRoundRect ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
int16_t  radius,
uint16_t  color 
)

Draw and fill a rounded rectangle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 255 of file mx_gfx.cpp.

void fillScreen ( uint16_t  color ) [virtual]

Fill the entire display.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 234 of file mx_gfx.cpp.

void fillTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)

Draw and fill a triangle.

Note:
GFX_ENABLE_ABSTRACTS must be defined in im4oled_config.h

Definition at line 274 of file mx_gfx.cpp.

uint8_t getRotation ( void   )

Get the current rotation.

Definition at line 181 of file mx_gfx.h.

int16_t height ( void   )

Get the height of the display in pixels.

Definition at line 155 of file mx_gfx.h.

void setRotation ( uint8_t  r )

Set the display rotation, 1, 2, 3, or 4.

Definition at line 447 of file mx_gfx.cpp.

void setTextColor ( uint16_t  c,
uint16_t  b 
)

Set the text foreground and background colors independantly.

Definition at line 174 of file mx_gfx.h.

void setTextColor ( uint16_t  c )

Set the text foreground and background colors to be the same.

Definition at line 172 of file mx_gfx.h.

void setTextCursor ( int16_t  x,
int16_t  y 
)

Set the text cursor location, based on the size of the text.

Following commands will write text to the RIGHT and BELOW this given x,y Coordinate. For example, use 0,0 to write text to top,left of display.

Parameters:
xX coordinate, a value from 0 - (width-1)
yY coordinate, a value from 0 - (height-1)

Definition at line 163 of file mx_gfx.h.

void setTextSize ( uint8_t  s )

Set the size of the text to be drawn.

Note:
Make sure to enable either GFX_SIZEABLE_TEXT or GFX_ENABLE_ABSTRACTS

Definition at line 169 of file mx_gfx.h.

void setTextWrap ( bool  w )

Set text wraping mode true or false.

Definition at line 176 of file mx_gfx.h.

int16_t width ( void   )

Get the width of the display in pixels.

Definition at line 153 of file mx_gfx.h.

size_t writeChar ( uint8_t  c )

Draw a text character at the text cursor location.

Definition at line 376 of file mx_gfx.cpp.