aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-08-17 21:02:33 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-08-17 21:02:33 -0400
commit1f44bed14529f8bfc280f714ffd794813c1b7a73 (patch)
tree3ca60a572a8e23fb19c0a6985e1d39b4e9c735e7 /src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
parent107f718199a5b0e15f62e5c7e7034b11047ff512 (diff)
baseline before changes
Diffstat (limited to 'src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts')
-rw-r--r--src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts b/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
index 8d32221bd..4847bfeed 100644
--- a/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
+++ b/src/client/views/nodes/generativeFill/generativeFillUtils/ImageHandler.ts
@@ -35,7 +35,6 @@ export class ImageUtility {
if (width < height) {
// horizontal padding, x offset
const xOffset = (canvasSize - width) / 2;
- console.log(xOffset);
ctx.drawImage(img, xOffset, 0, canvas.width, canvas.height, 0, 0, canvas.width, canvas.height);
} else {
// vertical padding, y offset
@@ -156,7 +155,7 @@ export class ImageUtility {
}
};
- // The image must be loaded!
+ // The image must be loaded
static getCanvasMask = (srcCanvas: HTMLCanvasElement): HTMLCanvasElement | undefined => {
const canvas = document.createElement('canvas');
canvas.width = canvasSize;
@@ -164,7 +163,7 @@ export class ImageUtility {
const ctx = canvas.getContext('2d');
if (!ctx) return;
ctx?.clearRect(0, 0, canvasSize, canvasSize);
- ctx.fillStyle = bgColor;
+ ctx.fillStyle = '#000000';
ctx.fillRect(0, 0, canvasSize, canvasSize);
// extract and set padding data
@@ -182,7 +181,7 @@ export class ImageUtility {
return canvas;
};
- // The image must be loaded!
+ // The image must be loaded
static getCanvasImg = (img: HTMLImageElement): HTMLCanvasElement | undefined => {
const canvas = document.createElement('canvas');
canvas.width = canvasSize;
@@ -194,10 +193,9 @@ export class ImageUtility {
const width = img.width * scale;
const height = img.height * scale;
ctx?.clearRect(0, 0, canvasSize, canvasSize);
- ctx.fillStyle = bgColor;
+ ctx.fillStyle = '#000000';
ctx.fillRect(0, 0, canvasSize, canvasSize);
- // extract and set padding data
if (img.naturalHeight > img.naturalWidth) {
// horizontal padding, x offset
const xOffset = (canvasSize - width) / 2;