added rasterization functions
This commit is contained in:
parent
845e0406ca
commit
ca154a1e20
10
main.js
10
main.js
@ -9,3 +9,13 @@ const targetColor = config.targetColor;
|
|||||||
|
|
||||||
const tolerance = config.tolerance;
|
const tolerance = config.tolerance;
|
||||||
|
|
||||||
|
|
||||||
|
function rasterize(x, y, width){ //scale to image
|
||||||
|
return (x + y * width);
|
||||||
|
}
|
||||||
|
function deRasterize(i, width){
|
||||||
|
return ({
|
||||||
|
y: Math.floor(i/width),
|
||||||
|
x: i % width
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user