diff --git a/libraries/pico_graphics/pico_graphics.hpp b/libraries/pico_graphics/pico_graphics.hpp index 3c60face..08229461 100644 --- a/libraries/pico_graphics/pico_graphics.hpp +++ b/libraries/pico_graphics/pico_graphics.hpp @@ -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 &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; diff --git a/libraries/pico_graphics/pico_graphics_pen_3bit.cpp b/libraries/pico_graphics/pico_graphics_pen_3bit.cpp index 5faba1cd..0a16c152 100644 --- a/libraries/pico_graphics/pico_graphics_pen_3bit.cpp +++ b/libraries/pico_graphics/pico_graphics_pen_3bit.cpp @@ -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)); diff --git a/libraries/pico_graphics/pico_graphics_pen_inky7.cpp b/libraries/pico_graphics/pico_graphics_pen_inky7.cpp index 9a6ae5b0..8b026b96 100644 --- a/libraries/pico_graphics/pico_graphics_pen_inky7.cpp +++ b/libraries/pico_graphics/pico_graphics_pen_inky7.cpp @@ -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)); diff --git a/micropython/modules/picographics/picographics.cpp b/micropython/modules/picographics/picographics.cpp index 113009f5..2b8b017d 100644 --- a/micropython/modules/picographics/picographics.cpp +++ b/micropython/modules/picographics/picographics.cpp @@ -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!")); }