[−][src]Struct qrcode::render::Renderer
A QR code renderer. This is a builder type which converts a bool-vector into an image.
Methods
impl<'a, P: Pixel> Renderer<'a, P>
[src]
pub fn new(
content: &'a [Color],
modules_count: usize,
quiet_zone: u32
) -> Renderer<'a, P>
[src]
content: &'a [Color],
modules_count: usize,
quiet_zone: u32
) -> Renderer<'a, P>
Creates a new renderer.
pub fn dark_color(&mut self, color: P) -> &mut Self
[src]
Sets color of a dark module. Default is opaque black.
pub fn light_color(&mut self, color: P) -> &mut Self
[src]
Sets color of a light module. Default is opaque white.
pub fn quiet_zone(&mut self, has_quiet_zone: bool) -> &mut Self
[src]
Whether to include the quiet zone in the generated image.
pub fn module_size(&mut self, width: u32) -> &mut Self
[src]
use .module_dimensions(width, width)
instead
Sets the size of each module in pixels. Default is 8px.
pub fn module_dimensions(&mut self, width: u32, height: u32) -> &mut Self
[src]
Sets the size of each module in pixels. Default is 8×8.
pub fn min_width(&mut self, width: u32) -> &mut Self
[src]
use .min_dimensions(width, width)
instead
pub fn min_dimensions(&mut self, width: u32, height: u32) -> &mut Self
[src]
Sets the minimum total image size in pixels, including the quiet zone if applicable. The renderer will try to find the dimension as small as possible, such that each module in the QR code has uniform size (no distortion).
For instance, a version 1 QR code has 19 modules across including the quiet zone. If we request an image of size ≥200×200, we get that each module's size should be 11×11, so the actual image size will be 209×209.
pub fn max_dimensions(&mut self, width: u32, height: u32) -> &mut Self
[src]
Sets the maximum total image size in pixels, including the quiet zone if applicable. The renderer will try to find the dimension as large as possible, such that each module in the QR code has uniform size (no distortion).
For instance, a version 1 QR code has 19 modules across including the quiet zone. If we request an image of size ≤200×200, we get that each module's size should be 10×10, so the actual image size will be 190×190.
The module size is at least 1×1, so if the restriction is too small, the final image can be larger than the input.
pub fn to_image(&self) -> P::Image
[src]
renamed to .build()
to de-emphasize the image connection
Renders the QR code into an image.
pub fn build(&self) -> P::Image
[src]
Renders the QR code into an image.
Auto Trait Implementations
impl<'a, P> Send for Renderer<'a, P> where
P: Send,
P: Send,
impl<'a, P> Unpin for Renderer<'a, P> where
P: Unpin,
P: Unpin,
impl<'a, P> Sync for Renderer<'a, P> where
P: Sync,
P: Sync,
impl<'a, P> UnwindSafe for Renderer<'a, P> where
P: UnwindSafe,
P: UnwindSafe,
impl<'a, P> RefUnwindSafe for Renderer<'a, P> where
P: RefUnwindSafe,
P: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,