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>
|
<label for="prompt">Prompt:</label>
|
||||||
<br />
|
<br />
|
||||||
<textarea id="prompt">
|
<textarea id="prompt">
|
||||||
oceanographic study, underwater wildlife, award winning</textarea
|
ocean floor scientific expedition, underwater wildlife</textarea
|
||||||
>
|
>
|
||||||
<br />
|
<br />
|
||||||
<label for="negPrompt">Negative prompt:</label>
|
<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
|
people, person, humans, human, divers, diver, glitch, error, text, watermark, bad quality, blurry</textarea
|
||||||
>
|
>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
<!-- <hr /> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- SD section -->
|
<!-- SD section -->
|
||||||
<button type="button" class="collapsible">
|
<button type="button" class="collapsible">
|
||||||
|
@ -139,7 +139,7 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
<!-- <hr /> -->
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<div
|
<div
|
||||||
|
|
16
js/index.js
16
js/index.js
|
@ -214,6 +214,7 @@ function imageAcceptReject(x, y, data, extra = null) {
|
||||||
document.getElementById("progressDiv").remove();
|
document.getElementById("progressDiv").remove();
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
|
backupAndClearMask(x, y, img.width, img.height);
|
||||||
tempCtx.drawImage(img, x, y); //imgCtx for actual image, tmp for... holding?
|
tempCtx.drawImage(img, x, y); //imgCtx for actual image, tmp for... holding?
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.id = "veryTempDiv";
|
div.id = "veryTempDiv";
|
||||||
|
@ -300,6 +301,21 @@ function removeChoiceButtons(evt) {
|
||||||
tempCtx.clearRect(0, 0, tempCanvas.width, tempCanvas.height);
|
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() {
|
function restoreBackupMask() {
|
||||||
// reapply mask if exists
|
// reapply mask if exists
|
||||||
if (backupMaskChunk != null && backupMaskX != null && backupMaskY != null) {
|
if (backupMaskChunk != null && backupMaskX != null && backupMaskY != null) {
|
||||||
|
|
Loading…
Reference in a new issue