Struct qrcode::render::Renderer
[−]
[src]
pub struct Renderer<'a, P: Pixel> { /* fields omitted */ }
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]
fn new(
content: &'a [Color],
modules_count: usize,
quiet_zone: u32
) -> Renderer<'a, P>
content: &'a [Color],
modules_count: usize,
quiet_zone: u32
) -> Renderer<'a, P>
Creates a new renderer.
fn dark_color(&mut self, color: P) -> &mut Self
Sets color of a dark module. Default is opaque black.
fn light_color(&mut self, color: P) -> &mut Self
Sets color of a light module. Default is opaque white.
fn quiet_zone(&mut self, has_quiet_zone: bool) -> &mut Self
Whether to include the quiet zone in the generated image.
fn module_size(&mut self, width: u32) -> &mut Self
: use .module_dimensions(width, width)
instead
Sets the size of each module in pixels. Default is 8px.
fn module_dimensions(&mut self, width: u32, height: u32) -> &mut Self
Sets the size of each module in pixels. Default is 8×8.
fn min_width(&mut self, width: u32) -> &mut Self
: use .min_dimensions(width, width)
instead
fn min_dimensions(&mut self, width: u32, height: u32) -> &mut Self
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.
fn max_dimensions(&mut self, width: u32, height: u32) -> &mut Self
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.
fn to_image(&self) -> P::Image
: renamed to .build()
to de-emphasize the image connection
Renders the QR code into an image.
fn build(&self) -> P::Image
Renders the QR code into an image.