SSD1306 OLED display driver  1.4.4
This library is developed to control SSD1306/SSD1331 RGB i2c/spi OLED displays and spi PCD8544 LED display
Public Member Functions | List of all members
NanoCanvas Class Reference

#include <nano_gfx.h>

Inheritance diagram for NanoCanvas:
TinyBuffer

Public Member Functions

 NanoCanvas (uint8_t w, uint8_t h, uint8_t *bytes)
 
void drawPixel (uint8_t x, uint8_t y) __attribute__((deprecated))
 
void putPixel (uint8_t x, uint8_t y)
 
void drawRect (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
 
void drawHLine (uint8_t x1, uint8_t y1, uint8_t x2)
 
void drawVLine (uint8_t x1, uint8_t y1, uint8_t y2)
 
void fillRect (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t templ)
 
void clear ()
 
void char_f6x8 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated))
 
void charF6x8 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
 
void charF12x16 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
 
void printFixed (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
 
void printFixed2x (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL)
 
void drawSpritePgm (uint8_t x, uint8_t y, const uint8_t sprite[])
 
void drawSprite (uint8_t x, uint8_t y, const uint8_t sprite[])
 
void drawSprite (SPRITE *sprite)
 
uint8_t width () const
 
uint8_t height () const
 
uint8_t * buffer () const
 
void invert ()
 
void flipH ()
 
void blt (uint8_t x, uint8_t y)
 

Detailed Description

NanoCanvas represents objects for drawing in memory buffer

Definition at line 38 of file nano_gfx.h.

Constructor & Destructor Documentation

◆ NanoCanvas()

NanoCanvas::NanoCanvas ( uint8_t  w,
uint8_t  h,
uint8_t *  bytes 
)
inline

Creates new canvas object. Width can be of any value. Height should be divided by 8. Memory buffer must be not less than w * h / 8.

Parameters
w- width
h- height
bytes- pointer to memory buffer to use

Definition at line 51 of file nano_gfx.h.

Member Function Documentation

◆ blt()

void NanoCanvas::blt ( uint8_t  x,
uint8_t  y 
)

Draws canvas on the LCD display

Parameters
x- horizontal position in pixels
y- vertical position in blocks (pixels/8)

Definition at line 453 of file nano_gfx.cpp.

◆ buffer()

uint8_t* NanoCanvas::buffer ( ) const
inline

Returns canvas buffer

Definition at line 196 of file nano_gfx.h.

◆ char_f6x8()

void NanoCanvas::char_f6x8 ( uint8_t  x,
uint8_t  y,
const char  ch[],
EFontStyle  style = STYLE_NORMAL 
)
inline

Prints text to canvas buffer

Parameters
x- start position X
y- start position Y
ch- text to print (null-terminated)
style- font style (EFontStyle), normal by default

Definition at line 123 of file nano_gfx.h.

◆ charF12x16()

void NanoCanvas::charF12x16 ( uint8_t  x,
uint8_t  y,
const char  ch[],
EFontStyle  style = STYLE_NORMAL 
)

Prints text to canvas buffer using double size font 12x16

Parameters
x- start position X
y- start position Y
ch- text to print (null-terminated)
style- font style (EFontStyle), normal by default

Definition at line 166 of file nano_gfx.cpp.

◆ charF6x8()

void NanoCanvas::charF6x8 ( uint8_t  x,
uint8_t  y,
const char  ch[],
EFontStyle  style = STYLE_NORMAL 
)

Prints text to canvas buffer

Parameters
x- start position X
y- start position Y
ch- text to print (null-terminated)
style- font style (EFontStyle), normal by default

Definition at line 120 of file nano_gfx.cpp.

◆ clear()

void NanoCanvas::clear ( )

Clears canvas

Definition at line 111 of file nano_gfx.cpp.

◆ drawHLine()

void NanoCanvas::drawHLine ( uint8_t  x1,
uint8_t  y1,
uint8_t  x2 
)

Draws horizontal line

Parameters
x1- left boundary
y1- position Y
x2- right boundary

Definition at line 47 of file nano_gfx.cpp.

◆ drawPixel()

void NanoCanvas::drawPixel ( uint8_t  x,
uint8_t  y 
)
inline

Draws pixel on specified position

Parameters
x- position X
y- position Y

Definition at line 67 of file nano_gfx.h.

◆ drawRect()

void NanoCanvas::drawRect ( uint8_t  x1,
uint8_t  y1,
uint8_t  x2,
uint8_t  y2 
)

Draws rectangle

Parameters
x1- left boundary
y1- top boundary
x2- right boundary
y2- bottom boundary

Definition at line 67 of file nano_gfx.cpp.

◆ drawSprite() [1/2]

void NanoCanvas::drawSprite ( uint8_t  x,
uint8_t  y,
const uint8_t  sprite[] 
)

Sprite is small image 8x8, sprite doesn't change background Reads sprite from SRAM memory

Definition at line 424 of file nano_gfx.cpp.

◆ drawSprite() [2/2]

void NanoCanvas::drawSprite ( SPRITE sprite)

Draws sprite in the buffer

Parameters
sprite- pointer to SPRITE structure containing sprite information

Definition at line 439 of file nano_gfx.cpp.

◆ drawSpritePgm()

void NanoCanvas::drawSpritePgm ( uint8_t  x,
uint8_t  y,
const uint8_t  sprite[] 
)

Sprite is small image 8x8, sprite doesn't change background Reads sprite from Flash memory

Definition at line 408 of file nano_gfx.cpp.

◆ drawVLine()

void NanoCanvas::drawVLine ( uint8_t  x1,
uint8_t  y1,
uint8_t  y2 
)

Draws vertical line

Parameters
x1- position X
y1- top boundary
y2- bottom boundary

Definition at line 57 of file nano_gfx.cpp.

◆ fillRect()

void NanoCanvas::fillRect ( uint8_t  x1,
uint8_t  y1,
uint8_t  x2,
uint8_t  y2,
uint8_t  templ 
)

Draws filled rectangle

Parameters
x1- left boundary
y1- top boundary
x2- right boundary
y2- bottom boundary
templ- template to use for filling rectangle

Definition at line 76 of file nano_gfx.cpp.

◆ flipH()

void NanoCanvas::flipH ( )

Flips image horizontally.

Definition at line 464 of file nano_gfx.cpp.

◆ height()

uint8_t NanoCanvas::height ( ) const
inline

Returns canvas height

Definition at line 191 of file nano_gfx.h.

◆ invert()

void NanoCanvas::invert ( )

Inverts content in the buffer. white becomes black and wise versa.

Definition at line 458 of file nano_gfx.cpp.

◆ printFixed()

void NanoCanvas::printFixed ( uint8_t  xpos,
uint8_t  y,
const char  ch[],
EFontStyle  style = STYLE_NORMAL 
)

Prints text to canvas buffer using fixed font.

Parameters
xpos- start position X
y- start position Y
ch- text to print (null-terminated)
style- font style (EFontStyle), normal by default
See also
ssd1306_setFixedFont().

Definition at line 245 of file nano_gfx.cpp.

◆ printFixed2x()

void NanoCanvas::printFixed2x ( uint8_t  xpos,
uint8_t  y,
const char  ch[],
EFontStyle  style = STYLE_NORMAL 
)

Prints text to canvas buffer using fixed font double size.

Parameters
xpos- start position X
y- start position Y
ch- text to print (null-terminated)
style- font style (EFontStyle), normal by default
See also
ssd1306_setFixedFont().

Definition at line 322 of file nano_gfx.cpp.

◆ putPixel()

void NanoCanvas::putPixel ( uint8_t  x,
uint8_t  y 
)

Draws pixel on specified position

Parameters
x- position X
y- position Y

Definition at line 34 of file nano_gfx.cpp.

◆ width()

uint8_t NanoCanvas::width ( ) const
inline

Returns canvas width

Definition at line 186 of file nano_gfx.h.


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