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

#include <nano_gfx.h>

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 drawBitmap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf)
 
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

Deprecated:
Use NanoCanvas1, NanoCanvas8, NanoCanvas16 instead

Definition at line 39 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 52 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)

◆ buffer()

uint8_t* NanoCanvas::buffer ( ) const
inline

Returns canvas buffer

Definition at line 210 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
Deprecated:
use printFixed() instead.

Definition at line 126 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

◆ 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
Deprecated:
use printFixed() instead.

◆ clear()

void NanoCanvas::clear ( )

Clears canvas

◆ drawBitmap()

void NanoCanvas::drawBitmap ( uint8_t  x,
uint8_t  y,
uint8_t  w,
uint8_t  h,
const uint8_t *  buf 
)

Draw bitmap to the buffer from SRAM.

Parameters
x- horizontal position in pixels
y- vertical position in pixels
w- width of bitmap in pixels
h- height of bitmap in pixels (must be divided by 8)
buf- pointer to data, located in Flash: each byte represents 8 vertical pixels.

◆ 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

◆ drawPixel()

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

Draws pixel on specified position

Parameters
x- position X
y- position Y
Deprecated:
Use putPixel() instead.

Definition at line 69 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

◆ 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

◆ drawSprite() [2/2]

void NanoCanvas::drawSprite ( SPRITE sprite)

Draws sprite in the buffer

Parameters
sprite- pointer to SPRITE structure containing sprite information

◆ 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

◆ 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

◆ 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

◆ flipH()

void NanoCanvas::flipH ( )

Flips image horizontally.

◆ height()

uint8_t NanoCanvas::height ( ) const
inline

Returns canvas height

Definition at line 205 of file nano_gfx.h.

◆ invert()

void NanoCanvas::invert ( )

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

◆ 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().

◆ 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().

◆ putPixel()

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

Draws pixel on specified position

Parameters
x- position X
y- position Y

◆ width()

uint8_t NanoCanvas::width ( ) const
inline

Returns canvas width

Definition at line 200 of file nano_gfx.h.


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