- A C library for programming cognitive experiments on Windows
Defined in graphics.h and graphics.c
This part contains functions to change the graphics parameters of the text output and drawing functions. By default, text appears in a terminal font, and circles, ellipses etc. are not filled. All drawing is done in white against a black background. The text and drawing functions do not have arguments to alter the graphics parameters. This is done with the parameter functions below. They all change one parameter, e.g. the foreground color. Once a parameter value is changed, the given value is used for all further drawing until it is changed again.
The parameter functions all have the previous parameter setting as return value. This can be useful when you want to change some parameters in one part of a program, do some drawing and set the previous parameters again, without causing undesired parameter changes to other parts of the program.
Tscope represents colors as integer values. You can use predefined color values (see appendix) or you can compute a color value based on RGB triplets with ts_makecolor.
Returns the previous background color value.
Possible colors can be found in the appendix of the reference manual, or can be made by yourself through ts_makecolor.
Tscope represents colors as integer values. You can use predefined color values (see appendix) or you can compute a color value based on RGB triplets with ts_makecolor.
Returns the previous drawing color value.
Tscope represents colors as integer values. You can use predefined color values (see appendix) or you can compute a color value based on RGB triplets with ts_makecolor.
Returns the previous text background color value.
Computes a color value based on an RGB triplet. r, g and b are from the range [0,255].
It is possible to call this function as a parameter to the functions ts_bgcolor, ts_fgcolor or ts_textmode (e.g. ts_fgcolor (ts_makecolor (255,0,0)); changes the drawing color to red).
Computes a color value based on an HSV (hue, saturation, value) triplet. Hue is between 0 and 360, saturation and value between 0 and 1.
This function can be used as an alternative to ts_makecolor.
Returns the previous fill-mode.
Default a terminal-like font is used. The other fonts are provided in separate data files and are loaded the first time they are used. This takes some time (not exactly much, but enough to mess up the timing of a response), so make sure all used fonts are loaded before the first trial starts.
The font data files are provided in /usr/local/fonts
. Tscope will search for
the font files in the program's working directory, the fonts
subdirectory of
this directory and in /usr/local/fonts
.
Returns the number of the previous font.
Sets the font based on the return value of a previous call to ts_font. Can be useful if one part of a program changes the font and wants to switch to the previous font again, without explicitly knowing what the previous font was.
ts_setfont(0) switches back to the default terminal font.
Returns the number of the previous font.
fonts
subdirectory of this directory
and in /usr/local/fonts
.
The Tscope FAQ explains how to make a custom font file.
Returns the number of the previous font.