pub struct ImageData { /* private fields */ }Expand description
A decoded or passthrough image ready to embed as an image XObject.
Implementations§
Source§impl ImageData
impl ImageData
Sourcepub fn png(bytes: &[u8]) -> Result<ImageData>
pub fn png(bytes: &[u8]) -> Result<ImageData>
Imports a PNG. Truecolor and grayscale (8- and 16-bit, the latter
reduced to 8), palette (expanded), and alpha (split to /SMask)
are all supported.
Sourcepub fn jpeg(bytes: &[u8]) -> Result<ImageData>
pub fn jpeg(bytes: &[u8]) -> Result<ImageData>
Imports a baseline or progressive JPEG by passthrough. Dimensions and component count are read from the SOF marker; grayscale and three-component (YCbCr/RGB) images are supported, anything else is an error.
Sourcepub fn decode(bytes: &[u8]) -> Result<ImageData>
pub fn decode(bytes: &[u8]) -> Result<ImageData>
Imports a PNG or JPEG, dispatched by content rather than by file
extension: a PNG signature selects ImageData::png, a JPEG SOI
marker selects ImageData::jpeg, anything else is an error.
Sourcepub fn gray8(width: u32, height: u32, data: Vec<u8>) -> Result<ImageData>
pub fn gray8(width: u32, height: u32, data: Vec<u8>) -> Result<ImageData>
Wraps an 8-bit grayscale raster; data is width * height bytes.
Sourcepub fn rgb8(width: u32, height: u32, data: Vec<u8>) -> Result<ImageData>
pub fn rgb8(width: u32, height: u32, data: Vec<u8>) -> Result<ImageData>
Wraps an 8-bit RGB raster; data is width * height * 3 bytes.
Trait Implementations§
impl StructuralPartialEq for ImageData
Auto Trait Implementations§
impl Freeze for ImageData
impl RefUnwindSafe for ImageData
impl Send for ImageData
impl Sync for ImageData
impl Unpin for ImageData
impl UnsafeUnpin for ImageData
impl UnwindSafe for ImageData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more