Subsections

Drawing primitives

Defined in draw.h and draw.c

Like the text input-output functions, the drawing functions all take the smallest possible number of parameters to put something on the screen: some coordinates.

Drawing parameters are set with the graphics parameter functions.

void ts_getpixel (int x, int y)

Reads the color of the pixel at position (x,y). The source bitmap is set using ts_tobuff, ts_toscr or ts_tobmp.

void ts_putpixel (int x, int y)

Writes a pixel to the specified position in the bitmap. Color set with ts_fgcolor and the destination bitmap is set using ts_tobuff, ts_toscr or ts_tobmp.

void ts_circle (int x, int y, int radius)

Draws a circle around point (x,y) using radius as radius. Use ts_fill for switching fill mode.

void ts_line (int x1, int y1, int x2, int y2)

Draws a line between (x1,y1) and (x2,y2).

void ts_hline (int x1, int x2, int y)

Draws a horizontal line between x1 and x2 at vertical position y.

void ts_vline (int x, int y1, int y2)

Draws a vertical line between y1 and y2 at horizontal position x.

void ts_rect (int x1, int y1, int x2, int y2)

Draws an outline rectangle with the two points as its opposite corners. Use ts_fill for switching fill mode.

void ts_triangle (int x1, int y1, int x2, int y2, int x3, int y3)

Draws an outline triangle with points (x1,y1), (x2,y2) and (x3,y2) as vertexes. Use ts_fill for switching fill mode.

void ts_polygon (int points, int *xy)

Draws a polygon with an arbitrary number of vertexes. Pass the number of vertexes and an array containing a series of x, y points (should be an array with a total of vertexes*2 values). Polygons are never filled. Only the contours are drawn.

void ts_arc (int x, int y, int ang1, int ang2, int r);

Draws an arc with center (x,y) and radius r starting at angle ang1 until it reaches angle ang1. Angles are in degrees counter-clockwise (0-360): zero is to the right of the center point, larger values rotate anticlockwise from there.

void ts_ellipse (int x, int y, int rx, int ry);

Draws an ellipse with center (x,y) and x-radius rx and y-radius ry. This function is only suitable for horizontally or vertically oriented ellipses. No other rotations are supported. Use ts_fill for switching fill mode.

void ts_floodfill (int x, int y);

Floodfills an enclosed area with the current drawing color starting at point (x,y).


top
Persoonlijke pagina Universiteit GentTscope
Allegro | Cygwin | Gcc
© See license.html for copyright information