()
| 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 |
| 627 | this.layers.background.ctx.drawImage(this.layers.drawing.canvas, 0, 0, this.width, this.height) |
| 628 | var base64 = this.layers.background.canvas.toDataURL() |
| 629 | initImagePreview.src = base64 // this will trigger the rest of the app to use it |
| 630 | } else { |
| 631 | // This is an inpainter, so make sure the toggle is set accordingly |
| 632 | var is_blank = !this.layers.drawing.ctx |
| 633 | .getImageData(0, 0, this.width, this.height) |
| 634 | .data.some((channel) => channel !== 0) |
| 635 | maskSetting.checked = !is_blank |
| 636 | maskSetting.dispatchEvent(new Event("change")) |
| 637 | } |
| 638 | this.hide() |
| 639 | } |
| 640 | getImg() { |
| 641 | // a drop-in replacement of the drawingboard version |
| 642 | return this.layers.drawing.canvas.toDataURL() |
no test coverage detected