From fd4e2b29053ecc5fe1b2791b1537e295e20918a3 Mon Sep 17 00:00:00 2001 From: APEX FIGHT Date: Tue, 8 Apr 2025 20:35:26 -0400 Subject: [PATCH] funtion gets pixel color from raw raster --- main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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