Restructured code, added ST7796
RPi MHS-4.0 inch Display-B type display now supported.
This commit is contained in:
1 parent
b6574ff373
commit
1476da56ba
29 files changed
+2734
-2377
No files matched your search
+1
-124
@@ -57,9 +57,6 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
a zero/one terminated character string giving the font name
|
||||
last byte is 0 for non-anti-aliased and 1 for anti-aliased (smoothed)
|
||||
|
||||
Then the font name seen by Java when it's created
|
||||
Then the postscript name of the font
|
||||
Then a boolean to tell if smoothing is on or not.
|
||||
|
||||
Glyph bitmap example is:
|
||||
// Cursor coordinate positions for this and next character are marked by 'C'
|
||||
@@ -79,7 +76,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
|
||||
// | + x..@@@@@@@..x | x marks the corner pixels of the bitmap
|
||||
// | |
|
||||
// +---------------------------+ yAdvance is y delta for the next line, font size or (ascent + descent)
|
||||
// some fonts can overlay in y direction so may need a user adjust value
|
||||
// some fonts can overlay in y direction so may need a user adjust value
|
||||
|
||||
*/
|
||||
|
||||
@@ -277,126 +274,6 @@ void TFT_eSPI::unloadFont( void )
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: decodeUTF8
|
||||
** Description: Line buffer UTF-8 decoder with fall-back to extended ASCII
|
||||
*************************************************************************************x*/
|
||||
/* Function moved to TFT_eSPI.cpp
|
||||
#define DECODE_UTF8
|
||||
uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
||||
{
|
||||
byte c = buf[(*index)++];
|
||||
//Serial.print("Byte from string = 0x"); Serial.println(c, HEX);
|
||||
|
||||
#ifdef DECODE_UTF8
|
||||
// 7 bit Unicode
|
||||
if ((c & 0x80) == 0x00) return c;
|
||||
|
||||
// 11 bit Unicode
|
||||
if (((c & 0xE0) == 0xC0) && (remaining > 1))
|
||||
return ((c & 0x1F)<<6) | (buf[(*index)++]&0x3F);
|
||||
|
||||
// 16 bit Unicode
|
||||
if (((c & 0xF0) == 0xE0) && (remaining > 2))
|
||||
{
|
||||
c = ((c & 0x0F)<<12) | ((buf[(*index)++]&0x3F)<<6);
|
||||
return c | ((buf[(*index)++]&0x3F));
|
||||
}
|
||||
|
||||
// 21 bit Unicode not supported so fall-back to extended ASCII
|
||||
// if ((c & 0xF8) == 0xF0) return c;
|
||||
#endif
|
||||
|
||||
return c; // fall-back to extended ASCII
|
||||
}
|
||||
*/
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: decodeUTF8
|
||||
** Description: Serial UTF-8 decoder with fall-back to extended ASCII
|
||||
*************************************************************************************x*/
|
||||
/* Function moved to TFT_eSPI.cpp
|
||||
uint16_t TFT_eSPI::decodeUTF8(uint8_t c)
|
||||
{
|
||||
|
||||
#ifdef DECODE_UTF8
|
||||
|
||||
// 7 bit Unicode
|
||||
if ((c & 0x80) == 0x00) {
|
||||
decoderState = 0;
|
||||
return (uint16_t)c;
|
||||
}
|
||||
|
||||
if (decoderState == 0)
|
||||
{
|
||||
// 11 bit Unicode
|
||||
if ((c & 0xE0) == 0xC0)
|
||||
{
|
||||
decoderBuffer = ((c & 0x1F)<<6);
|
||||
decoderState = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 16 bit Unicode
|
||||
if ((c & 0xF0) == 0xE0)
|
||||
{
|
||||
decoderBuffer = ((c & 0x0F)<<12);
|
||||
decoderState = 2;
|
||||
return 0;
|
||||
}
|
||||
// 21 bit Unicode not supported so fall-back to extended ASCII
|
||||
if ((c & 0xF8) == 0xF0) return (uint16_t)c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (decoderState == 2)
|
||||
{
|
||||
decoderBuffer |= ((c & 0x3F)<<6);
|
||||
decoderState--;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
decoderBuffer |= (c & 0x3F);
|
||||
decoderState = 0;
|
||||
return decoderBuffer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
decoderState = 0;
|
||||
return (uint16_t)c; // fall-back to extended ASCII
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: alphaBlend
|
||||
** Description: Blend foreground and background and return new colour
|
||||
*************************************************************************************x*/
|
||||
uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
{
|
||||
// For speed use fixed point maths and rounding to permit a power of 2 division
|
||||
uint16_t fgR = ((fgc >> 10) & 0x3E) + 1;
|
||||
uint16_t fgG = ((fgc >> 4) & 0x7E) + 1;
|
||||
uint16_t fgB = ((fgc << 1) & 0x3E) + 1;
|
||||
|
||||
uint16_t bgR = ((bgc >> 10) & 0x3E) + 1;
|
||||
uint16_t bgG = ((bgc >> 4) & 0x7E) + 1;
|
||||
uint16_t bgB = ((bgc << 1) & 0x3E) + 1;
|
||||
|
||||
// Shift right 1 to drop rounding bit and shift right 8 to divide by 256
|
||||
uint16_t r = (((fgR * alpha) + (bgR * (255 - alpha))) >> 9);
|
||||
uint16_t g = (((fgG * alpha) + (bgG * (255 - alpha))) >> 9);
|
||||
uint16_t b = (((fgB * alpha) + (bgB * (255 - alpha))) >> 9);
|
||||
|
||||
// Combine RGB565 colours into 16 bits
|
||||
//return ((r&0x18) << 11) | ((g&0x30) << 5) | ((b&0x18) << 0); // 2 bit greyscale
|
||||
//return ((r&0x1E) << 11) | ((g&0x3C) << 5) | ((b&0x1E) << 0); // 4 bit greyscale
|
||||
return (r << 11) | (g << 5) | (b << 0);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: readInt32
|
||||
** Description: Get a 32 bit integer from the font file
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
void unloadFont( void );
|
||||
bool getUnicodeIndex(uint16_t unicode, uint16_t *index);
|
||||
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
|
||||
virtual void drawGlyph(uint16_t code);
|
||||
|
||||
void showFont(uint32_t td);
|
||||
|
||||
+196
-9
@@ -269,13 +269,116 @@ int16_t TFT_eSprite::getPivotY(void)
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotated
|
||||
** Description: Push a rotated copy of the Sprite to TFT screen
|
||||
** Function name: pushRotated - Fast fixed point integer maths version
|
||||
** Description: Push rotated Sprite to TFT screen
|
||||
*************************************************************************************x*/
|
||||
#define FP_SCALE 10
|
||||
bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
|
||||
{
|
||||
if ( !_created ) return false;
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinraf = sin(radAngle);
|
||||
float cosraf = cos(radAngle);
|
||||
|
||||
int32_t sinra = sinraf * (1<<FP_SCALE);
|
||||
int32_t cosra = cosraf * (1<<FP_SCALE);
|
||||
|
||||
// Bounding box parameters
|
||||
int16_t min_x;
|
||||
int16_t min_y;
|
||||
int16_t max_x;
|
||||
int16_t max_y;
|
||||
|
||||
// Get the bounding box of this rotated source Sprite relative to Sprite pivot
|
||||
getRotatedBounds(sinraf, cosraf, width(), height(), _xpivot, _ypivot, &min_x, &min_y, &max_x, &max_y);
|
||||
|
||||
// Move bounding box so source Sprite pivot coincides with TFT pivot
|
||||
min_x += _tft->_xpivot;
|
||||
max_x += _tft->_xpivot;
|
||||
min_y += _tft->_ypivot;
|
||||
max_y += _tft->_ypivot;
|
||||
|
||||
// Test only to show bounding box on TFT
|
||||
// _tft->drawRect(min_x, min_y, max_x - min_x + 1, max_y - min_y + 1, TFT_GREEN);
|
||||
|
||||
// Return if bounding box is outside of TFT area
|
||||
if (min_x > _tft->width()) return true;
|
||||
if (min_y > _tft->height()) return true;
|
||||
if (max_x < 0) return true;
|
||||
if (max_y < 0) return true;
|
||||
|
||||
// Clip bounding box to be within TFT area
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > _tft->width()) max_x = _tft->width();
|
||||
if (max_y > _tft->height()) max_y = _tft->height();
|
||||
|
||||
uint16_t sline_buffer[max_y - min_y + 1];
|
||||
|
||||
int32_t xt = min_x - _tft->_xpivot;
|
||||
int32_t yt = min_y - _tft->_ypivot;
|
||||
|
||||
// Keep multiply out of the loop
|
||||
int32_t cxt = cosra * xt + (_xpivot<<FP_SCALE);
|
||||
int32_t sxt = sinra * xt + (_ypivot<<FP_SCALE);
|
||||
int32_t init_cyt = cosra * yt;
|
||||
int32_t init_syt = sinra * yt;
|
||||
|
||||
_tft->startWrite(); // ESP32: avoid transaction overhead for every tft pixel
|
||||
|
||||
// Scan destination bounding box and fetch transformed pixels from source Sprite
|
||||
for (int32_t x = min_x; x <= max_x; x++) {
|
||||
cxt += cosra;
|
||||
sxt += sinra;
|
||||
bool column_drawn = false;
|
||||
uint32_t pixel_count = 0;
|
||||
int32_t y_start = 0;
|
||||
int32_t xs = cxt - init_syt;
|
||||
int32_t cyt = init_cyt;
|
||||
for (int32_t y = min_y; y <= max_y; y++) {
|
||||
cyt += cosra;
|
||||
xs -= sinra;
|
||||
// Do not calculate yp unless xp is in bounds
|
||||
int32_t xp = truncateFP(xs, FP_SCALE);
|
||||
if ((xp >= 0) && (xp < _iwidth))
|
||||
{
|
||||
int32_t yp = truncateFP(sxt + cyt, FP_SCALE);
|
||||
// Check if yp is in bounds
|
||||
if ((yp >= 0) && (yp < _iheight)) {
|
||||
uint32_t rp;
|
||||
if (_bpp == 16) {rp = _img[xp + yp * _iwidth]; rp = rp>>8 | rp<<8; }
|
||||
else rp = readPixel(xp, yp);
|
||||
if (transp >= 0 ) {
|
||||
if (rp != transp) _tft->drawPixel(x, y, rp);
|
||||
}
|
||||
else {
|
||||
if (!column_drawn) y_start = y;
|
||||
sline_buffer[pixel_count++] = rp>>8 | rp<<8;
|
||||
}
|
||||
column_drawn = true;
|
||||
}
|
||||
}
|
||||
else if (column_drawn) y = max_y; // Skip remaining column pixels
|
||||
}
|
||||
if (pixel_count) _tft->pushImage(x, y_start, 1, pixel_count, sline_buffer);
|
||||
}
|
||||
|
||||
_tft->endWrite(); // ESP32: end transaction
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotatedHP - Higher Precision version of pushRotated
|
||||
** Description: Push rotated Sprite to TFT screen
|
||||
*************************************************************************************x*/
|
||||
bool TFT_eSprite::pushRotatedHP(int16_t angle, int32_t transp)
|
||||
{
|
||||
if ( !_created ) return false;
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinra = sin(radAngle);
|
||||
@@ -308,7 +411,7 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
|
||||
// Clip bounding box to be within TFT area
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > _tft->width()) max_x = _tft->width();
|
||||
if (max_x > _tft->width()) max_x = _tft->width();
|
||||
if (max_y > _tft->height()) max_y = _tft->height();
|
||||
|
||||
_tft->startWrite(); // ESP32: avoid transaction overhead for every tft pixel
|
||||
@@ -344,7 +447,7 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotated
|
||||
** Function name: pushRotated - Fast fixed point integer maths version
|
||||
** Description: Push a rotated copy of the Sprite to another Sprite
|
||||
*************************************************************************************x*/
|
||||
bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
|
||||
@@ -352,6 +455,89 @@ bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
|
||||
if ( !_created ) return false; // Check this Sprite is created
|
||||
if ( !spr->_created ) return false; // Ckeck destination Sprite is created
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinraf = sin(radAngle);
|
||||
float cosraf = cos(radAngle);
|
||||
|
||||
int32_t sinra = sinraf * (1<<FP_SCALE);
|
||||
int32_t cosra = cosraf * (1<<FP_SCALE);
|
||||
|
||||
// Bounding box parameters
|
||||
int16_t min_x;
|
||||
int16_t min_y;
|
||||
int16_t max_x;
|
||||
int16_t max_y;
|
||||
|
||||
// Get the bounding box of this rotated source Sprite
|
||||
getRotatedBounds(sinraf, cosraf, width(), height(), _xpivot, _ypivot, &min_x, &min_y, &max_x, &max_y);
|
||||
|
||||
// Move bounding box so source Sprite pivot coincides with destination Sprite pivot
|
||||
min_x += spr->_xpivot;
|
||||
max_x += spr->_xpivot;
|
||||
min_y += spr->_ypivot;
|
||||
max_y += spr->_ypivot;
|
||||
|
||||
// Test only to show bounding box
|
||||
// spr->fillSprite(TFT_BLACK);
|
||||
// spr->drawRect(min_x, min_y, max_x - min_x + 1, max_y - min_y + 1, TFT_GREEN);
|
||||
|
||||
// Return if bounding box is completely outside of destination Sprite
|
||||
if (min_x > spr->width()) return true;
|
||||
if (min_y > spr->height()) return true;
|
||||
if (max_x < 0) return true;
|
||||
if (max_y < 0) return true;
|
||||
|
||||
// Clip bounding box if it is partially within destination Sprite
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > spr->width()) max_x = spr->width();
|
||||
if (max_y > spr->height()) max_y = spr->height();
|
||||
|
||||
// Scan destination bounding box and fetch transformed pixels from source Sprite
|
||||
for (int32_t x = min_x; x <= max_x; x++)
|
||||
{
|
||||
int32_t xt = x - spr->_xpivot;
|
||||
float cxt = cosra * xt + (_xpivot<<FP_SCALE);
|
||||
float sxt = sinra * xt + (_ypivot<<FP_SCALE);
|
||||
bool column_drawn = false;
|
||||
for (int32_t y = min_y; y <= max_y; y++)
|
||||
{
|
||||
int32_t yt = y - spr->_ypivot;
|
||||
int32_t xs = cxt - sinra * yt;
|
||||
// Do not calculate yp unless xp is in bounds
|
||||
int32_t xp = truncateFP(xs, FP_SCALE);
|
||||
if (xp >= 0 && xp < _iwidth)
|
||||
{
|
||||
int32_t ys = sxt + cosra * yt;
|
||||
// Check if ys is in bounds
|
||||
int32_t yp = truncateFP(ys, FP_SCALE);
|
||||
if (yp >= 0 && yp < _iheight)
|
||||
{
|
||||
uint32_t rp;
|
||||
if (_bpp == 16) {rp = _img[xp + yp * _iwidth]; rp = rp>>8 | rp<<8; }
|
||||
else rp = readPixel(xp, yp);
|
||||
if (rp != transp) spr->drawPixel(x, y, rp);
|
||||
column_drawn = true;
|
||||
}
|
||||
}
|
||||
else if (column_drawn) y = max_y; // Skip the remaining pixels below the Sprite
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: pushRotated - Higher Precision version of pushRotated
|
||||
** Description: Push a rotated copy of the Sprite to another Sprite
|
||||
*************************************************************************************x*/
|
||||
bool TFT_eSprite::pushRotatedHP(TFT_eSprite *spr, int16_t angle, int32_t transp)
|
||||
{
|
||||
if ( !_created ) return false; // Check this Sprite is created
|
||||
if ( !spr->_created ) return false; // Ckeck destination Sprite is created
|
||||
|
||||
// Trig values for the rotation
|
||||
float radAngle = -angle * 0.0174532925; // Convert degrees to radians
|
||||
float sinra = sin(radAngle);
|
||||
@@ -385,7 +571,7 @@ bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
|
||||
// Clip bounding box if it is partially within destination Sprite
|
||||
if (min_x < 0) min_x = 0;
|
||||
if (min_y < 0) min_y = 0;
|
||||
if (max_x > spr->width()) max_x = spr->width();
|
||||
if (max_x > spr->width()) max_x = spr->width();
|
||||
if (max_y > spr->height()) max_y = spr->height();
|
||||
|
||||
// Scan destination bounding box and fetch transformed pixels from source Sprite
|
||||
@@ -516,7 +702,7 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y, uint16_t transp)
|
||||
*************************************************************************************x*/
|
||||
uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y)
|
||||
{
|
||||
if ((x < 0) || (x >= _iwidth) || (y < 0) || (y >= _iheight) || !_created) return 0;
|
||||
if ((x < 0) || (x >= _iwidth) || (y < 0) || (y >= _iheight) || !_created) return 0xFFFF;
|
||||
|
||||
if (_bpp == 16)
|
||||
{
|
||||
@@ -557,7 +743,8 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y)
|
||||
|
||||
uint16_t color = (_img8[(x + y * _bitwidth)>>3] << (x & 0x7)) & 0x80;
|
||||
|
||||
return color >> 7;
|
||||
if (color >> 7) return _tft->bitmap_fg;
|
||||
else return _tft->bitmap_bg;
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,7 +1335,7 @@ void TFT_eSprite::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint3
|
||||
{
|
||||
if (!_created ) return;
|
||||
|
||||
boolean steep = abs(y1 - y0) > abs(x1 - x0);
|
||||
bool steep = abs(y1 - y0) > abs(x1 - x0);
|
||||
if (steep) {
|
||||
swap_coord(x0, y0);
|
||||
swap_coord(x1, y1);
|
||||
@@ -1492,7 +1679,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
boolean fillbg = (bg != color);
|
||||
bool fillbg = (bg != color);
|
||||
|
||||
if ((size==1) && fillbg)
|
||||
{
|
||||
|
||||
+28
-11
@@ -5,22 +5,29 @@
|
||||
// graphics are written to the Sprite rather than the TFT.
|
||||
***************************************************************************************/
|
||||
|
||||
// pushRotated support - Bitwise truncation of fixed point integer value V scaled by S
|
||||
//#define truncateFP(V,S) ((V + (V < 0 ? -1<<(S-1) : 0))>>S)
|
||||
#define truncateFP(V,S) ((V + (V < 0 ? -1<<(S-1) : 1<<(S-1)))>>S)
|
||||
|
||||
class TFT_eSprite : public TFT_eSPI {
|
||||
|
||||
public:
|
||||
|
||||
TFT_eSprite(TFT_eSPI *tft);
|
||||
virtual ~TFT_eSprite();
|
||||
|
||||
// Create a sprite of width x height pixels, return a pointer to the RAM area
|
||||
// Sketch can cast returned value to (uint16_t*) for 16 bit depth if needed
|
||||
// RAM required is 1 byte per pixel for 8 bit colour depth, 2 bytes for 16 bit
|
||||
// RAM required is:
|
||||
// - 1 bit per pixel for 1 bit colour depth
|
||||
// - 1 byte per pixel for 8 bit colour
|
||||
// - 2 bytes per pixel for 16 bit color depth
|
||||
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
// Delete the sprite to free up the RAM
|
||||
void deleteSprite(void);
|
||||
|
||||
// Select the frame buffer for graphics
|
||||
// Select the frame buffer for graphics write (for 2 colour ePaper and DMA toggle buffer)
|
||||
// Returns a pointer to the Sprite frame buffer
|
||||
void* frameBuffer(int8_t f);
|
||||
|
||||
// Set or get the colour depth to 8 or 16 bits. Can be used to change depth an existing
|
||||
@@ -28,18 +35,22 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
|
||||
void setBitmapColor(uint16_t c, uint16_t b);
|
||||
// Set foreground and background colours for 1 bit per pixel Sprite
|
||||
void setBitmapColor(uint16_t fg, uint16_t bg);
|
||||
|
||||
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 size),
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t font),
|
||||
|
||||
// Fill Sprite with a colour
|
||||
fillSprite(uint32_t color),
|
||||
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Colours are converted to 8 bit if depth is set to 8
|
||||
// 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
|
||||
pushColor(uint32_t color),
|
||||
// Push len colors (pixels) to the screen
|
||||
pushColor(uint32_t color, uint16_t len),
|
||||
// Push a pixel preformatted as a 8 or 16 bit colour (avoids conversion overhead)
|
||||
writeColor(uint16_t color),
|
||||
@@ -52,23 +63,29 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// The sprite coordinate frame does not move because pixels are moved
|
||||
scroll(int16_t dx, int16_t dy = 0),
|
||||
|
||||
// Draw lines
|
||||
drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color),
|
||||
drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color),
|
||||
drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color),
|
||||
|
||||
// Fill a rectangular area with a color (aka draw a filled rectangle)
|
||||
fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color);
|
||||
|
||||
// Set the sprite text cursor position for print class (does not change the TFT screen cursor)
|
||||
//setCursor(int16_t x, int16_t y);
|
||||
//setCursor(int16_t x, int16_t y); // Not needed, so uses TFT class function
|
||||
|
||||
// Set the rotation of the Sprite (for 1bpp Sprites only)
|
||||
// Set the coordinate rotation of the Sprite (for 1bpp Sprites only)
|
||||
// Note: this uses coordinate rotation and is primarily for ePaper which does not support
|
||||
// CGRAM rotation (like TFT drivers do) within the displays internal hardware
|
||||
void setRotation(uint8_t rotation);
|
||||
uint8_t getRotation(void);
|
||||
|
||||
// Push a rotated copy of Sprite to TFT with optional transparent colour
|
||||
bool pushRotated(int16_t angle, int32_t transp = -1);
|
||||
bool pushRotated(int16_t angle, int32_t transp = -1); // Using fixed point maths
|
||||
bool pushRotatedHP(int16_t angle, int32_t transp = -1); // Using higher precision floating point maths
|
||||
// Push a rotated copy of Sprite to another different Sprite with optional transparent colour
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp = -1);
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp = -1); // Using fixed point maths
|
||||
bool pushRotatedHP(TFT_eSprite *spr, int16_t angle, int32_t transp = -1); // Using higher precision floating point maths
|
||||
// Set and get the pivot point for this Sprite
|
||||
void setPivot(int16_t x, int16_t y);
|
||||
int16_t getPivotX(void),
|
||||
@@ -138,7 +155,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
uint32_t _sw, _sh; // w,h for scroll zone
|
||||
uint32_t _scolor; // gap fill colour for scroll zone
|
||||
|
||||
boolean _iswapBytes; // Swap the byte order for Sprite pushImage()
|
||||
bool _iswapBytes; // Swap the byte order for Sprite pushImage()
|
||||
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user