zpl 0.1.0

A high accuracy ZPL renderer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::*;
use crate::output::raster::rasterize;
#[derive(Debug, Default, Clone, Copy)]
pub struct Png;
impl Adapter for Png {
    fn encode(&self, scene: &Scene) -> Result<Vec<u8>, OutputError> {
        raster_diff::Png::encode_gray(&rasterize(scene)?, scene.dpi).map_err(|e| OutputError(e.0))
    }
}
impl Png {
    pub fn encode_rgb(width: u32, height: u32, pixels: &[u8]) -> Result<Vec<u8>, OutputError> {
        raster_diff::Png::encode_rgb(width, height, pixels).map_err(|e| OutputError(e.0))
    }
}