| 1 | //! Render a QR code into image. |
| 2 | |
| 3 | use craterust-analyzer cargo qrcode 0.14.1 crate/::castrust-analyzer cargo qrcode 0.14.1 cast/::Asrust-analyzer cargo qrcode 0.14.1 cast/As#; |
| 4 | use craterust-analyzer cargo qrcode 0.14.1 crate/::typesrust-analyzer cargo qrcode 0.14.1 types/::Colorrust-analyzer cargo qrcode 0.14.1 types/Color#; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().; |
| 6 | |
| 7 | pub mod imagerust-analyzer cargo qrcode 0.14.1 render/image/; |
| 8 | pub mod picrust-analyzer cargo qrcode 0.14.1 render/pic/; |
| 9 | pub mod stringrust-analyzer cargo qrcode 0.14.1 render/string/; |
| 10 | pub mod svgrust-analyzer cargo qrcode 0.14.1 render/svg/; |
| 11 | pub mod unicoderust-analyzer cargo qrcode 0.14.1 render/unicode/; |
| 12 | |
| 13 | //------------------------------------------------------------------------------ |
| 14 | //{{{ Pixel trait |
| 15 | |
| 16 | /// Abstraction of an image pixel. |
| 17 | pub trait Pixelrust-analyzer cargo qrcode 0.14.1 render/Pixel#: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# { |
| 18 | /// Type of the finalized image. |
| 19 | type Imagerust-analyzer cargo qrcode 0.14.1 render/Pixel#Image#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + 'static; |
| 20 | |
| 21 | /// The type that stores an intermediate buffer before finalizing to a |
| 22 | /// concrete image |
| 23 | type Canvasrust-analyzer cargo qrcode 0.14.1 render/Pixel#Canvas#: Canvasrust-analyzer cargo qrcode 0.14.1 render/Canvas#<Pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#Pixel# = Self, Imagerust-analyzer cargo qrcode 0.14.1 render/Canvas#Image# = Self::Imagerust-analyzer cargo qrcode 0.14.1 render/Pixel#Image#>; |
| 24 | |
| 25 | /// Obtains the default module size. The result must be at least 1×1. |
| 26 | fn default_unit_sizerust-analyzer cargo qrcode 0.14.1 render/Pixel#default_unit_size().() -> (u32, u32) { |
| 27 | (8, 8) |
| 28 | } |
| 29 | |
| 30 | /// Obtains the default pixel color when a module is dark or light. |
| 31 | fn default_colorrust-analyzer cargo qrcode 0.14.1 render/Pixel#default_color().(color: Colorrust-analyzer cargo qrcode 0.14.1 types/Color#) -> Self; |
| 32 | } |
| 33 | |
| 34 | /// Rendering canvas of a QR code image. |
| 35 | pub trait Canvasrust-analyzer cargo qrcode 0.14.1 render/Canvas#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# { |
| 36 | type Pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#Pixel#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#; |
| 37 | type Imagerust-analyzer cargo qrcode 0.14.1 render/Canvas#Image#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#; |
| 38 | |
| 39 | /// Constructs a new canvas of the given dimensions. |
| 40 | fn newrust-analyzer cargo qrcode 0.14.1 render/Canvas#new().(width: u32, height: u32, dark_pixel: Self::Pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#Pixel#, light_pixel: Self::Pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#Pixel#) -> Self; |
| 41 | |
| 42 | /// Draws a single dark pixel at the (x, y) coordinate. |
| 43 | fn draw_dark_pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#draw_dark_pixel().(&mut self, x: u32, y: u32); |
| 44 | |
| 45 | fn draw_dark_rectrust-analyzer cargo qrcode 0.14.1 render/Canvas#draw_dark_rect().(&mut self, left: u32, top: u32, width: u32, height: u32) { |
| 46 | for y in top..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().height) { |
| 47 | for x in left..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().width) { |
| 48 | self.draw_dark_pixelrust-analyzer cargo qrcode 0.14.1 render/Canvas#draw_dark_pixel().(x, y); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /// Finalize the canvas to a real image. |
| 54 | fn into_imagerust-analyzer cargo qrcode 0.14.1 render/Canvas#into_image().(self) -> Self::Imagerust-analyzer cargo qrcode 0.14.1 render/Canvas#Image#; |
| 55 | } |
| 56 | |
| 57 | //}}} |
| 58 | //------------------------------------------------------------------------------ |
| 59 | //{{{ Renderer |
| 60 | |
| 61 | /// A QR code renderer. This is a builder type which converts a bool-vector into |
| 62 | /// an image. |
| 63 | pub struct Rendererrust-analyzer cargo qrcode 0.14.1 render/Renderer#<'a, P: Pixelrust-analyzer cargo qrcode 0.14.1 render/Pixel#> { |
| 64 | contentrust-analyzer cargo qrcode 0.14.1 render/Renderer#content.: &'a [Colorrust-analyzer cargo qrcode 0.14.1 types/Color#], |
| 65 | modules_countrust-analyzer cargo qrcode 0.14.1 render/Renderer#modules_count.: u32, // <- we call it `modules_count` here to avoid ambiguity of `width`. |
| 66 | quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#quiet_zone.: u32, |
| 67 | module_sizerust-analyzer cargo qrcode 0.14.1 render/Renderer#module_size.: (u32, u32), |
| 68 | |
| 69 | dark_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#dark_color.: P, |
| 70 | light_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#light_color.: P, |
| 71 | has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone.: bool, |
| 72 | } |
| 73 | |
| 74 | impl<'a, P: Pixelrust-analyzer cargo qrcode 0.14.1 render/Pixel#> Rendererrust-analyzer cargo qrcode 0.14.1 render/Renderer#<'a, P> { |
| 75 | /// Creates a new renderer. |
| 76 | /// |
| 77 | /// # Panics |
| 78 | /// |
| 79 | /// Panics if the length of `content` is not exactly `modules_count * modules_count`. |
| 80 | pub fn newrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]new().(content: &'a [Colorrust-analyzer cargo qrcode 0.14.1 types/Color#], modules_count: usize, quiet_zone: u32) -> Rendererrust-analyzer cargo qrcode 0.14.1 render/Renderer#<'a, P> { |
| 81 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(modules_count *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). modules_count == content.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 82 | Rendererrust-analyzer cargo qrcode 0.14.1 render/Renderer# { |
| 83 | contentrust-analyzer cargo qrcode 0.14.1 render/Renderer#content., |
| 84 | modules_countrust-analyzer cargo qrcode 0.14.1 render/Renderer#modules_count.: modules_count.as_u32rust-analyzer cargo qrcode 0.14.1 cast/impl#[usize][As]as_u32().(), |
| 85 | quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#quiet_zone., |
| 86 | module_sizerust-analyzer cargo qrcode 0.14.1 render/Renderer#module_size.: P::default_unit_sizerust-analyzer cargo qrcode 0.14.1 render/Pixel#default_unit_size().(), |
| 87 | dark_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#dark_color.: P::default_colorrust-analyzer cargo qrcode 0.14.1 render/Pixel#default_color().(Colorrust-analyzer cargo qrcode 0.14.1 types/Color#::Darkrust-analyzer cargo qrcode 0.14.1 types/Color#Dark#), |
| 88 | light_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#light_color.: P::default_colorrust-analyzer cargo qrcode 0.14.1 render/Pixel#default_color().(Colorrust-analyzer cargo qrcode 0.14.1 types/Color#::Lightrust-analyzer cargo qrcode 0.14.1 types/Color#Light#), |
| 89 | has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone.: true, |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /// Sets color of a dark module. Default is opaque black. |
| 94 | pub fn dark_colorrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]dark_color().(&mut self, color: P) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 95 | self.dark_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#dark_color. = color; |
| 96 | self |
| 97 | } |
| 98 | |
| 99 | /// Sets color of a light module. Default is opaque white. |
| 100 | pub fn light_colorrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]light_color().(&mut self, color: P) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 101 | self.light_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#light_color. = color; |
| 102 | self |
| 103 | } |
| 104 | |
| 105 | /// Whether to include the quiet zone in the generated image. |
| 106 | pub fn quiet_zonerust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]quiet_zone().(&mut self, has_quiet_zone: bool) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 107 | self.has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone. = has_quiet_zone; |
| 108 | self |
| 109 | } |
| 110 | |
| 111 | /// Sets the size of each module in pixels. Default is 8px. |
| 112 | #[deprecated(since = "0.4.0", note = "use `.module_dimensions(width, width)` instead")] |
| 113 | pub fn module_sizerust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]module_size().(&mut self, width: u32) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 114 | self.module_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]module_dimensions().(width, width) |
| 115 | } |
| 116 | |
| 117 | /// Sets the size of each module in pixels. Default is 8×8. |
| 118 | pub fn module_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]module_dimensions().(&mut self, width: u32, height: u32) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 119 | self.module_sizerust-analyzer cargo qrcode 0.14.1 render/Renderer#module_size. = (maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(width, 1), maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(height, 1)); |
| 120 | self |
| 121 | } |
| 122 | |
| 123 | #[deprecated(since = "0.4.0", note = "use `.min_dimensions(width, width)` instead")] |
| 124 | pub fn min_widthrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]min_width().(&mut self, width: u32) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 125 | self.min_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]min_dimensions().(width, width) |
| 126 | } |
| 127 | |
| 128 | /// Sets the minimum total image size in pixels, including the quiet zone if |
| 129 | /// applicable. The renderer will try to find the dimension as small as |
| 130 | /// possible, such that each module in the QR code has uniform size (no |
| 131 | /// distortion). |
| 132 | /// |
| 133 | /// For instance, a version 1 QR code has 19 modules across including the |
| 134 | /// quiet zone. If we request an image of size ≥200×200, we get that each |
| 135 | /// module's size should be 11×11, so the actual image size will be 209×209. |
| 136 | pub fn min_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]min_dimensions().(&mut self, width: u32, height: u32) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 137 | let quiet_zone = if self.has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone. { 2 } else { 0 } rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().self.quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#quiet_zone.; |
| 138 | let width_in_modules = self.modules_countrust-analyzer cargo qrcode 0.14.1 render/Renderer#modules_count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().quiet_zone; |
| 139 | let unit_width = (width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().width_in_modules rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().width_in_modules; |
| 140 | let unit_height = (height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().width_in_modules rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Sub<Self>`]sub().1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().width_in_modules; |
| 141 | self.module_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]module_dimensions().(unit_width, unit_height) |
| 142 | } |
| 143 | |
| 144 | /// Sets the maximum total image size in pixels, including the quiet zone if |
| 145 | /// applicable. The renderer will try to find the dimension as large as |
| 146 | /// possible, such that each module in the QR code has uniform size (no |
| 147 | /// distortion). |
| 148 | /// |
| 149 | /// For instance, a version 1 QR code has 19 modules across including the |
| 150 | /// quiet zone. If we request an image of size ≤200×200, we get that each |
| 151 | /// module's size should be 10×10, so the actual image size will be 190×190. |
| 152 | /// |
| 153 | /// The module size is at least 1×1, so if the restriction is too small, the |
| 154 | /// final image *can* be larger than the input. |
| 155 | pub fn max_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]max_dimensions().(&mut self, width: u32, height: u32) -> &mut Selfrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`] { |
| 156 | let quiet_zone = if self.has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone. { 2 } else { 0 } rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().self.quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#quiet_zone.; |
| 157 | let width_in_modules = self.modules_countrust-analyzer cargo qrcode 0.14.1 render/Renderer#modules_count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().quiet_zone; |
| 158 | let unit_width = width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().width_in_modules; |
| 159 | let unit_height = height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().width_in_modules; |
| 160 | self.module_dimensionsrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]module_dimensions().(unit_width, unit_height) |
| 161 | } |
| 162 | |
| 163 | /// Renders the QR code into an image. |
| 164 | #[deprecated(since = "0.4.0", note = "renamed to `.build()` to de-emphasize the image connection")] |
| 165 | pub fn to_imagerust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]to_image().(&self) -> P::Imagerust-analyzer cargo qrcode 0.14.1 render/Pixel#Image# { |
| 166 | self.buildrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]build().() |
| 167 | } |
| 168 | |
| 169 | /// Renders the QR code into an image. |
| 170 | pub fn buildrust-analyzer cargo qrcode 0.14.1 render/impl#[`Renderer<'a, P>`]build().(&self) -> P::Imagerust-analyzer cargo qrcode 0.14.1 render/Pixel#Image# { |
| 171 | let w = self.modules_countrust-analyzer cargo qrcode 0.14.1 render/Renderer#modules_count.; |
| 172 | let qz = if self.has_quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#has_quiet_zone. { self.quiet_zonerust-analyzer cargo qrcode 0.14.1 render/Renderer#quiet_zone. } else { 0 }; |
| 173 | let width = w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().qz; |
| 174 | |
| 175 | let (mw, mh) = self.module_sizerust-analyzer cargo qrcode 0.14.1 render/Renderer#module_size.; |
| 176 | let real_width = width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().mw; |
| 177 | let real_height = width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().mh; |
| 178 | |
| 179 | let mut canvas = P::Canvasrust-analyzer cargo qrcode 0.14.1 render/Pixel#Canvas#::newrust-analyzer cargo qrcode 0.14.1 render/Canvas#new().(real_width, real_height, self.dark_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#dark_color., self.light_colorrust-analyzer cargo qrcode 0.14.1 render/Renderer#light_color.); |
| 180 | let mut i = 0; |
| 181 | for y in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#width { |
| 182 | for x in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#width { |
| 183 | if qz rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().x && x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().qz && qz rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().y && y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]lt().w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().qz { |
| 184 | if self.contentrust-analyzer cargo qrcode 0.14.1 render/Renderer#content.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Colorrust-analyzer cargo qrcode 0.14.1 types/Color#::Lightrust-analyzer cargo qrcode 0.14.1 types/Color#Light# { |
| 185 | canvas.draw_dark_rectrust-analyzer cargo qrcode 0.14.1 render/Canvas#draw_dark_rect().(x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().mw, y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().mh, mw, mh); |
| 186 | } |
| 187 | i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | canvas.into_imagerust-analyzer cargo qrcode 0.14.1 render/Canvas#into_image().() |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | //}}} |