Skip to content

Commit

Permalink
Fixes possible mask drawing issue; ver 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nakednous committed Oct 30, 2021
1 parent 1dd701c commit b15285a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions examples/convolution/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ function preload() {

function setup() {
createCanvas(800, 800);
// /*
mask = createQuadrille([[0.0625, 0.125, 0.0625],
[0.125, 0.25, 0.125],
[0.0625, 0.125, 0.0625]]);
// */
/*
mask = createQuadrille([ [ -1, -1, -1 ],
[ -1, 9, -1 ],
[ -1, -1, -1 ] ]);
// */
update();
}

Expand Down
13 changes: 8 additions & 5 deletions p5.quadrille.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Quadrille {
/**
* Current library version.
*/
static version = '0.3.0';
static version = '0.3.1';

/**
* @param {Quadrille} quadrille1
Expand Down Expand Up @@ -352,8 +352,8 @@ class Quadrille {
r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 255);
this.memory2D[row][col] = [r, g, b];
//this.memory2D[row][col] = color(r, g, b);
//this.memory2D[row][col] = [r, g, b];
this.memory2D[row][col] = color(r, g, b);
}
}

Expand All @@ -373,8 +373,8 @@ class Quadrille {
let g = green(pattern0) * coords.w0 + green(pattern1) * coords.w1 + green(pattern2) * coords.w2;
let b = blue(pattern0) * coords.w0 + blue(pattern1) * coords.w1 + blue(pattern2) * coords.w2;
let a = alpha(pattern0) * coords.w0 + alpha(pattern1) * coords.w1 + alpha(pattern2) * coords.w2;
this.memory2D[i][j] = [r, g, b, a];
//this.memory2D[i][j] = color(r, g, b, a);
//this.memory2D[i][j] = [r, g, b, a];
this.memory2D[i][j] = color(r, g, b, a);
}
}
}
Expand Down Expand Up @@ -630,8 +630,11 @@ class Quadrille {
this.rect(j * LENGTH, i * LENGTH, LENGTH, LENGTH);
}
else if (typeof quadrille.memory2D[i][j] === 'number' && min < max) {
this.push();
this.colorMode(this.RGB, 255);
this.fill(this.color(this.map(quadrille.memory2D[i][j], min, max, 0, 255), alpha));
this.rect(j * LENGTH, i * LENGTH, LENGTH, LENGTH);
this.pop();
}
}
else if (board) {
Expand Down

0 comments on commit b15285a

Please sign in to comment.