display support for larger pictures

This commit is contained in:
gemu2015 2021-01-08 11:49:07 +01:00
parent ff631ac322
commit 0b12c6a514
14 changed files with 32 additions and 19 deletions

View File

@ -1579,7 +1579,7 @@ void Adafruit_GFX_Button::initButtonUL(
strncpy(_label, label, 9);
}
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, bool inverted);
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, uint32_t ocolor, bool inverted);
/**************************************************************************/
/*!
@ -1601,8 +1601,7 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
}
if (_label[0]=='/') {
// picture path
draw_picture(_label, _x1, _y1, _w, _h, inverted);
draw_picture(_label, _x1, _y1, _w, _h, outline, inverted);
_gfx->drawRect(_x1, _y1, _w, _h, text);
} else {
uint8_t r = min(_w, _h) / 4; // Corner radius

View File

@ -514,7 +514,7 @@ void SSD1351::setAddrWindow(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
if (flag) stop();
}
void SSD1351::pushColors(uint16_t *data, uint8_t len, boolean first) {
void SSD1351::pushColors(uint16_t *data, uint16_t len, boolean first) {
for (uint16_t b=0; b<len; b++){
write16BitColor(*data++);
}

View File

@ -99,7 +99,7 @@ class SSD1351 : public Renderer {
void DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font);
void setAddrWindow_i(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void pushColors(uint16_t *data, uint8_t len, boolean first);
void pushColors(uint16_t *data, uint16_t len, boolean first);
void drawPixel(int16_t x, int16_t y, uint16_t color);
void write16BitColor(uint16_t color);
void setRotation(uint8_t r);

View File

@ -611,7 +611,7 @@ void Arduino_ST7789::pushColor(uint16_t color) {
SPI_END_TRANSACTION();
}
void Arduino_ST7789::pushColors(uint16_t *data, uint8_t len, boolean first) {
void Arduino_ST7789::pushColors(uint16_t *data, uint16_t len, boolean first) {
uint16_t color;
SPI_BEGIN_TRANSACTION();

View File

@ -152,7 +152,7 @@ class Arduino_ST7789 : public Renderer {
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return Color565(r, g, b); }
void DisplayOnff(int8_t on);
void dim(uint8_t contrast);
void pushColors(uint16_t *data, uint8_t len, boolean first);
void pushColors(uint16_t *data, uint16_t len, boolean first);
protected:
uint8_t _colstart, _rowstart, _xstart, _ystart; // some displays need this changed

View File

@ -292,7 +292,7 @@ void ILI9341_2::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1
}
}
void ILI9341_2::pushColors(uint16_t *data, uint8_t len, boolean first) {
void ILI9341_2::pushColors(uint16_t *data, uint16_t len, boolean first) {
uint16_t color;
while (len--) {

View File

@ -136,7 +136,7 @@ class ILI9341_2 : public Renderer {
void fillScreen(uint16_t color);
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
void dim(uint8_t dim);
void pushColors(uint16_t *data, uint8_t len, boolean first);
void pushColors(uint16_t *data, uint16_t len, boolean first);
void invertDisplay(boolean i);
void spiwrite(uint8_t c);
void spiwrite16(uint16_t c);

View File

@ -605,7 +605,7 @@ void ILI9488::pushColor(uint16_t color) {
}
#if 1
void ILI9488::pushColors(uint16_t *data, uint8_t len, boolean first) {
void ILI9488::pushColors(uint16_t *data, uint16_t len, boolean first) {
uint16_t color;
uint8_t buff[len*3+1];
uint16_t count = 0;

View File

@ -141,7 +141,7 @@ class ILI9488 : public Renderer {
void setScrollArea(uint16_t topFixedArea, uint16_t bottomFixedArea);
void scroll(uint16_t pixels);
void pushColor(uint16_t color);
void pushColors(uint16_t *data, uint8_t len, boolean first);
void pushColors(uint16_t *data, uint16_t len, boolean first);
//void drawImage(const uint8_t* img, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void fillScreen(uint16_t color);
void drawPixel(int16_t x, int16_t y, uint16_t color);

View File

@ -932,18 +932,28 @@ void RA8876::setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
SPI.endTransaction();
}
void RA8876::pushColors(uint16_t *data, uint8_t len, boolean first) {
void RA8876::pushColors(uint16_t *data, uint16_t len, boolean first) {
SPI.beginTransaction(m_spiSettings);
//RA8876_CS_LOW
while (len--) {
//uint16_t color=RA8876_WHITE;
uint16_t color=*data++;
#if 0
SPI.transfer(RA8876_DATA_WRITE);
SPI.transfer(color&0xff);
SPI.transfer(RA8876_DATA_WRITE);
SPI.transfer(color>>8);
#else
//waitWriteFifo();
writeData(color&0xff);
//waitWriteFifo();
writeData(color>>8);
#endif
}
//RA8876_CS_HIGH
SPI.endTransaction();
}

View File

@ -472,7 +472,7 @@ class RA8876 : public Renderer {
int getCursorY(void);
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
void pushColors(uint16_t *data, uint8_t len, boolean first);
void pushColors(uint16_t *data, uint16_t len, boolean first);
// Text
void selectInternalFont(enum FontSize size, enum FontEncoding enc = RA8876_FONT_ENCODING_8859_1);

View File

@ -66,7 +66,7 @@ void Renderer::dim(uint8_t contrast) {
}
void Renderer::pushColors(uint16_t *data, uint8_t len, boolean first) {
void Renderer::pushColors(uint16_t *data, uint16_t len, boolean first) {
}

View File

@ -33,7 +33,7 @@ public:
virtual void Begin(int16_t p1,int16_t p2,int16_t p3);
virtual void Updateframe();
virtual void dim(uint8_t contrast);
virtual void pushColors(uint16_t *data, uint8_t len, boolean first);
virtual void pushColors(uint16_t *data, uint16_t len, boolean first);
virtual void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
virtual void invertDisplay(boolean i);
void setDrawMode(uint8_t mode);

View File

@ -1543,7 +1543,7 @@ void CmndDisplayRows(void)
#ifdef USE_TOUCH_BUTTONS
// very limited path size, so, add .jpg
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, bool inverted) {
void draw_picture(char *path, uint32_t xp, uint32_t yp, uint32_t xs, uint32_t ys, uint32_t ocol, bool inverted) {
char ppath[16];
strcpy(ppath, path);
uint8_t plen = strlen(path) -1;
@ -1554,7 +1554,11 @@ char ppath[16];
}
inverted = false;
}
strcat(ppath, ".jpg");
if (ocol == 9) {
strcat(ppath, ".rgb");
} else {
strcat(ppath, ".jpg");
}
Draw_RGB_Bitmap(ppath, xp, yp, inverted);
}
#endif