Closed dbrgn closed 4 years ago
The image format specified in the second line of your example doesn't match the format stored in the TGA file. The TGA file uses 32bpp RGBA color, which you can decode by using:
let elephant: Image<Tga, Rgb888> = Image::new(&elephant_data, Point::new(20, 20));
This will ignore the alpha channel, but you could save some memory by removing it in GIMP.
Support for drawing images with different color formats isn't great in e-g 0.6 and you will need to use
elephant.into_iter().map(|Pixel(p, c)| Pixel(p, c.into()).draw(&mut lcd).unwrap();
to draw the image.
I see, thanks for the explanation (and sorry for the late reply)! A quick note / example in the docs would probably be really useful to other people trying out tinytga without much knowledge about the format, like me :slightly_smiling_face:
Description of the problem/feature request/other
To test TGA support, I took this image, opened it in GIMP and exported it in TGA format.
elephant.tga.gz
However, when writing the image to the screen, it looks noisy:
Ferris is on there to show that the hardware setup generally works. Rendering https://github.com/jamwaffles/embedded-graphics/blob/master/tinytga/tests/rust-rle-bw-topleft.tga works as well.
Test case (if applicable)