waft-embedder 0.13.0

dart:ui host traits and value types for Waft
Documentation
1
2
3
4
5
6
7
8
9
10
11
//! Pixels read back (`Platform::read_image_pixels`) encoded as a PNG: `Image.toByteData(format:
//! ImageByteFormat.png)`'s encoding, done by valo's software encoder on every host, so a
//! screenshot is the same file wherever the app runs.

use valo::PixelBuffer;

/// `pixels` encoded as a PNG's bytes, or why they could not be.
pub fn encode_png(pixels: &PixelBuffer) -> Result<Vec<u8>, String> {
    valo_codec_software::encode(pixels, valo_codec_software::Encoding::Png)
        .map_err(|error| error.to_string())
}