27 #include <avr/pgmspace.h>
48 int width()
const {
return _width; }
49 int height()
const {
return _height; }
50 int stride()
const {
return _stride; }
53 uint8_t *
data() {
return fb; }
54 const uint8_t *
data()
const {
return fb; }
78 void drawText(
int x,
int y,
const char *str,
int len = -1);
79 void drawText(
int x,
int y,
const String &str,
int start = 0,
int len = -1);
84 int textWidth(
const char *str,
int len = -1)
const;
85 int textWidth(
const String &str,
int start = 0,
int len = -1)
const;
88 void copy(
int x,
int y,
int width,
int height,
Bitmap *dest,
int destX,
int destY);
89 void fill(
int x,
int y,
int width,
int height,
Color color);
93 void scroll(
int x,
int y,
int width,
int height,
int dx,
int dy,
Color fillColor =
Black);
95 void invert(
int x,
int y,
int width,
int height);
111 void blit(
int x1,
int y1,
int x2,
int y2,
int x3,
int y3);
112 void drawCirclePoints(
int centerX,
int centerY,
int radius,
int x,
int y,
Color borderColor,
Color fillColor);
117 drawRect(x1, y1, x2, y2, color, color);
122 drawCircle(centerX, centerY, radius, color, color);
137 scroll(0, 0, _width, _height, dx, dy, fillColor);
Handle large dot matrix displays composed of LED's.
int width() const
Returns the width of the bitmap in pixels.
void copy(int x, int y, int width, int height, Bitmap *dest, int destX, int destY)
Copies the width x height pixels starting at top-left corner (x, y) to (destX, destY) in the bitmap d...
void scroll(int dx, int dy, Color fillColor=Black)
Scrolls the entire contents of the bitmap by dx and dy.
Represents a monochrome bitmap within main memory.
void drawRect(int x1, int y1, int x2, int y2, Color borderColor=White, Color fillColor=NoFill)
Draws a rectangle from (x1, y1) to (x2, y2), with the outline in borderColor and the interior filled ...
void setPixel(int x, int y, Color color)
Sets the pixel at (x, y) to color.
void drawFilledCircle(int centerX, int centerY, int radius, Color color=White)
Draws a filled circle with a specific center (centerX, centerY) and radius in color.
void drawLine(int x1, int y1, int x2, int y2, Color color=White)
Draws a line from (x1, y1) to (x2, y2) in color.
void drawBitmap(int x, int y, const Bitmap &bitmap, Color color=White)
Draws bitmap at (x, y) in color.
void drawFilledRect(int x1, int y1, int x2, int y2, Color color=White)
Draws a filled rectangle from (x1, y1) to (x2, y2) in color.
void drawInvertedBitmap(int x, int y, const Bitmap &bitmap)
Draws bitmap at (x, y) in inverted colors.
int bitsPerPixel() const
Returns the number of bits per pixel for the bitmap; always 1.
void drawCircle(int centerX, int centerY, int radius, Color borderColor=White, Color fillColor=NoFill)
Draws a circle with a specific center (centerX, centerY) and radius, with the outline in borderColor ...
void setTextColor(Color color)
Sets the color that will be used for drawing text with drawText() and drawChar(). ...
int drawChar(int x, int y, char ch)
Draws a single character ch at (x, y).
PGM_VOID_P ProgMem
Type that represents a bitmap within program memory.
uint8_t Color
Type that represents the color of a pixel in a bitmap.
Color textColor() const
Returns the color that will be used for drawing text with drawText() and drawChar(). The default is White.
int height() const
Returns the height of the bitmap in pixels.
static const Color NoFill
Special color value that is used with drawRect() and drawCircle() to indicate that the interior of th...
int textWidth(const char *str, int len=-1) const
Returns the width in pixels of the len characters of str in the current font(), including inter-chara...
void fill(int x, int y, int width, int height, Color color)
Fills the width x height pixels starting at top-left corner (x, y) with color.
const uint8_t * data() const
Returns a constant pointer to the start of the bitmap's data buffer. This is an overloaded member fun...
uint8_t * data()
Returns a pointer to the start of the bitmap's data buffer.
int textHeight() const
Returns the height in pixels of the current text drawing font(); or zero if font() is not set...
int charWidth(char ch) const
Returns the width in pixels of ch in the current font().
Bitmap(int width, int height)
Constructs a new in-memory bitmap that is width x height pixels in size.
bool isValid() const
Returns true if the memory for this bitmap is valid; false otherwise.
static const Color White
Color value corresponding to "white". If the bitmap is displayed on a LED array, then it may have a d...
Font font() const
Returns the currently selected font, or null if none selected.
int stride() const
Returns the number of bytes in each line of the bitmap's data() buffer.
static const Color Black
Color value corresponding to "black".
void clear(Color color=Black)
Clears the entire bitmap to the specified color.
PGM_VOID_P Font
Type that represents a font within program memory.
void setFont(Font font)
Sets the font for use with drawText() and drawChar().
void invert(int x, int y, int width, int height)
Inverts the width x height pixels starting at top-left corner (x, y).
void drawText(int x, int y, const char *str, int len=-1)
Draws the len characters of str at (x, y).
~Bitmap()
Destroys this bitmap.
Color pixel(int x, int y) const
Returns the color of the pixel at (x, y); either Black or White.