PNG images transparency #2751
bbjodel
started this conversation in
Compatible support libraries
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I would like to put three PNG images flashing with transparency to report an error, I am a novice in coding, can you help me?
I cannot have the transparency of the PNG images or the flashing of these three images.
Best regards
Alfred
Here is my code:
`/* 08 mai 2023 - ESP32 JAUGES CAN BUS */
#include <M5Stack.h>
#include <Free_Fonts.h>
#include "BatteriePleine.h"
#include "Warning.h"
#include "Essai.h"
#include "Image.h"
#define SCREEN_Y 240 // Screen sizes are set here.
#define SCREEN_X 320
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite gdraw = TFT_eSprite(&M5.Lcd);
uint8_t displayMode;
uint16_t displayBrightness = 100;
void setup() {
Serial.begin(115200);
M5.begin();
M5.Lcd.fillScreen(TFT_WHITE);
delay (100);
gdraw.setColorDepth(8);
gdraw.createSprite(SCREEN_X, SCREEN_Y);
gdraw.setFreeFont(FSSB9); // HA
gdraw.setTextWrap(false); // Very important for scaling
displayMode = 1; // Demarre en Ecran sur page x
} // Fin setup()
void loop() {
if (displayMode == 1) {
gdraw.fillSprite (TFT_BLACK);
M5.update();
}
if (M5.BtnC.wasPressed() && !M5.BtnA.wasPressed() && (displayBrightness > 0)) {
displayBrightness *= 2; // brightness up
}
if (M5.BtnA.wasPressed() && !M5.BtnC.wasPressed() && (displayBrightness <= 255)) {
displayBrightness /= 2; // brightness down
}
if (displayBrightness < 1) displayBrightness = 1;
if (displayBrightness > 255) displayBrightness = 255;
M5.Lcd.setBrightness (displayBrightness);
if (M5.BtnB.wasPressed()) displayMode++;
if (displayMode > 1) displayMode = 1;
gdraw.setTextColor (TFT_CYAN);
gdraw.setFreeFont(FSSB18);
gdraw.setCursor(20, 120);
gdraw.print("ALFRED 1962");
gdraw.pushImage(3, 3, BatteriePleineWidth, BatteriePleineHeight, BatteriePleine);
int a = 1;
if(a == 1) {
M5.update();
gdraw.pushImage(85, 35, ImageWidth, ImageHeight, Image);
delay(1000);
}
gdraw.pushSprite (0, 0);
} // Fin loop()`
Beta Was this translation helpful? Give feedback.
All reactions