awesome-qr
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -804,19 +804,36 @@ /** | ||
var _elImage = this._elImage; | ||
var _oContext = this._oContext; | ||
var _tCanvas = document.createElement("canvas"); | ||
var _oContext = _tCanvas.getContext("2d"); | ||
// var _oContext = this._oContext; | ||
var _htOption = this._htOption; | ||
var nCount = oQRCode.getModuleCount(); | ||
var size = _htOption.size; | ||
var margin = _htOption.margin; | ||
var rawSize = _htOption.size; | ||
var rawMargin = _htOption.margin; | ||
if (margin < 0 || margin * 2 >= size) { | ||
margin = 20; | ||
if (rawMargin < 0 || rawMargin * 2 >= rawSize) { | ||
rawMargin = 0; | ||
} | ||
var viewportSize = size - 2 * margin; | ||
var margin = Math.ceil(rawMargin); | ||
var rawViewportSize = rawSize - 2 * rawMargin; | ||
var whiteMargin = _htOption.whiteMargin; | ||
var backgroundDimming = _htOption.backgroundDimming; | ||
var nWidth = viewportSize / nCount; | ||
var nHeight = viewportSize / nCount; | ||
var rawWidth = rawViewportSize / nCount; | ||
var rawHeight = rawWidth; | ||
var nWidth = Math.ceil(rawWidth); | ||
var nHeight = nWidth; | ||
var viewportSize = nWidth * nCount; | ||
var size = viewportSize + 2 * margin; | ||
_tCanvas.width = size; | ||
_tCanvas.height = size; | ||
console.log("rawSize=" + rawSize + ", drawSize=" + size); | ||
console.log("rawViewportSize=" + rawViewportSize + ", drawViewportSize=" + viewportSize); | ||
console.log("rawWidth=rawHeight=" + rawWidth + ", drawWidth=drawHeight=" + nWidth); | ||
var dotScale = _htOption.dotScale; | ||
@@ -826,3 +843,3 @@ _elImage.style.display = "none"; | ||
if (dotScale <= 0 || dotScale >= 1) { | ||
if (dotScale <= 0 || dotScale > 1) { | ||
dotScale = 0.35; | ||
@@ -1005,2 +1022,9 @@ } | ||
var _fCanvas = document.createElement("canvas"); | ||
var _fContext = _fCanvas.getContext("2d"); | ||
_fCanvas.width = rawSize; | ||
_fCanvas.height = rawSize; | ||
_fContext.drawImage(_tCanvas, 0, 0, rawSize, rawSize); | ||
this._elCanvas = _fCanvas; | ||
this._bIsPainted = true; | ||
@@ -1007,0 +1031,0 @@ if (this._callback !== undefined) { |
{ | ||
"name": "awesome-qr", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "An awesome QR code generator written in JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "awesome-qr.js", |
@@ -104,3 +104,3 @@ # Awesome-qr.js | ||
----|---- | ||
contents | Contents to encode. 欲编码的内容 | ||
text | Contents to encode. 欲编码的内容 | ||
size | Width as well as the height of the output QR code, includes margin. 尺寸, 长宽一致, 包含外边距 | ||
@@ -110,3 +110,3 @@ margin | Margin to add around the QR code. 二维码图像的外边距, 默认 20px | ||
colorLight | Color of empty space, or "false" blocks. Works only when both colorDark and colorLight are set. (BYTE_EPT) 空白区的颜色 | ||
backgroundImage | Background image to embed in the QR code. Leave null to disable. 欲嵌入的背景图, 设为 null 以禁用 | ||
backgroundImage | Background image to embed in the QR code. Leave null to disable. 欲嵌入的背景图, 设为 `undefined` 以禁用 | ||
backgroundDimming | Color mask to add above the background image. Helpful when having problems with decoding. 叠加在背景图上的颜色, 在解码有难度的时有一定帮助 | ||
@@ -118,3 +118,3 @@ logoImage | Logo image to embed at the center of generated QR code. Leave `undefined` to disable. 欲嵌入至二维码中心的 LOGO 标识, 设为 `undefined` 以禁用 | ||
whiteMargin | If set to true, a white border will appear around the background image. Default is true. 若设为 true, 背景图外将绘制白色边框 | ||
dotScale | Value used to scale down the data dots' size. (0 < scale < 1.0f) 数据区域点缩小比例 | ||
dotScale | Value used to scale down the data dots' size. (0 < scale <= 1.0) 数据区域点缩小比例 | ||
autoColor | If set to true, the dominant color of backgroundImage will be used as colorDark. Default is true. 若为 true, 背景图的主要颜色将作为实点的颜色, 即 colorDark | ||
@@ -153,2 +153,8 @@ binarize | If set to true, the whole image will be binarized with the given threshold, or default threshold if not specified. Default is false. 若为 true, 图像将被二值化处理, 未指定阈值则使用默认值 | ||
##### Ver. 1.0.8 | ||
- Fixed a bug which would leave white stripes between neighboring blocks while drawing QRCode at scale ```1.0```. | ||
 | ||
##### Ver. 1.0.7 | ||
@@ -155,0 +161,0 @@ |
6214697
12
1185
243