Update to use new RGB888 pen type

pull/537/head
jon 2022-07-26 05:05:23 +01:00 zatwierdzone przez Phil Howard
rodzic f2c3d15b8e
commit 678be33b53
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -9,7 +9,7 @@
using namespace pimoroni;
PicoGraphics_PenRGB565 graphics(53, 11, nullptr);
PicoGraphics_PenRGB888 graphics(53, 11, nullptr);
GalacticUnicorn galactic_unicorn;
// HSV Conversion expects float inputs in the range of 0.00-1.00 for each channel

Wyświetl plik

@ -382,16 +382,16 @@ namespace pimoroni {
}
void GalacticUnicorn::update(PicoGraphics_PenRGB565 &graphics) {
void GalacticUnicorn::update(PicoGraphics_PenRGB888 &graphics) {
uint16_t *p = (uint16_t *)graphics.frame_buffer;
for(size_t j = 0; j < 53 * 11; j++) {
int x = j % 53;
int y = j / 53;
uint16_t col = __builtin_bswap16(*p);
uint8_t r = ((col & 0b1111100000000000) >> 11) << 3;
uint8_t g = ((col & 0b0000011111100000) >> 5) << 2;
uint8_t b = ((col & 0b0000000000011111) >> 0) << 3;
uint8_t r = (col & 0xff0000) >> 16;
uint8_t g = (col & 0x00ff00) >> 8;
uint8_t b = (col & 0x0000ff) >> 0;
p++;
r = (r * this->brightness) >> 8;

Wyświetl plik

@ -64,7 +64,7 @@ namespace pimoroni {
void clear();
void update(PicoGraphics_PenRGB565 &graphics);
void update(PicoGraphics_PenRGB888 &graphics);
void set_brightness(float value);
float get_brightness();