Skip to content

Commit 67edd1d

Browse files
committed
Optimised SVG shape by reducing points (another 60% size reduction)
* 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
1 parent 6e02b98 commit 67edd1d

File tree

8 files changed

+337
-71
lines changed

8 files changed

+337
-71
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ All the implementations are based on JIS X 0510:1999.
77

88
The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED
99
<br/>http://www.denso-wave.com/qrcode/faqpatent-e.html
10+
11+
----
12+
13+
This repository is a fork of the original with all programming languages.
14+
It contains **only improvements for the JavaScript implementation**.
15+
Other files have not been altered or regarded in any way.

js/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Make a QR Code.
5959
The number of modules(cells) for each orientation.
6060
_[Note] call make() before this function._
6161

62+
#### getDarkCount() => <code>number</code>
63+
The total number of modules(cells) that are dark in the final QR code.
64+
_[Note] call make() before this function._
65+
6266
#### isDark(row, col) => <code>boolean</code>
6367
The module at row and col is dark or not.
6468
_[Note] call make() before this function._
@@ -68,6 +72,26 @@ _[Note] call make() before this function._
6872
| row | <code>number</code> | 0 ~ moduleCount - 1 |
6973
| col | <code>number</code> | 0 ~ moduleCount - 1 |
7074

75+
#### getTypeNumber() => <code>number</code>
76+
Gets the code size type of the final QR code.
77+
_[Note] call make() before this function._
78+
79+
#### getMaskPattern() => <code>number</code>
80+
Gets the index of the mask pattern (0 to 7) that was used in the final QR code.
81+
_[Note] call make() before this function._
82+
83+
#### getBestMaskPattern() => <code>number</code>
84+
Gets the index of the mask pattern (0 to 7) that would be chosen for the QR code, based on its minimal penalty score.
85+
_[Note] call make() before this function._
86+
87+
#### getMaskPatternPenaltyScores() => <code>number[]</code>
88+
Gets the calculated penalty score for each mask pattern. Lower values make better QR codes.
89+
_[Note] call make() before this function._
90+
91+
#### setMaskPattern(index) => <code>void</code>
92+
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.
93+
Default to null, which selects the best pattern automatically.
94+
7195
#### setColors(foreground, background) => <code>void</code>
7296
Sets the foreground and background colors for the output formats. Default to black and white, respectively.
7397
_[Note] This has no effect on the ASCII output._

js/miniwebcompiler.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"projectName": "qrcode-generator",
3+
"files": [
4+
{
5+
"name": "qrcode.js"
6+
}
7+
]
8+
}

0 commit comments

Comments
 (0)