pub struct RenderOptions { /* private fields */ }Expand description
How a symbol should be drawn.
Defaults target a 300 DPI thermal shipping-label printer: a 13 mil X-dimension, 25 mm bar height, standard quiet zones, and human-readable text.
§Examples
use smart_package_tracker::{Color, Length, QuietZone, RenderOptions};
let options = RenderOptions::builder()
.module_width(Length::Mils(13.0))
.height(Length::Mm(25.0))
.quiet_zone(QuietZone::Standard)
.dpi(300)
.colors(Color::BLACK, Color::WHITE)
.human_readable(true)
.build()?;
assert_eq!(options.dpi(), 300);Implementations§
Source§impl RenderOptions
impl RenderOptions
Sourcepub fn builder() -> RenderOptionsBuilder
pub fn builder() -> RenderOptionsBuilder
Start from the defaults and override what you need.
Sourcepub fn module_width(&self) -> Length
pub fn module_width(&self) -> Length
The X-dimension: width of one module.
Sourcepub fn quiet_zone(&self) -> QuietZone
pub fn quiet_zone(&self) -> QuietZone
Quiet zone setting.
Sourcepub fn foreground(&self) -> Color
pub fn foreground(&self) -> Color
Colour of dark modules.
Sourcepub fn background(&self) -> Color
pub fn background(&self) -> Color
Colour of light modules and margins.
Sourcepub fn human_readable(&self) -> bool
pub fn human_readable(&self) -> bool
Whether to print the payload beneath the symbol.
Sourcepub fn layout(&self, symbol: &Symbol) -> Result<Layout>
pub fn layout(&self, symbol: &Symbol) -> Result<Layout>
Compute the pixel geometry for symbol under these options.
Exposed because label layout often needs the final size before rendering.
§Errors
Returns Error::InvalidRenderOptions if the result would exceed
20,000 pixels on either axis, or 64 megapixels in total.
Trait Implementations§
Source§impl Clone for RenderOptions
impl Clone for RenderOptions
Source§fn clone(&self) -> RenderOptions
fn clone(&self) -> RenderOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RenderOptions
impl Debug for RenderOptions
Source§impl Default for RenderOptions
impl Default for RenderOptions
Source§impl PartialEq for RenderOptions
impl PartialEq for RenderOptions
impl StructuralPartialEq for RenderOptions
Auto Trait Implementations§
impl Freeze for RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnsafeUnpin for RenderOptions
impl UnwindSafe for RenderOptions
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