remove old image upload

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>

Former-commit-id: 281286dfc3b040fb196dd0141278201c9d7036eb
This commit is contained in:
Victor Seiji Hariki 2022-11-25 00:39:22 -03:00
parent 70d1fda23d
commit 7f1905061b
2 changed files with 1 additions and 61 deletions

View file

@ -95,12 +95,8 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba
onchange="changeMaskBlur()" />
<br />
<!-- Save/load image section -->
<button type="button" class="collapsible">Save/Load/New image</button>
<button type="button" class="collapsible">Save/Upscaling</button>
<div class="content">
<label for="preloadImage">Load image:</label>
<input type="file" id="preloadImage" onchange="preloadImage()"
accept="image/*" / style="width: 200px;">
<br />
<button onclick="downloadCanvas()">Save canvas</button>
<br />
<label for="upscalers">Choose upscaler</label>

View file

@ -130,25 +130,6 @@ function startup() {
document.getElementById("scaleFactor").value = scaleFactor;
}
function drop(imageParams) {
const img = new Image();
img.onload = function () {
writeArbitraryImage(img, imageParams.x, imageParams.y);
};
img.src = arbitraryImageBase64;
}
function writeArbitraryImage(img, x, y) {
commands.runCommand("drawImage", "Image Stamp", {
x,
y,
image: img,
});
blockNewImages = false;
placingArbitraryImage = false;
document.getElementById("preloadImage").files = null;
}
function dream(
x,
y,
@ -595,43 +576,6 @@ function drawBackground() {
}
}
function preloadImage() {
// possible firefox-only bug?
// attempt to prevent requesting a dream if double-clicking a selected image
document.getElementById("overlayCanvas").onmousemove = null;
document.getElementById("overlayCanvas").onmousedown = null;
document.getElementById("overlayCanvas").onmouseup = null;
var file = document.getElementById("preloadImage").files[0];
var reader = new FileReader();
reader.onload = function (evt) {
var imgCanvas = document.createElement("canvas");
var imgCtx = imgCanvas.getContext("2d");
arbitraryImage = new Image();
arbitraryImage.onload = function () {
blockNewImages = true;
// now put it into imagedata for canvas fun
imgCanvas.width = arbitraryImage.width;
imgCanvas.height = arbitraryImage.height;
imgCtx.drawImage(arbitraryImage, 0, 0);
arbitraryImageData = imgCtx.getImageData(
0,
0,
arbitraryImage.width,
arbitraryImage.height
); // can't use that to drawImage on a canvas...
arbitraryImageBitmap = createImageBitmap(arbitraryImageData); // apparently that either... maybe just the raw image?
arbitraryImageBase64 = imgCanvas.toDataURL();
placingArbitraryImage = true;
document.getElementById("overlayCanvas").onmousemove = mouseMove;
document.getElementById("overlayCanvas").onmousedown = mouseDown;
document.getElementById("overlayCanvas").onmouseup = mouseUp;
};
arbitraryImage.src = evt.target.result;
};
reader.readAsDataURL(file);
}
function downloadCanvas() {
var link = document.createElement("a");
link.download =