Skip to content

Commit

Permalink
add draw16bitBeRGBBitmapR1()
Browse files Browse the repository at this point in the history
  • Loading branch information
moononournation committed Sep 8, 2024
1 parent 8a89487 commit 88252bc
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Arduino_GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,36 @@ void Arduino_GFX::draw16bitBeRGBBitmap(int16_t x, int16_t y,
endWrite();
}

#if !defined(LITTLE_FOOT_PRINT)
/**************************************************************************/
/*!
@brief Draw a RAM-resident 16-bit Big Endian image (RGB 5/6/5) in rotation 1 at the specified (x,y) position.
@param x Top left corner x coordinate
@param y Top left corner y coordinate
@param bitmap byte array with 16-bit color bitmap
@param w Width of bitmap in pixels
@param h Height of bitmap in pixels
*/
/**************************************************************************/
void Arduino_GFX::draw16bitBeRGBBitmapR1(int16_t x, int16_t y,
uint16_t *bitmap, int16_t w, int16_t h)
{
int32_t offset = 0;
uint16_t p;
startWrite();
for (int16_t j = 0; j < h; j++)
{
for (int16_t i = 0; i < w; i++)
{
p = bitmap[offset++];
MSB_16_SET(p, p);
writePixel(x + w - j - 1, y + i, p);
}
}
endWrite();
}
#endif // !defined(LITTLE_FOOT_PRINT)

/**************************************************************************/
/*!
@brief Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask
Expand Down
2 changes: 2 additions & 0 deletions src/Arduino_GFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class Arduino_GFX : public Print, public Arduino_G
virtual void draw24bitRGBBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h);
virtual void draw24bitRGBBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h);
virtual void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg);

virtual void draw16bitBeRGBBitmapR1(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h);
#endif // !defined(LITTLE_FOOT_PRINT)

/**********************************************************************/
Expand Down
31 changes: 31 additions & 0 deletions src/Arduino_TFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,37 @@ void Arduino_TFT::draw16bitBeRGBBitmap(
}
}

void Arduino_TFT::draw16bitBeRGBBitmapR1(
int16_t x, int16_t y,
uint16_t *bitmap, int16_t w, int16_t h)
{
if (
((x + h - 1) < 0) || // Outside left
((y + w - 1) < 0) || // Outside top
(x > _max_x) || // Outside right
(y > _max_y) // Outside bottom
)
{
return;
}
else if (
(x < 0) || // Clip left
(y < 0) || // Clip top
((x + h - 1) > _max_x) || // Clip right
((y + w - 1) > _max_y) // Clip bottom
)
{
Arduino_GFX::draw16bitBeRGBBitmapR1(x, y, bitmap, w, h);
}
else
{
startWrite();
writeAddrWindow(x, y, w, h);
_bus->write16bitBeRGBBitmapR1(bitmap, w, h);
endWrite();
}
}

void Arduino_TFT::draw24bitRGBBitmap(
int16_t x, int16_t y,
const uint8_t bitmap[], int16_t w, int16_t h)
Expand Down
1 change: 1 addition & 0 deletions src/Arduino_TFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Arduino_TFT : public Arduino_GFX
void draw16bitRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h) override;
void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void draw16bitBeRGBBitmapR1(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void draw24bitRGBBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h) override;
void draw24bitRGBBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) override;
void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg) override;
Expand Down

0 comments on commit 88252bc

Please sign in to comment.