graphicsDeploy api:
draw.h
Library defining 2d drawing environment and establishing a set of basic drawing functions. All use the current state's pencolor to draw, and will draw with transparency determined by the alpha-channel in the state's canvas Image.
struct State
The State structure holds basic data regarding the current state of the immediate screen-drawing environment; some of its variables refer to features not yet implemented (dashed lines, antialiasing, etc.) Currently, state variables are accessed directly, ie. state->pencolor = newColor(...)
struct State {
   struct Image *canvas;
   Color pencolor, fillcolor;
   int thickness, dashlen, gaplen; /* number of pixels */
   short fillstyle; /* one of available fill styles */
   short fillborder, antialias; /*TRUE or FALSE */
   ImagePoint filloffset; /* offsets patterns and gradients */
   Color floodtolerance; /* bg tolerance for flood fills*/
   struct Image *pattern;
   struct Gradient *gradient;
};
struct State *initState(struct Image *canvas);
struct State *copyState(struct State *state);
void freeState(struct State *state);
pixels
The most basic drawing function allows you to color single pixels with the current pen color:
int drawPixel(struct State *state, ImagePoint point);
lines
Not surprisingly, draws lines. Uses bresenham's algorithm, of course. Thick lines are scan-filled. There are a handful of related functions which call drawLine() to render multiple lines -- rectangle() creates screen-aligned rectangles; polyline() creates a series of lines with adjoining endpoints; polygon() is like polyline() but connects the last point to the first; and manylines() just draws a bunch of lines, fed with start and end points pairwise.
int drawLine(struct State *state, ImagePoint start, ImagePoint end);
int rectangle(struct State *state, ImagePoint corner1, ImagePoint corner2);
int polygon(struct State *state, int n_points, ImagePoint *points);
int polyline(struct State *state, int n_points, ImagePoint *points);
int manylines(struct State *state, int n_points, ImagePoint *points);
circles and ellipses
circle() draws circles, ellipse() draws axis-aligned ellipses, and ellipsedAngled() draws non-axis-aligned ellipses. Variants of bresenham's algorithm are used in each case. Scan fills are used to handle thick lines.
int circle(struct State *state, ImagePoint center, long radius);
int ellipse(struct State *state, ImagePoint center, long radius_x, long radius_y);
int ellipseAngled(struct State *state, ImagePoint center, long radius_x,
   long radius_y, float angle_degrees);
fills and bordered fills
There are a variety of functions for creating fills and filled shapes, all of which are fairly self explanatory. All of the flood-fills are done with some flavor of scan-filling. If the current borderstyle is FALSE, no border is drawn for filled shapes, but a variable thickness border will be drawn if borderstyle is TRUE (this does not effect flood fills). Borders are drawn in the current pencolor, fills are drawn using the current fillstyle (either SOLID, which uses the current fillcolor, or PATTERN or GRADIENT)
int fillRectangle(struct State *state, ImagePoint corner1, ImagePoint corner2);
int fillPolygon(struct State *state, int n_points, ImagePoint *points);
int fillCircle(struct State *state, ImagePoint c, long radius);
int fillEllipse(struct State *state, ImagePoint c, long radius_x, long radius_y);
int fillEllipseAngled(struct State *state, ImagePoint center, long radius_x,
   long radius_y, float angle_degrees);
int floodFill(struct State *state, ImagePoint point);