funtion gets pixel color from raw raster
This commit is contained in:
parent
049d19c1f1
commit
fd4e2b2905
15
main.js
15
main.js
@ -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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user