RosettaCodeData/Task/Greyscale-bars-Display/XPL0/greyscale-bars-display.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

16 lines
687 B
Text

include c:\cxpl\codes; \intrinsic 'code' declarations
int Q, N, W, B, C, Y;
[SetVid($112); \640x480x24 graphics
for Q:= 0 to 4-1 do \quarter of screen
[N:= 8<<Q; \number of bars
W:= 640/N; \width of bar (pixels)
for B:= 0 to N-1 do \for each bar...
[C:= fix(255.0/float(N-1) * float(if Q&1 then N-1-B else B));
C:= C<<16 + C<<8 + C; \RGB color = gray
for Y:= Q*120 to (Q+1)*120-1 do
[Move(W*B, Y); Line(W*(B+1)-1, Y, C)];
];
];
Q:= ChIn(1); \wait for keystroke
SetVid(3); \restore normal text mode
]