Struct escpos_rust::EscposImage
source · 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 copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
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 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