next up previous contents
Next: Overlay Mode Up: Tina View Previous: Output Primitives   Contents

Output Attributes

The Tv stores a current draw context. This contains information about the current draw colour, raster op, line style, line width, and text font. The specified context will be used for drawing all primitives until it is changed. Note that not all the options given here will always be available, however a sensible default will be chosen. Note that some options do not work properly until at least one tvtool has been created (since this is when the colormap, fonts, etc. are loaded).

The current draw colour is set by a call to

void    tv_set_color(Tv * tv, Tina_pixel color)
Colours are described in more detail later; they are specified by integers, and global variables with colour names such as red, green, magenta etc. refer to the standard colours. The default colour is black.

tv_set_rop(Tv *tv, int rop)
Alternative raster ops will not be useful in general. Two global variables are defined, rop_copy (which is the default, and copies the primitive onto the screen) and rop_xor (which xor's the primitive onto the screen). In practice the only use for rop's is overlaying for animation purposes, this is best done using the overlay mode (see below).

tv_set_linestyle(Tv *tv, int style)
Two line styles are available at present, specified by integer global variables line_solid and line_dotted.

tv_set_linewidth(Tv *tv, int width)
This sets the line width in pixels. Width zero is the default, this is a fast line drawing mode. Widths 1 and up are much slower.

tv_set_font(Tv *tv, int font)
Graphics is displayed using the current font. Three fixed width fonts are searched for, and identified by the global variables small_font, medium_font, and large_font. If a search fails default_font will be used, this always exists. The initial font is medium_font or default_font.

So that functions drawing to the same Tv do not interfere, two functions are provided to store and reset the draw context. After making a call to

tv_save_draw(Tv *tv)
the draw context is saved. A subsequent call to

tv_reset_draw(Tv *tv)
will restore the original draw context. Repeated calls to these functions nest properly.

next up previous contents
Next: Overlay Mode Up: Tina View Previous: Output Primitives   Contents
root 2017-09-25