Struct escpos_rs::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
sourceimpl 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
sourceimpl Clone for EscposImage
impl Clone for EscposImage
sourcefn clone(&self) -> EscposImage
fn clone(&self) -> EscposImage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for EscposImage
impl Debug for EscposImage
sourceimpl<'de> Deserialize<'de> for EscposImage
impl<'de> Deserialize<'de> for EscposImage
sourcefn 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
sourceimpl Serialize for EscposImage
impl Serialize for EscposImage
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more