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

pub struct Canvas { /* fields omitted */ }

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

Methods

impl Canvas[src]

pub fn new(version: Version, ec_level: EcLevel) -> Self[src]

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

pub fn get(&self, x: i16, y: i16) -> Module[src]

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

pub fn get_mut(&mut self, x: i16, y: i16) -> &mut Module[src]

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

pub fn put(&mut self, x: i16, y: i16, color: Color)[src]

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

impl Canvas[src]

pub fn draw_all_functional_patterns(&mut self)[src]

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]

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

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

impl Canvas[src]

pub fn apply_mask(&mut self, pattern: MaskPattern)[src]

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

impl Canvas[src]

pub fn apply_best_mask(&self) -> Self[src]

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

pub fn to_bools(&self) -> Vec<bool>[src]

Deprecated since 0.4.0:

use into_colors() instead

Convert the modules into a vector of booleans.

pub fn into_colors(self) -> Vec<Color>[src]

Convert the modules into a vector of colors.

Trait Implementations

impl Clone for Canvas[src]

Auto Trait Implementations

impl RefUnwindSafe for Canvas

impl Send for Canvas

impl Sync for Canvas

impl Unpin for Canvas

impl UnwindSafe for Canvas

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.