Cannot implement From<Color> for new types #28

Closed
opened 2020-08-25 17:42:34 +00:00 by Spadi0 · 2 comments
Spadi0 commented 2020-08-25 17:42:34 +00:00 (Migrated from github.com)

The UI object requires an embedded_graphics display to draw to, and the provided display needs to use a PixelColor that also implements From<Color>. However, the Color type does not export any fields or functions that provide either a lv_color_t, or RGBA fields.

This makes it impossible to convert from the Color type, as no color data is provided; this means that only displays that use Rgb565 or Rgb888 work (as they have crate-provided implementations).

Either the raw field needs to be public:
d442ab99cc/lvgl/src/support.rs (L18)
or a function/functions that return RGBA data are needed.

The `UI` object requires an `embedded_graphics` display to draw to, and the provided display needs to use a `PixelColor` that also implements `From<Color>`. However, the `Color` type does not export any fields or functions that provide either a `lv_color_t`, or RGBA fields. This makes it impossible to convert from the `Color` type, as no color data is provided; this means that only displays that use `Rgb565` or `Rgb888` work (as they have crate-provided implementations). Either the `raw` field needs to be public: https://github.com/rafaelcaricio/lvgl-rs/blob/d442ab99cc015d4a3d814de7d188b5792a19aea7/lvgl/src/support.rs#L18 or a function/functions that return RGBA data are needed.
rafaelcaricio commented 2020-08-27 09:39:52 +00:00 (Migrated from github.com)

Check out this https://github.com/rafaelcaricio/lvgl-rs/pull/29

I'm not sure the alpha information is provided by LVGL. 🤔

Check out this https://github.com/rafaelcaricio/lvgl-rs/pull/29 I'm not sure the `alpha` information is provided by LVGL. 🤔
rafaelcaricio commented 2020-08-27 09:42:07 +00:00 (Migrated from github.com)

You can reopen if you find this is not useful. Also feel free to send pull requests. Unfortunately, I am short on free time lately to work on lvgl-rs. I hope to be back at it in a few weeks.

You can reopen if you find this is not useful. Also feel free to send pull requests. Unfortunately, I am short on free time lately to work on `lvgl-rs`. I hope to be back at it in a few weeks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: rafaelcaricio/lvgl-rs#28
No description provided.