illustrator.js
Version:
JavaScript image processing library
41 lines (40 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackgroundColorTool = void 0;
const ToolBox_1 = require("../base/ToolBox");
class BackgroundColorTool extends ToolBox_1.ToolBox {
setFillColor(color) {
this.history.push((ctx) => {
ctx.fillStyle = color;
});
return this;
}
fill(x, y, w, h) {
this.history.push((ctx) => {
ctx.fillRect(x, y, w, h);
});
return this;
}
stroke(x, y, w, h) {
this.history.push((ctx) => {
ctx.strokeRect(x, y, w, h);
});
return this;
}
setStrokeColor(color) {
this.history.push((ctx) => {
ctx.strokeStyle = color;
});
return this;
}
setStrokeWidth(w) {
this.history.push((ctx) => {
ctx.lineWidth = w;
});
return this;
}
render() {
this.layer.applyTool(this);
}
}
exports.BackgroundColorTool = BackgroundColorTool;