hacky re-addition of painted mask auto disappearance after image generation
Former-commit-id: f34d1d077f0be69fce3f3b339eac596863d5846a
This commit is contained in:
parent
869bb6d126
commit
e92976d158
2 changed files with 19 additions and 3 deletions
|
@ -35,7 +35,7 @@
|
|||
<label for="prompt">Prompt:</label>
|
||||
<br />
|
||||
<textarea id="prompt">
|
||||
oceanographic study, underwater wildlife, award winning</textarea
|
||||
ocean floor scientific expedition, underwater wildlife</textarea
|
||||
>
|
||||
<br />
|
||||
<label for="negPrompt">Negative prompt:</label>
|
||||
|
@ -44,7 +44,7 @@ oceanographic study, underwater wildlife, award winning</textarea
|
|||
people, person, humans, human, divers, diver, glitch, error, text, watermark, bad quality, blurry</textarea
|
||||
>
|
||||
<br />
|
||||
<hr />
|
||||
<!-- <hr /> -->
|
||||
</div>
|
||||
<!-- SD section -->
|
||||
<button type="button" class="collapsible">
|
||||
|
@ -139,7 +139,7 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba
|
|||
</a>
|
||||
</span>
|
||||
<br />
|
||||
<hr />
|
||||
<!-- <hr /> -->
|
||||
</div>
|
||||
<div style="display: flex; align-items: center">
|
||||
<div
|
||||
|
|
16
js/index.js
16
js/index.js
|
@ -214,6 +214,7 @@ function imageAcceptReject(x, y, data, extra = null) {
|
|||
document.getElementById("progressDiv").remove();
|
||||
const img = new Image();
|
||||
img.onload = function () {
|
||||
backupAndClearMask(x, y, img.width, img.height);
|
||||
tempCtx.drawImage(img, x, y); //imgCtx for actual image, tmp for... holding?
|
||||
var div = document.createElement("div");
|
||||
div.id = "veryTempDiv";
|
||||
|
@ -300,6 +301,21 @@ function removeChoiceButtons(evt) {
|
|||
tempCtx.clearRect(0, 0, tempCanvas.width, tempCanvas.height);
|
||||
}
|
||||
|
||||
function backupAndClearMask(x, y, w, h) {
|
||||
var clearArea = maskPaintCtx.createImageData(w, h);
|
||||
backupMaskChunk = maskPaintCtx.getImageData(x, y, w, h);
|
||||
backupMaskX = x;
|
||||
backupMaskY = y;
|
||||
var clearD = clearArea.data;
|
||||
for (i = 0; i < clearD.length; i += 4) {
|
||||
clearD[i] = 0;
|
||||
clearD[i + 1] = 0;
|
||||
clearD[i + 2] = 0;
|
||||
clearD[i + 3] = 0;
|
||||
}
|
||||
maskPaintCtx.putImageData(clearArea, x, y);
|
||||
}
|
||||
|
||||
function restoreBackupMask() {
|
||||
// reapply mask if exists
|
||||
if (backupMaskChunk != null && backupMaskX != null && backupMaskY != null) {
|
||||
|
|
Loading…
Reference in a new issue