mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-19 20:14:58 +00:00
Improved Paint color matching, created _strokeThickness constant.
This commit is contained in:
parent
b233809f6c
commit
ef8dd31757
4 changed files with 6 additions and 3 deletions
BIN
.vs/qbjs/v17/.suo
Normal file
BIN
.vs/qbjs/v17/.suo
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite-journal
Normal file
BIN
.vs/slnx.sqlite-journal
Normal file
Binary file not shown.
9
qb.js
9
qb.js
|
@ -5,7 +5,7 @@ var QB = new function() {
|
|||
this.LOCAL = Symbol("LOCAL");
|
||||
this.SESSION = Symbol("SESSION");
|
||||
|
||||
|
||||
var _strokeThickness = 2;
|
||||
var _fgColor = null;
|
||||
var _bgColor = null;
|
||||
var _colormap = [];
|
||||
|
@ -769,6 +769,7 @@ var QB = new function() {
|
|||
screen.lastY = y;
|
||||
|
||||
var ctx = screen.ctx;
|
||||
ctx.lineWidth = _strokeThickness;
|
||||
ctx.strokeStyle = color.rgba();
|
||||
ctx.beginPath();
|
||||
if (aspect == undefined) {
|
||||
|
@ -817,6 +818,7 @@ var QB = new function() {
|
|||
screen.lastY = ey;
|
||||
|
||||
var ctx = screen.ctx;
|
||||
ctx.lineWidth = _strokeThickness;
|
||||
|
||||
if (style == "B") {
|
||||
ctx.strokeStyle = color.rgba();
|
||||
|
@ -956,8 +958,9 @@ var QB = new function() {
|
|||
var g = dat[p+1];
|
||||
var b = dat[p+2];
|
||||
//var a = dat[p+3];
|
||||
if ((r == c1.r) && (g == c1.g) && (b == c1.b)) { return false; }
|
||||
if ((r == c2.r) && (g == c2.g) && (b == c2.b)) { return false; }
|
||||
var thresh = 2;
|
||||
if ((Math.abs(r - c1.r) < thresh) && (Math.abs(g - c1.g) < thresh) && (Math.abs(b - c1.b) < thresh)) { return false; }
|
||||
if ((Math.abs(r - c2.r) < thresh) && (Math.abs(g - c2.g) < thresh) && (Math.abs(b - c2.b) < thresh)) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue