pub struct Image { /* private fields */ }Expand description
an image for Document::add_image: a JPEG passed through, or 8-bit pixels (gray, RGB, RGBA, a gfx surface) with an optional alpha channel
Implementations§
Source§impl Image
impl Image
Sourcepub fn jpeg(data: Vec<u8>) -> Result<Image, Error>
pub 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)
Sourcepub fn rgba(w: u32, h: u32, px: &[u8]) -> Result<Image, Error>
pub fn rgba(w: u32, h: u32, px: &[u8]) -> Result<Image, Error>
8-bit RGBA with straight (not premultiplied) alpha, rows from the top
Sourcepub fn from_surface(s: &Surface) -> Result<Image, Error>
pub fn from_surface(s: &Surface) -> Result<Image, Error>
a gfx surface: XRGB (opaque), PARGB (premultiplied, un-premultiplied here), ARGB, A8 (as gray)
Sourcepub fn with_alpha(self, alpha: Vec<u8>) -> Result<Image, Error>
pub fn with_alpha(self, alpha: Vec<u8>) -> Result<Image, Error>
an alpha channel (one byte per pixel, rows from the top) for any image, a JPEG too
Sourcepub fn interpolate(self, on: bool) -> Image
pub fn interpolate(self, on: bool) -> Image
smooth the image when a reader scales it up (PDF /Interpolate)
pub fn is_jpeg(&self) -> bool
pub fn has_alpha(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Forget for Image
impl Freeze for Image
impl Move for Image
impl RefUnwindSafe for Image
impl Send for Imagewhere
RawVecInner: Send,
impl Sync for Imagewhere
RawVecInner: Sync,
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Imagewhere
RawVecInner: UnwindSafe,
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