I am trying to use Plotters + Iced. The goal is to use Iced for the UI to select different plots. I am trying to plot these to
backend = BitMapBackend::with_buffer()
then presenting it as an Iced Image The problem, I cannot get the .with_buffer() to accept either a [u8] or Vec buffer. I keep getting a "wrong size buffer" error. I apologize ahead of time, but I am not at work and typing on my phone and trying to format the code:
let buffer = Vec::::new();
let drawing_area = BitMapBackend::with_buffer(&buffer, (800, 600)).into_drawing_area();
Has anyone else run into difficulties building a DrawingArea buffer?
@erelde Thanks for the help! I got the buffer partially working.
But, the image is rendering the graph multiple times in the iced::Image. Also, it appears graph is built on gaps on top of my window background and it's not using theChartContext color settings. I set my window background to RED to help clarify. I'm assuming this is the way I built my buffer, because if I use a BitmapBackend in plotters, Image renders the created PNG correctly.
Ah-ha! Solved it! The DrawingArea from BitMapBackend::with_buffer is a RGB backend which wasn't being processed by Iced::Image correctly. Once I changed the DrawingArea to a BitMapBackend::with_buffer_and_format to a BGRXPixel, all worked out!