Up |
Return the color of a specific pixel.
fun [ObjBitmap8 I I] I
Return : I the color (0-256) or nil if error
fun getColor (bmp8, x, w, h)=
if h < 0 then
0
else
let _GETpixel8 bmp8 x h -> c in
if c == nil then
1
else
(
_fooS sprintf "px '%d,%d' : %d" [x y c]; // sprintf is a Syspack function
if x >= (w-1) then
(
set x = 0;
h = h-1
)
else
set x = x+1;
getColor bmp8 x w h
);;
fun main ()=
_showconsole;
let _LDbitmap8 _channel _checkpack "tests/os2d/bitmap8/image8_0.bmp" -> bmp8 in
let _GETbitmap8Size bmp8 -> [w8 h8] in
_fooId getColor bmp8 w8-1 h8-1;
0;;