Skip to content

rawr_shapes

Boyd Hamilton edited this page Aug 3, 2024 · 1 revision

rawr_shapes.h

rawr shapes is used to provide rasterized drawing abilities, so the state of the pixel matrix is correctly updated with the shapes you draw. Reading through the function code can be a great learning experience!

Functions

drawline

void rawr_drawline(byte x1, byte y1,byte x2, byte y2, byte b)

Draws an approximation of the line that would be formed between the two points, as colour specified by byte b.

drawlinecardinal

void rawr_drawlinecardinal(byte x1, byte y1, byte x2, byte y2, byte b)

Draws a line only using 4 cardinal directions (no moving diagonally across pixels) as colour specified by byte b.

drawcircle

void rawr_drawcircle(byte xc, byte yc, byte r, byte b);

Uses the midpoint circle algorithm to draw a circle outline centred around the point given with radius r as colour b.

drawcirclefilled

void rawr_drawcirclefilled(byte xc, byte yc, byte r, byte b);

Draws a filled circle centred at the point, with radius r and byte b. An entirely different algorithm is used, and so the outline of a filled circle and an unfilled circle with the same radius at the same point may be different. More noticable at larger radii. Radius is clamped to 35 and 1.

drawrect

void rawr_drawrect(byte x, byte y, byte w, byte h, byte b);

Draws a rectangle, simply uses four lines drawn by drawline.

Clone this wiki locally