kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Inky Frame: Add thickness support for Hershey text.
rodzic
63d4c23cd5
commit
cacb5749ae
|
@ -364,7 +364,7 @@ namespace pimoroni {
|
||||||
|
|
||||||
void set_pen(uint c) override;
|
void set_pen(uint c) override;
|
||||||
void set_pen(uint8_t r, uint8_t g, uint8_t b) 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(uint8_t r, uint8_t g, uint8_t b) override;
|
||||||
int create_pen_hsv(float h, float s, float v) 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);
|
PicoGraphics_PenInky7(uint16_t width, uint16_t height, IDirectDisplayDriver<uint8_t> &direct_display_driver);
|
||||||
void set_pen(uint c) override;
|
void set_pen(uint c) override;
|
||||||
void set_pen(uint8_t r, uint8_t g, uint8_t b) 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(uint8_t r, uint8_t g, uint8_t b) override;
|
||||||
int create_pen_hsv(float h, float s, float v) override;
|
int create_pen_hsv(float h, float s, float v) override;
|
||||||
void set_pixel(const Point &p) override;
|
void set_pixel(const Point &p) override;
|
||||||
|
|
|
@ -44,6 +44,9 @@ namespace pimoroni {
|
||||||
int PicoGraphics_Pen3Bit::create_pen_hsv(float h, float s, float v) {
|
int PicoGraphics_Pen3Bit::create_pen_hsv(float h, float s, float v) {
|
||||||
return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
|
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) {
|
void PicoGraphics_Pen3Bit::set_pixel(const Point &p) {
|
||||||
if ((color & 0x7f000000) == 0x7f000000) {
|
if ((color & 0x7f000000) == 0x7f000000) {
|
||||||
set_pixel_dither(p, RGB(color));
|
set_pixel_dither(p, RGB(color));
|
||||||
|
|
|
@ -18,6 +18,9 @@ namespace pimoroni {
|
||||||
int PicoGraphics_PenInky7::create_pen_hsv(float h, float s, float v) {
|
int PicoGraphics_PenInky7::create_pen_hsv(float h, float s, float v) {
|
||||||
return RGB::from_hsv(h, s, v).to_rgb888() | 0x7f000000;
|
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) {
|
void PicoGraphics_PenInky7::set_pixel(const Point &p) {
|
||||||
if ((color & 0x7f000000) == 0x7f000000) {
|
if ((color & 0x7f000000) == 0x7f000000) {
|
||||||
set_pixel_dither(p, RGB(color));
|
set_pixel_dither(p, RGB(color));
|
||||||
|
|
|
@ -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) {
|
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);
|
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!"));
|
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("Thickness not supported!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue