next up previous contents
Next: Output Attributes Up: Tina View Previous: Installing a Tv on   Contents

Output Primitives

This section describes the lowest level of graphic output, using raw screen positions. In the examples above screen positions were described by a pair of integer values (x, y). Actually the lowest level of graphics uses an integer position structure

typedef struct ipos
{
    Ts_id ts_id;                /* Tina structure identifier */
    int     x;
    int     y;
}       Ipos;

to describe positions relative to the top left-hand corner of the display window in pixel coordinates. Such positions can be created by calling the function

Ipos ipos(int x, int y)

for example

Ipos centre;
centre = ipos(128, 128);

The primitive display functions are then

void tv_point(Tv * tv, Ipos p)
- draws a single point at the given position.

void tv_dot(Tv * tv, Ipos p)
- draws a 3 by 3 square dot centred at the given position.

void tv_line(Tv * tv, Ipos p1, Ipos p2)
- draws a line between the given positions.

void tv_rect(Tv * tv, Ipos p1, Ipos p2)
- draws a rectangle with given upper left and lower right corners.

void tv_fillrect(Tv * tv, Ipos p1, Ipos p2)
- draws a filled rectangle with given upper left and lower right corners.

void tv_text(Tv * tv, char *string, Ipos p)
- writes the text string with its top right corner at the given position.

void tv_circle(Tv * tv, Ipos centre, int radius)
- draws a circle with given centre and radius.

Two more functions are described here for completeness, they are the lowest level image display functions.

void tv_raster(Tv * tv, int x1, int x2, int y, char *raster)
- puts a whole raster into the display window, going from (x1, y) to (x2, y). The pixels values used are given by the values raster[x1], ..., raster[x2] in the array of characters. (For an explanation of pixel values vs. colors see "Using Color in Tv's").

void tv_image(Tv * tv, int c, int r, int w, int h, char *data)
- puts a whole image of given width and height into the display window with the top left corner at (x, y). The pixel values are stored by rows in a data array of length width*height. Note that this storage convention is rarely used in Tina - this is a low level display function.

These low-level functions will not often be used in practice, since there are versions which perform automatic 2D and 3D projection (see "Specifying Tv Projection"). When they are used it is often more convenient to call the xy version of the function. These have `xy' appended to the name above and have Ipos arguments replaced by the separate x and y values, e.g.

void tv_textxy(Tv * tv, char *string, int x, int y)

void tv_linexy(Tv * tv, int x1, int y1, int x2, int y2)
Only the image display functions do not have xy versions (they are xy already).


next up previous contents
Next: Output Attributes Up: Tina View Previous: Installing a Tv on   Contents
root 2017-09-21