Struct qrcode::render::Renderer [] [src]

pub struct Renderer<'a, P: BlankAndWhitePixel> {
    // some fields omitted
}

A QR code renderer. This is a builder type which converts a bool-vector into an image.

Methods

impl<'a, P: BlankAndWhitePixel + 'static> Renderer<'a, P>
[src]

fn new(content: &'a [bool], 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, size: u32) -> &mut Self

Sets the size of each module in pixels. Default is 8px.

fn min_width(&mut self, width: u32) -> &mut Self

Sets the minimal total image width (and thus height) 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 width ≥200px, we get that each module's size should be 11px, so the actual image size will be 209px.

fn to_image(&self) -> ImageBuffer<P, Vec<P::Subpixel>>

Renders the QR code into an image.