pdf/src/image.rs#
Source: lib/pdf/src/image.rs
image -- raster images for a document: JPEG files as they are (DCTDecode), all other pixels
FlateDecode with PNG predictors and their alpha as a soft mask (SMask)
struct Imagean image for Document::add_image: a JPEG passed through, or 8-bit pixels (gray, RGB, RGBA, a gfx surface) with an optional alpha channel
impl Image
fn jpeg(data: Vec<u8>) -> Result<Image, Error>a JPEG file, embedded unchanged: baseline, extended or progressive, 8 bits, 1, 3 or 4 components (Adobe's inverted CMYK understood)fn gray(w: u32, h: u32, px: &[u8]) -> Result<Image, Error>8-bit gray, rows from the topfn rgb(w: u32, h: u32, px: &[u8]) -> Result<Image, Error>8-bit RGB, rows from the topfn rgba(w: u32, h: u32, px: &[u8]) -> Result<Image, Error>8-bit RGBA with straight (not premultiplied) alpha, rows from the topfn from_surface(s: &gfx::Surface) -> Result<Image, Error>a gfx surface: XRGB (opaque), PARGB (premultiplied, un-premultiplied here), ARGB, A8 (as gray)fn with_alpha(mut self, alpha: Vec<u8>) -> Result<Image, Error>an alpha channel (one byte per pixel, rows from the top) for any image, a JPEG toofn interpolate(mut self, on: bool) -> Imagesmooth the image when a reader scales it up (PDF /Interpolate)fn size(&self) -> (u32, u32)width and height in pixelsfn is_jpeg(&self) -> boolfn has_alpha(&self) -> bool