Update for Pico W, update sprite smooth font rendering

Update example for Pico W

If a background colour is not specified for smooth font rendering in a sprite then read the sprite background pixel colour.
This commit is contained in:
Bodmer 2022-07-22 20:16:56 +01:00
parent ec23732c11
commit cc9787deaf
6 changed files with 9 additions and 7 deletions

View File

@ -2417,6 +2417,8 @@ void TFT_eSprite::drawGlyph(uint16_t code)
{ {
uint16_t fg = textcolor; uint16_t fg = textcolor;
uint16_t bg = textbgcolor; uint16_t bg = textbgcolor;
bool getBG = false;
if (fg == bg) getBG = true;
// Check if cursor has moved // Check if cursor has moved
if (last_cursor_x != cursor_x) if (last_cursor_x != cursor_x)
@ -2551,7 +2553,7 @@ void TFT_eSprite::drawGlyph(uint16_t code)
else drawFastHLine( fxs, y + cy, fl, fg); else drawFastHLine( fxs, y + cy, fl, fg);
fl = 0; fl = 0;
} }
if (getColor) bg = getColor(x + cx, y + cy); if (getBG) bg = readPixel(x + cx, y + cy);
drawPixel(x + cx, y + cy, alphaBlend(pixel, fg, bg)); drawPixel(x + cx, y + cy, alphaBlend(pixel, fg, bg));
} }
else else

View File

@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_ #ifndef _TFT_eSPIH_
#define _TFT_eSPIH_ #define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.4.73" #define TFT_ESPI_VERSION "2.4.74"
// Bit level feature flags // Bit level feature flags
// Bit 0 set: viewport capability // Bit 0 set: viewport capability

View File

@ -129,7 +129,7 @@ static void renderFace(float t) {
face.setTextDatum(MC_DATUM); face.setTextDatum(MC_DATUM);
// The background colour will be read during the character rendering // The background colour will be read during the character rendering
face.setTextColor(CLOCK_FG); face.setTextColor(CLOCK_FG, CLOCK_BG);
// Text offset adjustment // Text offset adjustment
constexpr uint32_t dialOffset = CLOCK_R - 10; constexpr uint32_t dialOffset = CLOCK_R - 10;
@ -143,7 +143,7 @@ static void renderFace(float t) {
} }
// Add text (could be digital time...) // Add text (could be digital time...)
face.setTextColor(LABEL_FG); face.setTextColor(LABEL_FG, CLOCK_BG);
face.drawString("TFT_eSPI", CLOCK_R, CLOCK_R * 0.75); face.drawString("TFT_eSPI", CLOCK_R, CLOCK_R * 0.75);
// Draw minute hand // Draw minute hand

View File

@ -14,7 +14,7 @@
#ifdef ESP8266 #ifdef ESP8266
// ESP8266 // ESP8266
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#elif defined(ARDUINO_ARCH_MBED) || defined(ARDUINO_ARCH_RP2040) #elif (defined(ARDUINO_ARCH_MBED) || defined(ARDUINO_ARCH_RP2040)) && !defined(ARDUINO_RASPBERRY_PI_PICO_W)
// RP2040 Nano Connect // RP2040 Nano Connect
#include <WiFiNINA.h> #include <WiFiNINA.h>
#else #else

View File

@ -1,6 +1,6 @@
{ {
"name": "TFT_eSPI", "name": "TFT_eSPI",
"version": "2.4.73", "version": "2.4.74",
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581", "keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32", "description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32",
"repository": "repository":

View File

@ -1,5 +1,5 @@
name=TFT_eSPI name=TFT_eSPI
version=2.4.73 version=2.4.74
author=Bodmer author=Bodmer
maintainer=Bodmer maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32 sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32