mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix layer transparency calculation
This commit is contained in:
parent
9bc57a6f59
commit
4a44e171fd
@ -3,7 +3,7 @@ export const getImageDataTransparency = (imageData: ImageData) => {
|
|||||||
let isPartiallyTransparent = false;
|
let isPartiallyTransparent = false;
|
||||||
const len = imageData.data.length;
|
const len = imageData.data.length;
|
||||||
for (let i = 3; i < len; i += 4) {
|
for (let i = 3; i < len; i += 4) {
|
||||||
if (imageData.data[i] === 255) {
|
if (imageData.data[i] !== 0) {
|
||||||
isFullyTransparent = false;
|
isFullyTransparent = false;
|
||||||
} else {
|
} else {
|
||||||
isPartiallyTransparent = true;
|
isPartiallyTransparent = true;
|
||||||
@ -14,14 +14,3 @@ export const getImageDataTransparency = (imageData: ImageData) => {
|
|||||||
}
|
}
|
||||||
return { isFullyTransparent, isPartiallyTransparent };
|
return { isFullyTransparent, isPartiallyTransparent };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const areAnyPixelsBlack = (pixels: Uint8ClampedArray) => {
|
|
||||||
const len = pixels.length;
|
|
||||||
const i = 0;
|
|
||||||
for (let i = 0; i < len; i) {
|
|
||||||
if (pixels[i++] === 0 && pixels[i++] === 0 && pixels[i++] === 0 && pixels[i++] === 255) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user