Posts: 274
Threads: 23
Joined: Sep 2007
The color coding is the one of html.
Only 5 bits in each chanel are used. Thus the 3 lower bits in each chanel stay to 0.
EXPORT SHOW_CLR()
BEGIN
LOCAL cr, cg, cb, clr, pc, pl;
RECT();
FOR cr FROM 0 TO 31 DO
pl:= cr MOD 8* 34;
pc:= IP(cr/8)* 34;
FOR cg FROM 0 TO 31 DO
FOR cb FROM 0 TO 31 DO
clr:= RGB(cr*8,cg*8,cb*8);
PIXON_P(cb+pl+2,cg+pc+2,clr);
END;
END;
END;
REPEAT
UNTIL GETKEY() == -1;
FREEZE;
END;
Posts: 193
Threads: 10
Joined: Mar 2008
Hello,
internally, colors are codded in 16 bits using ARGB 1555 format.
so, if you do:
A:= getpix_p(x,y);
return { bitand(A,#FF0000) / # 10000, bitand(A,#FF00) / # 100, bitand(A,#FF) };
you should get what you want.