mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Removes unused file
This commit is contained in:
parent
21e491f878
commit
002791ef68
@ -1,49 +0,0 @@
|
||||
import Konva from 'konva';
|
||||
import { MaskLine } from '../inpaintingSlice';
|
||||
|
||||
/**
|
||||
* Converts canvas into pixel buffer and checks if it is empty (all pixels full alpha).
|
||||
*
|
||||
* I DON' THINK THIS WORKS ACTUALLY
|
||||
*/
|
||||
const checkIsMaskEmpty = (image: HTMLImageElement, lines: MaskLine[]) => {
|
||||
const offscreenContainer = document.createElement('div');
|
||||
|
||||
const { width, height } = image;
|
||||
|
||||
const stage = new Konva.Stage({
|
||||
container: offscreenContainer,
|
||||
width: width,
|
||||
height: height,
|
||||
});
|
||||
|
||||
const layer = new Konva.Layer();
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
lines.forEach((line) =>
|
||||
layer.add(
|
||||
new Konva.Line({
|
||||
points: line.points,
|
||||
stroke: 'rgb(255,255,255)',
|
||||
strokeWidth: line.strokeWidth * 2,
|
||||
tension: 0,
|
||||
lineCap: 'round',
|
||||
lineJoin: 'round',
|
||||
shadowForStrokeEnabled: false,
|
||||
globalCompositeOperation:
|
||||
line.tool === 'brush' ? 'source-over' : 'destination-out',
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
offscreenContainer.remove();
|
||||
|
||||
const pixelBuffer = new Uint32Array(
|
||||
layer.getContext().getImageData(0, 0, width, height).data.buffer
|
||||
);
|
||||
|
||||
return !pixelBuffer.some((color) => color !== 0);
|
||||
};
|
||||
|
||||
export default checkIsMaskEmpty;
|
Loading…
Reference in New Issue
Block a user