cosmic::iced_winit::graphics::image::image_rs

Function write_buffer_with_format

source
pub fn write_buffer_with_format<W, F>(
    buffered_writer: &mut W,
    buf: &[u8],
    width: u32,
    height: u32,
    color: ColorType,
    format: F,
) -> Result<(), ImageError>
where W: Write + Seek, F: Into<ImageOutputFormat>,
Expand description

Writes the supplied buffer to a writer in the specified format.

The buffer is assumed to have the correct format according to the specified color type. This will lead to corrupted writers if the buffer contains malformed data.

See ImageOutputFormat for supported types.

Assumes the writer is buffered. In most cases, you should wrap your writer in a BufWriter for best performance.