pub struct Image {
pub image: ImageXObject,
}
Expand description
Image - wrapper around an ImageXObject
to allow for more control
within the library
Fields
image: ImageXObject
The actual image
Implementations
sourceimpl<'a> Image
impl<'a> Image
pub fn try_from<T: ImageDecoder<'a>>(image: T) -> Result<Self, ImageError>
pub fn from_dynamic_image(image: &DynamicImage) -> Self
sourceimpl Image
impl Image
sourcepub fn add_to_layer(self, layer: PdfLayerReference, transform: ImageTransform)
pub fn add_to_layer(self, layer: PdfLayerReference, transform: ImageTransform)
Adds the image to a specific layer and consumes it.
This is due to a PDF weirdness - images are basically just “names” and you have to make sure that they are added to resources of the same page as they are used on.
You can use the “transform.dpi” parameter to specify a scaling - the default is 300dpi
Trait Implementations
sourceimpl From<ImageXObject> for Image
impl From<ImageXObject> for Image
sourcefn from(image: ImageXObject) -> Self
fn from(image: ImageXObject) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more