Started canvas trimming

This commit is contained in:
unsettledgames
2020-09-26 13:08:43 +02:00
parent 87a25c0137
commit 4223597659
3 changed files with 51 additions and 0 deletions

View File

@ -182,4 +182,12 @@ function resizeImageData (image, width, height, algorithm) {
resize(image, result)
return result
}
function getPixelPosition(index) {
let linearIndex = index / 4;
let y = linearIndex / layers[0].canvasSize[0];
let x = linearIndex - y * layers[0].canvasSize[0];
return [x, y];
}