Clipped graphics and ellipses

Monday, 23rd June 2008

qarnos — author of the superb Aether 3D engine — has been lending a hand with the BBC BASIC graphics API and contributed a large amount of very useful code.

2008.06.19.01.gif

First up is some code to clip 16-bit line coordinates down to 8-bit coordinates. This allows for lines to be partially (or completely) off the screen.

2008.06.21.02.gif   2008.06.21.01.gif

He's also written a fast ellipse drawing and filling routine. The ellipses are also clipped to the viewport and are filled with an 8×8 pixel pattern.

2008.06.23.01.gif

The graphics viewport can be redefined using the VDU 24,left;top;right;bottom; command as demonstrated in the above example.

2008.06.23.02.gif   2008.06.23.03.gif

GCOL can also be used to set a plotting mode; either plotting the specified colour directly, performing a logical operation (OR, AND, EOR) or inverting the existing colour.

2008.06.23.04.gif

All but the last of the above screenshots are the result of running BBC BASIC on a TI-83+ SE at 15MHz. The final screenshot is running at the regular 6MHz.

FirstPreviousNextLast RSSSearchBrowse by dateIndexTags