Struct qrcode::canvas::Canvas [] [src]

pub struct Canvas {
    // some fields omitted
}

Canvas is an intermediate helper structure to render error-corrected data into a QR code.

Methods

impl Canvas
[src]

fn new(version: Version, ec_level: EcLevel) -> Canvas

Constructs a new canvas big enough for a QR code of the given version.

fn get(&self, x: i16, y: i16) -> Module

Obtains a module at the given coordinates. For convenience, negative coordinates will wrap around.

fn get_mut(&mut self, x: i16, y: i16) -> &mut Module

Obtains a mutable module at the given coordinates. For convenience, negative coordinates will wrap around.

fn put(&mut self, x: i16, y: i16, module: Module)

Sets the color of a module at the given coordinates. For convenience, negative coordinates will wrap around.

impl Canvas
[src]

fn draw_all_functional_patterns(&mut self)

Draw all functional patterns, before data placement.

All functional patterns (e.g. the finder pattern) except the format info pattern will be filled in. The format info pattern will be filled with light modules instead. Data bits can then put in the empty modules. with .draw_data().

impl Canvas
[src]

fn draw_data(&mut self, data: &[u8], ec: &[u8])

Draws the encoded data and error correction codes to the empty modules.

impl Canvas
[src]

fn apply_mask(&mut self, pattern: MaskPattern)

Applies a mask to the canvas. This method will also draw the format info patterns.

impl Canvas
[src]

fn apply_best_mask(&self) -> Canvas

Construct a new canvas and apply the best masking that gives the lowest penalty score.

fn to_bools(&self) -> Vec<bool>

Convert the modules into a vector of booleans.

Trait Implementations

Derived Implementations

impl Clone for Canvas
[src]

fn clone(&self) -> Canvas

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more