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

#include <canvas.h>

Public Member Functions

 NanoCanvas16 ()
 
 NanoCanvas16 (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 (uint16_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 = 16
 

Detailed Description

NanoCanvas16 represents objects for drawing in memory buffer NanoCanvas16 represents each pixel as 2-bytes with RGB bits: RRRRRGGG-GGGBBBBB For details refer to SSD1351 datasheet

Definition at line 772 of file canvas.h.

Constructor & Destructor Documentation

◆ NanoCanvas16() [1/2]

NanoCanvas16::NanoCanvas16 ( )
inline

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

Definition at line 786 of file canvas.h.

◆ NanoCanvas16() [2/2]

NanoCanvas16::NanoCanvas16 ( 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 800 of file canvas.h.

Member Function Documentation

◆ begin()

void NanoCanvas16::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 815 of file canvas.h.

◆ blt() [1/2]

void NanoCanvas16::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 925 of file canvas.cpp.

◆ blt() [2/2]

void NanoCanvas16::blt ( )

Draws canvas on the LCD display using offset values.

Definition at line 930 of file canvas.cpp.

◆ clear()

void NanoCanvas16::clear ( )

Clears canvas

Definition at line 915 of file canvas.cpp.

◆ drawBitmap1()

void NanoCanvas16::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 745 of file canvas.cpp.

◆ drawBitmap8()

void NanoCanvas16::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 809 of file canvas.cpp.

◆ drawHLine()

void NanoCanvas16::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 670 of file canvas.cpp.

◆ drawRect() [1/2]

void NanoCanvas16::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 692 of file canvas.cpp.

◆ drawRect() [2/2]

void NanoCanvas16::drawRect ( const NanoRect rect)

Draws rectangle

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

Definition at line 700 of file canvas.cpp.

◆ drawVLine()

void NanoCanvas16::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 647 of file canvas.cpp.

◆ fillRect() [1/2]

void NanoCanvas16::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 705 of file canvas.cpp.

◆ fillRect() [2/2]

void NanoCanvas16::fillRect ( const NanoRect rect)

Fills rectangle area

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

Definition at line 738 of file canvas.cpp.

◆ printChar()

void NanoCanvas16::printChar ( uint8_t  c)

Draws single character to canvas

Parameters
c- character code to print

Definition at line 858 of file canvas.cpp.

◆ printFixed()

void NanoCanvas16::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 891 of file canvas.cpp.

◆ printFixedPgm()

void NanoCanvas16::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 902 of file canvas.cpp.

◆ putPixel() [1/2]

void NanoCanvas16::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 631 of file canvas.cpp.

◆ putPixel() [2/2]

void NanoCanvas16::putPixel ( const NanoPoint p)

Draws pixel on specified position

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

Definition at line 642 of file canvas.cpp.

◆ setColor()

void NanoCanvas16::setColor ( uint16_t  color)
inline

Sets color for monochrome operations

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

Definition at line 983 of file canvas.h.

◆ setMode()

void NanoCanvas16::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 977 of file canvas.h.

◆ setOffset()

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

Sets offset

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

Definition at line 837 of file canvas.h.

◆ write()

void NanoCanvas16::write ( uint8_t  c)

Writes single character to canvas

Parameters
c- character code to print

Definition at line 868 of file canvas.cpp.

Member Data Documentation

◆ BITS_PER_PIXEL

const uint8_t NanoCanvas16::BITS_PER_PIXEL = 16
static

number of bits per single pixel in buffer

Definition at line 776 of file canvas.h.

◆ offset

NanoPoint NanoCanvas16::offset

Fixed offset for all operation of NanoCanvas8 in pixels

Definition at line 779 of file canvas.h.


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