SSD1306 I2C Display Driver  1.2.2
This library is developed to control SSD1306 I2C OLED Display
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 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 34 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 47 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 200 of file nano_gfx.cpp.

§ buffer()

uint8_t* NanoCanvas::buffer ( ) const
inline

Returns canvas buffer

Definition at line 163 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 119 of file nano_gfx.h.

§ 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 114 of file nano_gfx.cpp.

§ clear()

void NanoCanvas::clear ( )

Clears canvas

Definition at line 105 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 41 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 63 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 61 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 171 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 186 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 155 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 51 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 70 of file nano_gfx.cpp.

§ flipH()

void NanoCanvas::flipH ( )

Flips image horizontally.

Definition at line 211 of file nano_gfx.cpp.

§ height()

uint8_t NanoCanvas::height ( ) const
inline

Returns canvas height

Definition at line 158 of file nano_gfx.h.

§ invert()

void NanoCanvas::invert ( )

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

Definition at line 205 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 28 of file nano_gfx.cpp.

§ width()

uint8_t NanoCanvas::width ( ) const
inline

Returns canvas width

Definition at line 153 of file nano_gfx.h.


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