pub struct Canvas { /* private fields */ }
Expand description
Canvas
is an intermediate helper structure to render error-corrected data
into a QR code.
Implementations§
source§impl Canvas
impl Canvas
sourcepub fn new(version: Version, ec_level: EcLevel) -> Self
pub fn new(version: Version, ec_level: EcLevel) -> Self
Constructs a new canvas big enough for a QR code of the given version.
sourcepub fn get(&self, x: i16, y: i16) -> Module
pub fn get(&self, x: i16, y: i16) -> Module
Obtains a module at the given coordinates. For convenience, negative coordinates will wrap around.
source§impl Canvas
impl Canvas
sourcepub fn draw_all_functional_patterns(&mut self)
pub 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()
.
source§impl Canvas
impl Canvas
sourcepub fn apply_mask(&mut self, pattern: MaskPattern)
pub fn apply_mask(&mut self, pattern: MaskPattern)
Applies a mask to the canvas. This method will also draw the format info patterns.
source§impl Canvas
impl Canvas
sourcepub fn apply_best_mask(&self) -> Self
pub fn apply_best_mask(&self) -> Self
Construct a new canvas and apply the best masking that gives the lowest penalty score.
sourcepub fn to_bools(&self) -> Vec<bool>
👎Deprecated since 0.4.0: use into_colors()
instead
pub fn to_bools(&self) -> Vec<bool>
into_colors()
insteadConvert the modules into a vector of booleans.
sourcepub fn into_colors(self) -> Vec<Color>
pub fn into_colors(self) -> Vec<Color>
Convert the modules into a vector of colors.