Task

Using the data storage type defined on the Bitmap page for raster graphics images,

draw a line given two points with Bresenham's line algorithm.




include c:\cxpl\codes;  \intrinsic 'code' declarations
[SetVid($112);          \set 640x480 graphics in 24-bit color
Move(10, 20);           \set start of line segment
Line(600, 400, $123456);\draw line segment, red=$12, green=$34, blue=$56
if ChIn(1) then [];     \wait for keystroke while viewing graphic screen
SetVid(3);              \restore normal text mode
]