Skip to content

Commit a5b0633

Browse files
committed
Inky 7.3: Dither pixel spans, move RGB flag out of RGB888.
1 parent 80fab77 commit a5b0633

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libraries/pico_graphics/pico_graphics_pen_inky7.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ namespace pimoroni {
1010
color = c;
1111
}
1212
void PicoGraphics_PenInky7::set_pen(uint8_t r, uint8_t g, uint8_t b) {
13-
color = RGB(r, g, b).to_rgb888() | 0x010101;
13+
color = RGB(r, g, b).to_rgb888() | 0x7f000000;
1414
}
1515
int PicoGraphics_PenInky7::create_pen(uint8_t r, uint8_t g, uint8_t b) {
16-
return RGB(r, g, b).to_rgb888() | 0x010101;
16+
return RGB(r, g, b).to_rgb888() | 0x7f000000;
1717
}
1818
int PicoGraphics_PenInky7::create_pen_hsv(float h, float s, float v) {
19-
return RGB::from_hsv(h, s, v).to_rgb888() | 0x010101;
19+
return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
2020
}
2121
void PicoGraphics_PenInky7::set_pixel(const Point &p) {
22-
if ((color & 0x010101) == 0x010101) {
22+
if ((color & 0x7f000000) == 0x7f000000) {
2323
set_pixel_dither(p, RGB(color));
2424
} else {
2525
driver.write_pixel(p, color & 0x07);
2626
}
2727
}
2828
void PicoGraphics_PenInky7::set_pixel_span(const Point &p, uint l) {
29+
if ((color & 0x7f000000) == 0x7f000000) {
30+
for(auto x = 0u; x < l; x++) {
31+
set_pixel_dither(p + Point(x, 0), RGB(color));
32+
}
33+
return;
34+
}
2935
driver.write_pixel_span(p, l, color);
3036
}
3137
void PicoGraphics_PenInky7::get_dither_candidates(const RGB &col, const RGB *palette, size_t len, std::array<uint8_t, 16> &candidates) {

0 commit comments

Comments
 (0)