(url, width, height)
| 602 | this.container.style.cursor = this.tool.cursor |
| 603 | } |
| 604 | setImage(url, width, height) { |
| 605 | this.setSize(width, height) |
| 606 | this.layers.background.ctx.clearRect(0, 0, this.width, this.height) |
| 607 | if (!(url && this.inpainter)) { |
| 608 | this.layers.drawing.ctx.clearRect(0, 0, this.width, this.height) |
| 609 | } |
| 610 | if (url) { |
| 611 | var image = new Image() |
| 612 | image.onload = () => { |
| 613 | this.layers.background.ctx.drawImage(image, 0, 0, this.width, this.height) |
| 614 | } |
| 615 | image.src = url |
| 616 | } else { |
| 617 | this.layers.background.ctx.fillStyle = "#ffffff" |
| 618 | this.layers.background.ctx.beginPath() |
| 619 | this.layers.background.ctx.rect(0, 0, this.width, this.height) |
| 620 | this.layers.background.ctx.fill() |
| 621 | } |
| 622 | this.history.clear() |
| 623 | } |
| 624 | saveImage() { |
| 625 | if (!this.inpainter) { |
| 626 | // This is not an inpainter, so save the image as the new img2img input |
no test coverage detected