strokeRect(x, y, w, h) {
for (let i = x; i < x + w; i++) {
this.fillPixelWithColor(i, y, this.calculateRGBA_stroke(i, y));
console.log("calculated: " + this.calculateRGBA_stroke(i, y) );
this.fillPixelWithColor(i, y + h, this.calculateRGBA_stroke(i, y + h));
console.log("calculated: " + i + " " + (y + h));
}
for (let j = y; j < y + h; j++) {
this.fillPixelWithColor(x, j, this.calculateRGBA_stroke(x, j));
this.fillPixelWithColor(x + w, j, this.calculateRGBA_stroke(x + w, j));
}
}
The second for loop needs to have for (let j = y; j <= y + h; j++) otherwise the lower right most pixel does not get painted.
strokeRect(x, y, w, h) {
for (let i = x; i < x + w; i++) {
this.fillPixelWithColor(i, y, this.calculateRGBA_stroke(i, y));
console.log("calculated: " + this.calculateRGBA_stroke(i, y) );
this.fillPixelWithColor(i, y + h, this.calculateRGBA_stroke(i, y + h));
console.log("calculated: " + i + " " + (y + h));
The second for loop needs to have for (let j = y; j <= y + h; j++) otherwise the lower right most pixel does not get painted.