funtion gets pixel color from raw raster

This commit is contained in:
APEX FIGHT 2025-04-08 20:35:26 -04:00
parent 049d19c1f1
commit fd4e2b2905

15
main.js
View File

@ -29,3 +29,18 @@ function compareColors(c1,c2){ //compare two rgba color structs
return true; return true;
} else return false; } 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;
}