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
NanoCanvas1 Class Reference

#include <canvas.h>

Public Member Functions

 NanoCanvas1 ()
 
 NanoCanvas1 (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 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 = 1
 

Detailed Description

NanoCanvas1 represents objects for drawing in memory buffer NanoCanvas1 represents each pixel as single bit: 0/1 For details refer to SSD1306 datasheet

Definition at line 525 of file canvas.h.

Constructor & Destructor Documentation

◆ NanoCanvas1() [1/2]

NanoCanvas1::NanoCanvas1 ( )
inline

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

Definition at line 539 of file canvas.h.

◆ NanoCanvas1() [2/2]

NanoCanvas1::NanoCanvas1 ( 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 / 8.

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

Definition at line 551 of file canvas.h.

Member Function Documentation

◆ begin()

void NanoCanvas1::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 / 8.

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

Definition at line 566 of file canvas.h.

◆ blt() [1/2]

void NanoCanvas1::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 611 of file canvas.cpp.

◆ blt() [2/2]

void NanoCanvas1::blt ( )

Draws canvas on the LCD display using offset values.

Definition at line 616 of file canvas.cpp.

◆ clear()

void NanoCanvas1::clear ( )

Clears canvas

Definition at line 476 of file canvas.cpp.

◆ drawBitmap1()

void NanoCanvas1::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 485 of file canvas.cpp.

◆ drawHLine()

void NanoCanvas1::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 367 of file canvas.cpp.

◆ drawRect() [1/2]

void NanoCanvas1::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 413 of file canvas.cpp.

◆ drawRect() [2/2]

void NanoCanvas1::drawRect ( const NanoRect rect)

Draws rectangle

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

Definition at line 421 of file canvas.cpp.

◆ drawVLine()

void NanoCanvas1::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 390 of file canvas.cpp.

◆ fillRect() [1/2]

void NanoCanvas1::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 426 of file canvas.cpp.

◆ fillRect() [2/2]

void NanoCanvas1::fillRect ( const NanoRect rect)

Fills rectangle area

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

Definition at line 471 of file canvas.cpp.

◆ printChar()

void NanoCanvas1::printChar ( uint8_t  c)

Draws single character to canvas

Parameters
c- character code to print

Definition at line 553 of file canvas.cpp.

◆ printFixed()

void NanoCanvas1::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 587 of file canvas.cpp.

◆ printFixedPgm()

void NanoCanvas1::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 598 of file canvas.cpp.

◆ putPixel() [1/2]

void NanoCanvas1::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 346 of file canvas.cpp.

◆ putPixel() [2/2]

void NanoCanvas1::putPixel ( const NanoPoint p)

Draws pixel on specified position

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

Definition at line 362 of file canvas.cpp.

◆ setColor()

void NanoCanvas1::setColor ( uint8_t  color)
inline

Sets color for monochrome operations

Parameters
color- color to set (refer to RGB_COLOR8 definition)
Note
0 means black color 1-255 means white color

Definition at line 736 of file canvas.h.

◆ setMode()

void NanoCanvas1::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 727 of file canvas.h.

◆ setOffset()

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

Sets offset

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

Definition at line 587 of file canvas.h.

◆ write()

void NanoCanvas1::write ( uint8_t  c)

Writes single character to canvas

Parameters
c- character code to print

Definition at line 564 of file canvas.cpp.

Member Data Documentation

◆ BITS_PER_PIXEL

const uint8_t NanoCanvas1::BITS_PER_PIXEL = 1
static

number of bits per single pixel in buffer

Definition at line 529 of file canvas.h.

◆ offset

NanoPoint NanoCanvas1::offset

Fixed offset for all operation of NanoCanvas1 in pixels

Definition at line 532 of file canvas.h.


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