Skip to content

Commit

Permalink
Optimised SVG shape by reducing points (another 60% size reduction)
Browse files Browse the repository at this point in the history
* The number of points in the SVG is minimised by connecting all squares in the most efficient way
* Added minified source file with source map
* New sample form options: trim text, select mask pattern
* Mask patterns can be selected and evaluated for file size and visual "beauty"
* Sample form is now fixed, list selections survive page reload in the browser
  • Loading branch information
ygoe committed Jun 3, 2021
1 parent 6e02b98 commit 67edd1d
Show file tree
Hide file tree
Showing 8 changed files with 337 additions and 71 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ All the implementations are based on JIS X 0510:1999.

The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED
<br/>http://www.denso-wave.com/qrcode/faqpatent-e.html

----

This repository is a fork of the original with all programming languages.
It contains **only improvements for the JavaScript implementation**.
Other files have not been altered or regarded in any way.
24 changes: 24 additions & 0 deletions js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ Make a QR Code.
The number of modules(cells) for each orientation.
_[Note] call make() before this function._

#### getDarkCount() => <code>number</code>
The total number of modules(cells) that are dark in the final QR code.
_[Note] call make() before this function._

#### isDark(row, col) => <code>boolean</code>
The module at row and col is dark or not.
_[Note] call make() before this function._
Expand All @@ -68,6 +72,26 @@ _[Note] call make() before this function._
| row | <code>number</code> | 0 ~ moduleCount - 1 |
| col | <code>number</code> | 0 ~ moduleCount - 1 |

#### getTypeNumber() => <code>number</code>
Gets the code size type of the final QR code.
_[Note] call make() before this function._

#### getMaskPattern() => <code>number</code>
Gets the index of the mask pattern (0 to 7) that was used in the final QR code.
_[Note] call make() before this function._

#### getBestMaskPattern() => <code>number</code>
Gets the index of the mask pattern (0 to 7) that would be chosen for the QR code, based on its minimal penalty score.
_[Note] call make() before this function._

#### getMaskPatternPenaltyScores() => <code>number[]</code>
Gets the calculated penalty score for each mask pattern. Lower values make better QR codes.
_[Note] call make() before this function._

#### setMaskPattern(index) => <code>void</code>
Sets the index of the mask pattern (0 to 7) to use in the final QR code, regardless of which the best pattern would be.
Default to null, which selects the best pattern automatically.

#### setColors(foreground, background) => <code>void</code>
Sets the foreground and background colors for the output formats. Default to black and white, respectively.
_[Note] This has no effect on the ASCII output._
Expand Down
8 changes: 8 additions & 0 deletions js/miniwebcompiler.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"projectName": "qrcode-generator",
"files": [
{
"name": "qrcode.js"
}
]
}
Loading

0 comments on commit 67edd1d

Please sign in to comment.