diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index f5c5120..33edc93 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -164,6 +164,7 @@ class QrCode final { /*---- Private helper methods for constructor: Drawing function modules ----*/ + // Reads this object's version field, and draws and marks all function modules. private: void drawFunctionPatterns(); @@ -173,20 +174,22 @@ class QrCode final { // Draws two copies of the version bits (with its own error correction code), - // based on this object's version field (which only has an effect for 7 <= version <= 40). + // based on this object's version field, iff 7 <= version <= 40. private: void drawVersion(); - // Draws a 9*9 finder pattern including the border separator, with the center module at (x, y). + // Draws a 9*9 finder pattern including the border separator, + // with the center module at (x, y). Modules can be out of bounds. private: void drawFinderPattern(int x, int y); - // Draws a 5*5 alignment pattern, with the center module at (x, y). + // Draws a 5*5 alignment pattern, with the center module + // at (x, y). All modules must be in bounds. private: void drawAlignmentPattern(int x, int y); // Sets the color of a module and marks it as a function module. - // Only used by the constructor. Coordinates must be in range. + // Only used by the constructor. Coordinates must be in bounds. private: void setFunctionModule(int x, int y, bool isBlack); diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 16b28ac..76b0e09 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -312,6 +312,7 @@ public final class QrCode { /*---- Private helper methods for constructor: Drawing function modules ----*/ + // Reads this object's version field, and draws and marks all function modules. private void drawFunctionPatterns() { // Draw horizontal and vertical timing patterns for (int i = 0; i < size; i++) { @@ -373,7 +374,7 @@ public final class QrCode { // Draws two copies of the version bits (with its own error correction code), - // based on this object's version field (which only has an effect for 7 <= version <= 40). + // based on this object's version field, iff 7 <= version <= 40. private void drawVersion() { if (version < 7) return; @@ -395,7 +396,8 @@ public final class QrCode { } - // Draws a 9*9 finder pattern including the border separator, with the center module at (x, y). + // Draws a 9*9 finder pattern including the border separator, + // with the center module at (x, y). Modules can be out of bounds. private void drawFinderPattern(int x, int y) { for (int i = -4; i <= 4; i++) { for (int j = -4; j <= 4; j++) { @@ -408,7 +410,8 @@ public final class QrCode { } - // Draws a 5*5 alignment pattern, with the center module at (x, y). + // Draws a 5*5 alignment pattern, with the center module + // at (x, y). All modules must be in bounds. private void drawAlignmentPattern(int x, int y) { for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) @@ -418,7 +421,7 @@ public final class QrCode { // Sets the color of a module and marks it as a function module. - // Only used by the constructor. Coordinates must be in range. + // Only used by the constructor. Coordinates must be in bounds. private void setFunctionModule(int x, int y, boolean isBlack) { modules[y][x] = isBlack; isFunction[y][x] = true; diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 08f801f..56e0317 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -188,6 +188,7 @@ var qrcodegen = new function() { /*---- Private helper methods for constructor: Drawing function modules ----*/ + // Reads this object's version field, and draws and marks all function modules. function drawFunctionPatterns() { // Draw horizontal and vertical timing patterns for (var i = 0; i < size; i++) { @@ -250,7 +251,7 @@ var qrcodegen = new function() { // Draws two copies of the version bits (with its own error correction code), - // based on this object's version field (which only has an effect for 7 <= version <= 40). + // based on this object's version field, iff 7 <= version <= 40. function drawVersion() { if (version < 7) return; @@ -273,7 +274,8 @@ var qrcodegen = new function() { } - // Draws a 9*9 finder pattern including the border separator, with the center module at (x, y). + // Draws a 9*9 finder pattern including the border separator, + // with the center module at (x, y). Modules can be out of bounds. function drawFinderPattern(x, y) { for (var i = -4; i <= 4; i++) { for (var j = -4; j <= 4; j++) { @@ -286,7 +288,8 @@ var qrcodegen = new function() { } - // Draws a 5*5 alignment pattern, with the center module at (x, y). + // Draws a 5*5 alignment pattern, with the center module + // at (x, y). All modules must be in bounds. function drawAlignmentPattern(x, y) { for (var i = -2; i <= 2; i++) { for (var j = -2; j <= 2; j++) @@ -296,7 +299,7 @@ var qrcodegen = new function() { // Sets the color of a module and marks it as a function module. - // Only used by the constructor. Coordinates must be in range. + // Only used by the constructor. Coordinates must be in bounds. function setFunctionModule(x, y, isBlack) { modules[y][x] = isBlack; isFunction[y][x] = true; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 0e0c8b0..4ca2dc8 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -241,6 +241,7 @@ class QrCode(object): # ---- Private helper methods for constructor: Drawing function modules ---- def _draw_function_patterns(self): + """Reads this object's version field, and draws and marks all function modules.""" # Draw horizontal and vertical timing patterns for i in range(self._size): self._set_function_module(6, i, i % 2 == 0) @@ -296,7 +297,7 @@ class QrCode(object): def _draw_version(self): """Draws two copies of the version bits (with its own error correction code), - based on this object's version field (which only has an effect for 7 <= version <= 40).""" + based on this object's version field, iff 7 <= version <= 40.""" if self._version < 7: return @@ -316,7 +317,8 @@ class QrCode(object): def _draw_finder_pattern(self, x, y): - """Draws a 9*9 finder pattern including the border separator, with the center module at (x, y).""" + """Draws a 9*9 finder pattern including the border separator, + with the center module at (x, y). Modules can be out of bounds.""" for i in range(-4, 5): for j in range(-4, 5): xx, yy = x + j, y + i @@ -326,7 +328,8 @@ class QrCode(object): def _draw_alignment_pattern(self, x, y): - """Draws a 5*5 alignment pattern, with the center module at (x, y).""" + """Draws a 5*5 alignment pattern, with the center module + at (x, y). All modules must be in bounds.""" for i in range(-2, 3): for j in range(-2, 3): self._set_function_module(x + j, y + i, max(abs(i), abs(j)) != 1) @@ -334,7 +337,7 @@ class QrCode(object): def _set_function_module(self, x, y, isblack): """Sets the color of a module and marks it as a function module. - Only used by the constructor. Coordinates must be in range.""" + Only used by the constructor. Coordinates must be in bounds.""" assert type(isblack) is bool self._modules[y][x] = isblack self._isfunction[y][x] = True diff --git a/rust/src/lib.rs b/rust/src/lib.rs index b6d3d87..3adf74f 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -269,6 +269,7 @@ impl QrCode { /*---- Private helper methods for constructor: Drawing function modules ----*/ + // Reads this object's version field, and draws and marks all function modules. fn draw_function_patterns(&mut self) { // Draw horizontal and vertical timing patterns let size: i32 = self.size; @@ -339,7 +340,7 @@ impl QrCode { // Draws two copies of the version bits (with its own error correction code), - // based on this object's version field (which only has an effect for 7 <= version <= 40). + // based on this object's version field, iff 7 <= version <= 40. fn draw_version(&mut self) { if self.version.value() < 7 { return; @@ -364,7 +365,8 @@ impl QrCode { } - // Draws a 9*9 finder pattern including the border separator, with the center module at (x, y). + // Draws a 9*9 finder pattern including the border separator, + // with the center module at (x, y). Modules can be out of bounds. fn draw_finder_pattern(&mut self, x: i32, y: i32) { for i in -4 .. 5 { for j in -4 .. 5 { @@ -379,7 +381,8 @@ impl QrCode { } - // Draws a 5*5 alignment pattern, with the center module at (x, y). + // Draws a 5*5 alignment pattern, with the center module + // at (x, y). All modules must be in bounds. fn draw_alignment_pattern(&mut self, x: i32, y: i32) { for i in -2 .. 3 { for j in -2 .. 3 { @@ -390,7 +393,7 @@ impl QrCode { // Sets the color of a module and marks it as a function module. - // Only used by the constructor. Coordinates must be in range. + // Only used by the constructor. Coordinates must be in bounds. fn set_function_module(&mut self, x: i32, y: i32, isblack: bool) { *self.module_mut(x, y) = isblack; self.isfunction[(y * self.size + x) as usize] = true; diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index ccc2478..0c49fbd 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -251,6 +251,7 @@ namespace qrcodegen { /*-- Private helper methods for constructor: Drawing function modules --*/ + // Reads this object's version field, and draws and marks all function modules. private drawFunctionPatterns(): void { // Draw horizontal and vertical timing patterns for (let i = 0; i < this.size; i++) { @@ -313,7 +314,7 @@ namespace qrcodegen { // Draws two copies of the version bits (with its own error correction code), - // based on this object's version field (which only has an effect for 7 <= version <= 40). + // based on this object's version field, iff 7 <= version <= 40. private drawVersion(): void { if (this.version < 7) return; @@ -337,7 +338,8 @@ namespace qrcodegen { } - // Draws a 9*9 finder pattern including the border separator, with the center module at (x, y). + // Draws a 9*9 finder pattern including the border separator, + // with the center module at (x, y). Modules can be out of bounds. private drawFinderPattern(x: int, y: int): void { for (let i = -4; i <= 4; i++) { for (let j = -4; j <= 4; j++) { @@ -351,7 +353,8 @@ namespace qrcodegen { } - // Draws a 5*5 alignment pattern, with the center module at (x, y). + // Draws a 5*5 alignment pattern, with the center module + // at (x, y). All modules must be in bounds. private drawAlignmentPattern(x: int, y: int): void { for (let i = -2; i <= 2; i++) { for (let j = -2; j <= 2; j++) @@ -361,7 +364,7 @@ namespace qrcodegen { // Sets the color of a module and marks it as a function module. - // Only used by the constructor. Coordinates must be in range. + // Only used by the constructor. Coordinates must be in bounds. private setFunctionModule(x: int, y: int, isBlack: boolean): void { this.modules[y][x] = isBlack; this.isFunction[y][x] = true;