Skip to content

Commit c39cab5

Browse files
author
Kirk
committed
added addition method sig for bitmap
1 parent af4732f commit c39cab5

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

docs/api_graphics.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@ Draws a bitmap on the screen.
124124

125125
The bitmap should be 8 bit encoded - each pixel contains 8 y values.
126126

127+
```c++
128+
void bitmap(uint8_t x0, uint8_t y0, uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height )
129+
```
130+
131+
| Parameter | Type | Description |
132+
| :--- | :--- | :--- |
133+
| x0 | `uint8_t` | The X coordinate to place the bitmap - upper left corner|
134+
| y0 | `uint8_t` | The Y coordinate to place the bitmap - upper left corner|
135+
| pBitmap | `uint8_t *` | A pointer to the bitmap array|
136+
| bmp_width | `uint8_t` | The width of the bitmap|
137+
| bmp_height | `uint8_t` | The height of the bitmap|
138+
139+
### bitmap()
140+
141+
Draws a bitmap on the screen.
142+
143+
The bitmap should be 8 bit encoded - each pixel contains 8 y values.
144+
145+
The coordinate [x1,y1] allows for only a portion of bitmap to be drawn.
146+
127147
```c++
128148
void bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
129149
uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height )
@@ -138,7 +158,6 @@ void bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
138158
| pBitmap | `uint8_t *` | A pointer to the bitmap array|
139159
| bmp_width | `uint8_t` | The width of the bitmap|
140160
| bmp_height | `uint8_t` | The height of the bitmap|
141-
142161
### bitmap()
143162

144163
Draws a bitmap on the screen using a Bitmap object for the bitmap data.

src/SparkFun_Qwiic_OLED.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,10 @@ class QwiicOLEDBaseClass : public Print { // NOTE: implementing Arduino Print
540540
// --------- -----------------------------
541541
// x0 The X coordinate to place the bitmap - upper left corner
542542
// y0 The Y coordinate to place the bitmap - upper left corner
543-
// x1 The end X coordinate of the bitmap - lower right corner
544-
// y1 The end Y coordinate of the bitmap - lower right corner
543+
// x1 The end X coordinate of area to draw - lower right corner
544+
// Range will not exceed bitmap width
545+
// y1 The end Y coordinate of area to draw - lower right corner
546+
// Range will not exceed bitmap height
545547
// pBitmap A pointer to the bitmap array
546548
// bmp_width The width of the bitmap
547549
// bmp_height The height of the bitmap
@@ -551,6 +553,23 @@ class QwiicOLEDBaseClass : public Print { // NOTE: implementing Arduino Print
551553
_device.bitmap(x0, y0, x1, y1, pBitmap, bmp_width, bmp_height);
552554
}
553555

556+
///////////////////////////////////////////////////////////////////////
557+
// bitmap()
558+
//
559+
// Draws a bitmap on the screen.
560+
//
561+
// Parameter Description
562+
// --------- -----------------------------
563+
// x0 The X coordinate to place the bitmap - upper left corner
564+
// y0 The Y coordinate to place the bitmap - upper left corner
565+
// pBitmap A pointer to the bitmap array
566+
// bmp_width The width of the bitmap
567+
// bmp_height The height of the bitmap
568+
569+
void bitmap(uint8_t x0, uint8_t y0, uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height ){
570+
571+
_device.bitmap(x0, y0, pBitmap, bmp_width, bmp_height);
572+
}
554573
///////////////////////////////////////////////////////////////////////
555574
// bitmap()
556575
//

src/qwiic_grbuffer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,17 @@ void QwGrBufferDevice::bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
519519
(*_idraw.draw_bitmap)(this, x0, y0, x1, y1, pBitmap, bmp_width, bmp_height);
520520
}
521521

522+
////////////////////////////////////////////////////////////////////////////////////////
523+
// bitmap()
524+
//
525+
// Draw a bitmap on the screen
526+
527+
void QwGrBufferDevice::bitmap(uint8_t x0, uint8_t y0, uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height ){
528+
529+
530+
(*_idraw.draw_bitmap)(this, x0, y0, bmp_width, bmp_height, pBitmap, bmp_width, bmp_height);
531+
}
532+
522533
////////////////////////////////////////////////////////////////////////////////////////
523534
// bitmap() - use a bitmap object
524535
//

src/qwiic_grbuffer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ class QwGrBufferDevice : protected _QwIDraw
195195

196196
void bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
197197
uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height );
198+
199+
// draw full bitmap
200+
void bitmap(uint8_t x0, uint8_t y0, uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height );
201+
198202
// Bitmap draw - using a bitmap object
199203
void bitmap(uint8_t x0, uint8_t y0, QwBitmap& bitmap);
200204

0 commit comments

Comments
 (0)