Inky Frame: Add thickness support for Hershey text.

pull/702/head
Phil Howard 2023-03-08 11:12:42 +00:00
rodzic 63d4c23cd5
commit cacb5749ae
4 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -364,7 +364,7 @@ namespace pimoroni {
void set_pen(uint c) override;
void set_pen(uint8_t r, uint8_t g, uint8_t b) override;
void set_thickness(uint t) override {};
void set_thickness(uint t) override;
int create_pen(uint8_t r, uint8_t g, uint8_t b) override;
int create_pen_hsv(float h, float s, float v) override;
@ -570,7 +570,7 @@ namespace pimoroni {
PicoGraphics_PenInky7(uint16_t width, uint16_t height, IDirectDisplayDriver<uint8_t> &direct_display_driver);
void set_pen(uint c) override;
void set_pen(uint8_t r, uint8_t g, uint8_t b) override;
void set_thickness(uint t) override {};
void set_thickness(uint t) override;
int create_pen(uint8_t r, uint8_t g, uint8_t b) override;
int create_pen_hsv(float h, float s, float v) override;
void set_pixel(const Point &p) override;

Wyświetl plik

@ -44,6 +44,9 @@ namespace pimoroni {
int PicoGraphics_Pen3Bit::create_pen_hsv(float h, float s, float v) {
return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
}
void PicoGraphics_Pen3Bit::set_thickness(uint t) {
thickness = t;
}
void PicoGraphics_Pen3Bit::set_pixel(const Point &p) {
if ((color & 0x7f000000) == 0x7f000000) {
set_pixel_dither(p, RGB(color));

Wyświetl plik

@ -18,6 +18,9 @@ namespace pimoroni {
int PicoGraphics_PenInky7::create_pen_hsv(float h, float s, float v) {
return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
}
void PicoGraphics_PenInky7::set_thickness(uint t) {
thickness = t;
}
void PicoGraphics_PenInky7::set_pixel(const Point &p) {
if ((color & 0x7f000000) == 0x7f000000) {
set_pixel_dither(p, RGB(color));

Wyświetl plik

@ -758,7 +758,10 @@ mp_obj_t ModPicoGraphics_create_pen_hsv(size_t n_args, const mp_obj_t *args) {
mp_obj_t ModPicoGraphics_set_thickness(mp_obj_t self_in, mp_obj_t pen) {
ModPicoGraphics_obj_t *self = MP_OBJ_TO_PTR2(self_in, ModPicoGraphics_obj_t);
if(self->graphics->pen_type != PicoGraphics::PEN_1BIT) {
if(
self->graphics->pen_type != PicoGraphics::PEN_1BIT
&& self->graphics->pen_type != PicoGraphics::PEN_3BIT
&& self->graphics->pen_type != PicoGraphics::PEN_INKY7) {
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("Thickness not supported!"));
}