diff --git a/main.js b/main.js index f0b7632..6193aba 100644 --- a/main.js +++ b/main.js @@ -29,3 +29,18 @@ function compareColors(c1,c2){ //compare two rgba color structs return true; } else return false; } +//gets color of a pixel at given coordinate +function getPixel(pos,img) { + + //pixel origin + let o = pos * 4; + + let p = { + r: img[o], + g: img[o+1], + b: img[o+2], + a: img[o+3] + }; + + return p; +} \ No newline at end of file