Add 16 bit parallel for RP2040 processor
Correct legacy comments Add ESP32 S3 parallel setup 70d Add setups 105-107 for RP2040 with 16 bit display Add file conversion notes to PNG array example
This commit is contained in:
1 parent
84238dde70
commit
7bf48bb179
24 files changed
+11937
-7175
No files matched your search
@@ -430,7 +430,7 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
||||
|
||||
startWrite(); // Avoid slow ESP32 transaction overhead for every pixel
|
||||
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillheight = 0;
|
||||
|
||||
// Fill area above glyph
|
||||
@@ -438,6 +438,7 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
||||
fillwidth = (cursor_x + gxAdvance[gNum]) - bg_cursor_x;
|
||||
if (fillwidth > 0) {
|
||||
fillheight = gFont.maxAscent - gdY[gNum];
|
||||
// Could be negative
|
||||
if (fillheight > 0) {
|
||||
fillRect(bg_cursor_x, cursor_y, fillwidth, fillheight, textbgcolor);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
public:
|
||||
|
||||
// These are for the new antialiased fonts
|
||||
// These are for the new anti-aliased fonts
|
||||
void loadFont(const uint8_t array[]);
|
||||
#ifdef FONT_FS_AVAILABLE
|
||||
void loadFont(String fontName, fs::FS &ffs);
|
||||
|
||||
+19
-12
@@ -717,7 +717,7 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y, uint16_t transp)
|
||||
// 16bpp -> 16bpp
|
||||
// 16bpp -> 8bpp
|
||||
// 8bpp -> 8bpp
|
||||
// 4bpp -> 4bpp (note: color translation depends on the 2 sprites pallete colors)
|
||||
// 4bpp -> 4bpp (note: color translation depends on the 2 sprites palette colors)
|
||||
// 1bpp -> 1bpp (note: color translation depends on the 2 sprites bitmap colors)
|
||||
|
||||
bool TFT_eSprite::pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y)
|
||||
@@ -1555,7 +1555,7 @@ void TFT_eSprite::fillSprite(uint32_t color)
|
||||
** Function name: width
|
||||
** Description: Return the width of sprite
|
||||
***************************************************************************************/
|
||||
// Return the size of the display
|
||||
// Return the size of the sprite
|
||||
int16_t TFT_eSprite::width(void)
|
||||
{
|
||||
if (!_created ) return 0;
|
||||
@@ -1990,10 +1990,8 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
{
|
||||
if ( _vpOoB || !_created ) return;
|
||||
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum) || // Clip bottom
|
||||
((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum)) // Clip bottom
|
||||
return;
|
||||
|
||||
if (c < 32) return;
|
||||
@@ -2004,6 +2002,10 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
if (((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
return;
|
||||
|
||||
bool fillbg = (bg != color);
|
||||
|
||||
if ((size==1) && fillbg)
|
||||
@@ -2071,15 +2073,20 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
c -= pgm_read_word(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
|
||||
|
||||
uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
h = pgm_read_byte(&glyph->height);
|
||||
//xa = pgm_read_byte(&glyph->xAdvance);
|
||||
|
||||
if (((x + w * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + h * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
return;
|
||||
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
|
||||
uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
int8_t xo = pgm_read_byte(&glyph->xOffset),
|
||||
yo = pgm_read_byte(&glyph->yOffset);
|
||||
uint8_t xx, yy, bits=0, bit=0;
|
||||
//uint8_t xa = pgm_read_byte(&glyph->xAdvance);
|
||||
int16_t xo16 = 0, yo16 = 0;
|
||||
|
||||
if(size > 1) {
|
||||
@@ -2126,7 +2133,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: drawChar
|
||||
** Description: draw a unicode glyph onto the screen
|
||||
** Description: draw a unicode glyph into the sprite
|
||||
***************************************************************************************/
|
||||
// TODO: Rationalise with TFT_eSPI
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
@@ -2473,8 +2480,8 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
||||
int16_t bx = 0;
|
||||
uint8_t pixel = 0;
|
||||
|
||||
int16_t fillwidth = 0;
|
||||
uint16_t fillheight = 0;
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillheight = 0;
|
||||
|
||||
// Fill area above glyph
|
||||
if (_fillbg) {
|
||||
|
||||
+25
-19
@@ -16,9 +16,9 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Sketch can cast returned value to (uint16_t*) for 16 bit depth if needed
|
||||
// RAM required is:
|
||||
// - 1 bit per pixel for 1 bit colour depth
|
||||
// - 1 nibble per pixel for 4 bit colour
|
||||
// - 1 byte per pixel for 8 bit colour
|
||||
// - 2 bytes per pixel for 16 bit color depth
|
||||
// - 1 nibble per pixel for 4 bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8 bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16 bit color depth (565 RGB format)
|
||||
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
// Returns a pointer to the sprite or nullptr if not created, user must cast to pointer type
|
||||
@@ -34,7 +34,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Returns a pointer to the Sprite frame buffer
|
||||
void* frameBuffer(int8_t f);
|
||||
|
||||
// Set or get the colour depth to 4, 8 or 16 bits. Can be used to change depth an existing
|
||||
// Set or get the colour depth to 1, 4, 8 or 16 bits. Can be used to change depth an existing
|
||||
// sprite, but clears it to black, returns a new pointer if sprite is re-created.
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
@@ -52,9 +52,11 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Set foreground and background colours for 1 bit per pixel Sprite
|
||||
void setBitmapColor(uint16_t fg, uint16_t bg);
|
||||
|
||||
// Draw a single pixel at x,y
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color);
|
||||
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t font),
|
||||
// Draw a single character in the GLCD or GFXFF font
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
|
||||
// Fill Sprite with a colour
|
||||
fillSprite(uint32_t color),
|
||||
@@ -62,18 +64,18 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Colours are converted to the set Sprite colour bit depth
|
||||
setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1),
|
||||
// Push a color (aka singe pixel) to the screen
|
||||
// Push a color (aka singe pixel) to the sprite's set window area
|
||||
pushColor(uint16_t color),
|
||||
// Push len colors (pixels) to the screen
|
||||
// Push len colors (pixels) to the sprite's set window area
|
||||
pushColor(uint16_t color, uint32_t len),
|
||||
// Push a pixel preformatted as a 8 or 16 bit colour (avoids conversion overhead)
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16 bit colour (avoids conversion overhead)
|
||||
writeColor(uint16_t color),
|
||||
|
||||
// Set the scroll zone, top left corner at x,y with defined width and height
|
||||
// The colour (optional, black is default) is used to fill the gap after the scroll
|
||||
setScrollRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t color = TFT_BLACK),
|
||||
// Scroll the defined zone dx,dy pixels. Negative values left,up, positive right,down
|
||||
// dy is optional (default is then no up/down scroll).
|
||||
// dy is optional (default is 0, so no up/down scroll).
|
||||
// The sprite coordinate frame does not move because pixels are moved
|
||||
scroll(int16_t dx, int16_t dy = 0),
|
||||
|
||||
@@ -92,9 +94,9 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
uint8_t getRotation(void);
|
||||
|
||||
// Push a rotated copy of Sprite to TFT with optional transparent colour
|
||||
bool pushRotated(int16_t angle, uint32_t transp = 0x00FFFFFF); // Using fixed point maths
|
||||
bool pushRotated(int16_t angle, uint32_t transp = 0x00FFFFFF);
|
||||
// Push a rotated copy of Sprite to another different Sprite with optional transparent colour
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, uint32_t transp = 0x00FFFFFF); // Using fixed point maths
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, uint32_t transp = 0x00FFFFFF);
|
||||
|
||||
// Get the TFT bounding box for a rotated copy of this Sprite
|
||||
bool getRotatedBounds(int16_t angle, int16_t *min_x, int16_t *min_y, int16_t *max_x, int16_t *max_y);
|
||||
@@ -125,10 +127,10 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
bool pushSprite(int32_t tx, int32_t ty, int32_t sx, int32_t sy, int32_t sw, int32_t sh);
|
||||
|
||||
// Push the sprite to another sprite at x,y. This fn calls pushImage() in the destination sprite (dspr) class.
|
||||
// >>>>>> Using a transparent color is not supported at the moment <<<<<<
|
||||
bool pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y);
|
||||
bool pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y, uint16_t transparent);
|
||||
|
||||
// Draw a single character in the selected font
|
||||
int16_t drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font),
|
||||
drawChar(uint16_t uniCode, int32_t x, int32_t y);
|
||||
|
||||
@@ -137,9 +139,13 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
height(void);
|
||||
|
||||
// Functions associated with anti-aliased fonts
|
||||
// Draw a single unicode character using the loaded font
|
||||
void drawGlyph(uint16_t code);
|
||||
// Print string to sprite using loaded font at cursor position
|
||||
void printToSprite(String string);
|
||||
// Print char array to sprite using loaded font at cursor position
|
||||
void printToSprite(char *cbuffer, uint16_t len);
|
||||
// Print indexed glyph to sprite using loaded font at x,y
|
||||
int16_t printToSprite(int16_t x, int16_t y, uint16_t index);
|
||||
|
||||
private:
|
||||
@@ -155,19 +161,19 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
|
||||
protected:
|
||||
|
||||
uint8_t _bpp; // bits per pixel (1, 8 or 16)
|
||||
uint8_t _bpp; // bits per pixel (1, 4, 8 or 16)
|
||||
uint16_t *_img; // pointer to 16 bit sprite
|
||||
uint8_t *_img8; // pointer to 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img8; // pointer to 1 and 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4 bit sprite (uses color map)
|
||||
uint8_t *_img8_1; // pointer to frame 1
|
||||
uint8_t *_img8_2; // pointer to frame 2
|
||||
|
||||
uint16_t *_colorMap; // color map: 16 entries, used with 4 bit color map.
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4 bit color map.
|
||||
|
||||
int32_t _sinra;
|
||||
int32_t _cosra;
|
||||
int32_t _sinra; // Sine of rotation angle in fixed point
|
||||
int32_t _cosra; // Cosine of rotation angle in fixed point
|
||||
|
||||
bool _created; // A Sprite has been created and memory reserved
|
||||
bool _created; // A Sprite has been created and memory reserved
|
||||
bool _gFont = false;
|
||||
|
||||
int32_t _xs, _ys, _xe, _ye, _xptr, _yptr; // for setWindow
|
||||
@@ -176,7 +182,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
uint32_t _scolor; // gap fill colour for scroll zone
|
||||
|
||||
int32_t _iwidth, _iheight; // Sprite memory image bit width and height (swapped during rotations)
|
||||
int32_t _dwidth, _dheight; // Real display width and height (for <8bpp Sprites)
|
||||
int32_t _dwidth, _dheight; // Real sprite width and height (for <8bpp Sprites)
|
||||
int32_t _bitwidth; // Sprite image bit width for drawPixel (for <8bpp Sprites, not swapped)
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user