pub struct EscposImage { /* private fields */ }
Expand description
Image adapted to the printer.
The EscposImage structure keeps the original image, and contains a cache for constructed images for specific printer widths
Implementations§
Source§impl EscposImage
impl EscposImage
Sourcepub fn new(
dynamic_image: DynamicImage,
scale: u8,
justification: Justification,
) -> Result<EscposImage, Error>
pub fn new( dynamic_image: DynamicImage, scale: u8, justification: Justification, ) -> Result<EscposImage, Error>
Pub fn creates a new EscposImage from a DynamicImage
The scale parameters goes from 0 to 255, controlling which percentage of the width should the image hold. The justification allows for a bit more specific image alignment.
Sourcepub fn cache_for(&mut self, width: u16)
pub fn cache_for(&mut self, width: u16)
Creates a cached image for the specified width
Useful method to decrease the number of operations done per printing, by skipping the scaling step for a specific printer.
pub fn feed(&self, width: u16) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Clone for EscposImage
impl Clone for EscposImage
Source§fn clone(&self) -> EscposImage
fn clone(&self) -> EscposImage
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EscposImage
impl Debug for EscposImage
Source§impl<'de> Deserialize<'de> for EscposImage
impl<'de> Deserialize<'de> for EscposImage
Source§fn deserialize<D>(deserializer: D) -> Result<EscposImage, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<EscposImage, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EscposImage
impl RefUnwindSafe for EscposImage
impl Send for EscposImage
impl Sync for EscposImage
impl Unpin for EscposImage
impl UnwindSafe for EscposImage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more