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

#include <canvas.h>

Public Member Functions

 NanoCanvas8 ()
 
 NanoCanvas8 (lcdint_t w, lcdint_t h, uint8_t *bytes)
 
void begin (lcdint_t w, lcdint_t h, uint8_t *bytes)
 
void setOffset (lcdint_t ox, lcdint_t oy)
 
void putPixel (lcdint_t x, lcdint_t y)
 
void putPixel (const NanoPoint &p)
 
void drawVLine (lcdint_t x1, lcdint_t y1, lcdint_t y2)
 
void drawHLine (lcdint_t x1, lcdint_t y1, lcdint_t x2)
 
void drawRect (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
 
void drawRect (const NanoRect &rect)
 
void fillRect (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
 
void fillRect (const NanoRect &rect)
 
void drawBitmap1 (lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
 Draws monochrome bitmap in color buffer using color, specified via setColor() method Draws monochrome bitmap in color buffer using color, specified via setColor() method. More...
 
void drawBitmap8 (lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
 Draws 8-bit color bitmap in color buffer. Draws 8-bit color bitmap in color buffer. More...
 
void clear ()
 
void write (uint8_t c)
 
void printChar (uint8_t c)
 
void printFixed (lcdint_t xpos, lcdint_t y, const char *ch)
 
void printFixedPgm (lcdint_t xpos, lcdint_t y, const char *ch)
 
void setMode (uint8_t modeFlags)
 Sets canvas drawing mode Sets canvas drawing mode. The set flags define transparency of output images. More...
 
void setColor (uint8_t color)
 
void blt (lcdint_t x, lcdint_t y)
 
void blt ()
 

Public Attributes

NanoPoint offset
 

Static Public Attributes

static const uint8_t BITS_PER_PIXEL = 8
 

Detailed Description

NanoCanvas8 represents objects for drawing in memory buffer NanoCanvas8 represents each pixel as single byte with RGB bits: RRRGGGBB For details refer to SSD1331 datasheet

Definition at line 273 of file canvas.h.

Constructor & Destructor Documentation

◆ NanoCanvas8() [1/2]

NanoCanvas8::NanoCanvas8 ( )
inline

Creates new empty canvas object. If you this constructor is used, you must call begin() method before working with canvas.

Definition at line 287 of file canvas.h.

◆ NanoCanvas8() [2/2]

NanoCanvas8::NanoCanvas8 ( lcdint_t  w,
lcdint_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.

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

Definition at line 301 of file canvas.h.

Member Function Documentation

◆ begin()

void NanoCanvas8::begin ( lcdint_t  w,
lcdint_t  h,
uint8_t *  bytes 
)
inline

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

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

Definition at line 316 of file canvas.h.

◆ blt() [1/2]

void NanoCanvas8::blt ( lcdint_t  x,
lcdint_t  y 
)

Draws canvas on the LCD display

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

Definition at line 326 of file canvas.cpp.

◆ blt() [2/2]

void NanoCanvas8::blt ( )

Draws canvas on the LCD display using offset values.

Definition at line 331 of file canvas.cpp.

◆ clear()

void NanoCanvas8::clear ( )

Clears canvas

Definition at line 316 of file canvas.cpp.

◆ drawBitmap1()

void NanoCanvas8::drawBitmap1 ( lcdint_t  x,
lcdint_t  y,
lcduint_t  w,
lcduint_t  h,
const uint8_t *  bitmap 
)

Draws monochrome bitmap in color buffer using color, specified via setColor() method Draws monochrome bitmap in color buffer using color, specified via setColor() method.

Parameters
x- position X in pixels
y- position Y in pixels
w- width in pixels
h- height in pixels
bitmap- monochrome bitmap data, located in flash
Note
There are 2 modes: transparent and non-transparent mode, - and 2 colors available: black and white. In non-transparent mode, when black color is selected, the monochrome image just inverted. In transparent mode, those pixels of source monochrome image, which are black, do not overwrite pixels in the screen buffer.

Definition at line 155 of file canvas.cpp.

◆ drawBitmap8()

void NanoCanvas8::drawBitmap8 ( lcdint_t  x,
lcdint_t  y,
lcduint_t  w,
lcduint_t  h,
const uint8_t *  bitmap 
)

Draws 8-bit color bitmap in color buffer. Draws 8-bit color bitmap in color buffer.

Parameters
x- position X in pixels
y- position Y in pixels
w- width in pixels
h- height in pixels
bitmap- 8-bit color bitmap data, located in flash

Definition at line 213 of file canvas.cpp.

◆ drawHLine()

void NanoCanvas8::drawHLine ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  x2 
)

Draws horizontal or vertical line

Parameters
x1- position X
y1- position Y
x2- position X
Note
color can be set via setColor()

Definition at line 82 of file canvas.cpp.

◆ drawRect() [1/2]

void NanoCanvas8::drawRect ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  x2,
lcdint_t  y2 
)

Draws rectangle

Parameters
x1- position X
y1- position Y
x2- position X
y2- position Y
Note
color can be set via setColor()

Definition at line 103 of file canvas.cpp.

◆ drawRect() [2/2]

void NanoCanvas8::drawRect ( const NanoRect rect)

Draws rectangle

Parameters
rect- structure, describing rectangle area
Note
color can be set via setColor()

Definition at line 111 of file canvas.cpp.

◆ drawVLine()

void NanoCanvas8::drawVLine ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  y2 
)

Draws horizontal or vertical line

Parameters
x1- position X
y1- position Y
y2- position Y
Note
color can be set via setColor()

Definition at line 60 of file canvas.cpp.

◆ fillRect() [1/2]

void NanoCanvas8::fillRect ( lcdint_t  x1,
lcdint_t  y1,
lcdint_t  x2,
lcdint_t  y2 
)

Fills rectangle area

Parameters
x1- position X
y1- position Y
x2- position X
y2- position Y
Note
color can be set via setColor()

Definition at line 116 of file canvas.cpp.

◆ fillRect() [2/2]

void NanoCanvas8::fillRect ( const NanoRect rect)

Fills rectangle area

Parameters
rect- structure, describing rectangle area
Note
color can be set via setColor()

Definition at line 148 of file canvas.cpp.

◆ printChar()

void NanoCanvas8::printChar ( uint8_t  c)

Draws single character to canvas

Parameters
c- character code to print

Definition at line 259 of file canvas.cpp.

◆ printFixed()

void NanoCanvas8::printFixed ( lcdint_t  xpos,
lcdint_t  y,
const char *  ch 
)

Print text at specified position to canvas

Parameters
xpos- position in pixels
y- position in pixels
ch- pointer to NULL-terminated string.
Note
No font style support anymore, sorry for that. Font styles increase code size.

Definition at line 292 of file canvas.cpp.

◆ printFixedPgm()

void NanoCanvas8::printFixedPgm ( lcdint_t  xpos,
lcdint_t  y,
const char *  ch 
)

Print text at specified position to canvas

Parameters
xpos- position in pixels
y- position in pixels
ch- pointer to NULL-terminated string, located in flash
Note
No font style support anymore, sorry for that. Font styles increase code size.

Definition at line 303 of file canvas.cpp.

◆ putPixel() [1/2]

void NanoCanvas8::putPixel ( lcdint_t  x,
lcdint_t  y 
)

Draws pixel on specified position

Parameters
x- position X
y- position Y
Note
color can be set via setColor()

Definition at line 45 of file canvas.cpp.

◆ putPixel() [2/2]

void NanoCanvas8::putPixel ( const NanoPoint p)

Draws pixel on specified position

Parameters
p- NanoPoint
Note
color can be set via setColor()

Definition at line 55 of file canvas.cpp.

◆ setColor()

void NanoCanvas8::setColor ( uint8_t  color)
inline

Sets color for monochrome operations

Parameters
color- color to set (refer to RGB_COLOR8 definition)

Definition at line 483 of file canvas.h.

◆ setMode()

void NanoCanvas8::setMode ( uint8_t  modeFlags)
inline

Sets canvas drawing mode Sets canvas drawing mode. The set flags define transparency of output images.

Parameters
modeFlags- combination of flags: CANVAS_TEXT_WRAP, CANVAS_MODE_TRANSPARENT

Definition at line 477 of file canvas.h.

◆ setOffset()

void NanoCanvas8::setOffset ( lcdint_t  ox,
lcdint_t  oy 
)
inline

Sets offset

Parameters
ox- X offset in pixels
oy- Y offset in pixels

Definition at line 337 of file canvas.h.

◆ write()

void NanoCanvas8::write ( uint8_t  c)

Writes single character to canvas

Parameters
c- character code to print

Definition at line 269 of file canvas.cpp.

Member Data Documentation

◆ BITS_PER_PIXEL

const uint8_t NanoCanvas8::BITS_PER_PIXEL = 8
static

number of bits per single pixel in buffer

Definition at line 277 of file canvas.h.

◆ offset

NanoPoint NanoCanvas8::offset

Fixed offset for all operation of NanoCanvas8 in pixels

Definition at line 280 of file canvas.h.


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