Maraiah/maraiah/image/pict/pm/area.rs

22 lines
552 B
Rust

//! QuickDraw PICT `PixMap` areas.
use crate::{err::*, image::{*, pict::pm}};
/// Process a `CopyBits` operation.
pub fn read(im: Image8, b: &[u8], pack: bool, clip: bool) -> ResultS<Image8>
{
let p = if pack {0} else {4};
let (b, hdr) = pm::head::read(&b[p..], pack, clip, &im)?;
match hdr.depth {
pm::head::Depth::_1 |
pm::head::Depth::_2 |
pm::head::Depth::_4 |
pm::head::Depth::_8 => pm::ind::read(im, b, hdr),
pm::head::Depth::_16 => pm::r5g5b5::read(im, b, hdr),
pm::head::Depth::_32 => pm::rgb8::read(im, b, hdr),
}
}
// EOF