You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut driver = WeActStudio420BlackWhiteDriver::new(spi_interface, busy, reset, delay);letmut display = Display420BlackWhite::new();
display.set_rotation(DisplayRotation::Rotate0);
driver.init().await.unwrap();// Render image obtained via API call, for the example let's use a placeholderlet server_sent_image = [0u8;400*300 / 8].as_slice();let raw_image = ImageRaw::<Color>::new(server_sent_image,400);let image = Image::new(&raw_image,Point::zero());
image.draw(&mut display);
driver.full_update(&display).await.unwrap();
This fails because:
error[E0277]: the trait bound `Color: From<()>` is not satisfied
--> src/bin/async_main.rs:67:21
|
| let raw_image = ImageRaw::<Color>::new(server_sent_image, 400);
| ^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `Color`
|
= help: the following other types implement trait `From<T>`:
`Color` implements `From<BinaryColor>`
`Color` implements `From<Rgb555>`
`Color` implements `From<Rgb565>`
`Color` implements `From<Rgb888>`
note: required by a bound in `ImageRaw`
--> /Users/mariosangiorgio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/embedded-graphics-0.8.1/src/image/image_raw.rs:116:21
|
114 | pub struct ImageRaw<'a, C, BO = BigEndian>
| -------- required by a bound in this struct
115 | where
116 | C: PixelColor + From<<C as PixelColor>::Raw>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ImageRaw`
This originates from:
implPixelColorforColor{typeRaw = ();}
defined here. Is there any reason Raw is defined as () instead of RawU1?
I tried to use ImageRaw::<BinaryColor>::new(server_sent_image, 400); but that breaks when I call image.draw(&mut display) with a:
error[E0271]: type mismatch resolving `<Display<400, 300, 15000, Color> as DrawTarget>::Color == BinaryColor`
As a final attempt, I tried to redefine display to use a different color:
but that leaves me with a type I cannot construct. Display::new() is defined only when the color is Color and I cannot construct it myself because I don't have access to the member of the structure.
Am I missing something or is this library not compatible with ImageRaw?
The text was updated successfully, but these errors were encountered:
I'm trying to load an 1BPP image and display it using this crate. I am having trouble because of the way
Color
is defined.I'm trying to do something along these lines, inspired by this
ImageRaw
exampleThis fails because:
This originates from:
defined here. Is there any reason
Raw
is defined as()
instead ofRawU1
?I tried to use
ImageRaw::<BinaryColor>::new(server_sent_image, 400);
but that breaks when I callimage.draw(&mut display)
with a:As a final attempt, I tried to redefine display to use a different color:
but that leaves me with a type I cannot construct.
Display::new()
is defined only when the color isColor
and I cannot construct it myself because I don't have access to the member of the structure.Am I missing something or is this library not compatible with
ImageRaw
?The text was updated successfully, but these errors were encountered: