1 /*****************************************************************************/
5 /* Tiny graphics interface */
9 /* (C) 2002 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
42 #include "tgi/tgi-mode.h"
45 #include "tgi/tgi-error.h"
50 /*****************************************************************************/
52 /*****************************************************************************/
57 unsigned char r; /* Red component */
58 unsigned char g; /* Green component */
59 unsigned char b; /* Blue component */
64 /*****************************************************************************/
66 /*****************************************************************************/
70 void __fastcall__ tgi_load (unsigned char mode);
71 /* Install the matching driver for the given mode. Will just load the driver
72 * and check if loading was successul. Will not switch to gaphics mode.
75 void __fastcall__ tgi_load_driver (const char* name);
76 /* Install the given driver. This function is identical to tgi_load with the
77 * only difference that the name of the driver is specified explicitly. You
78 * should NOT use this function in most cases, use tgi_load() instead.
81 void __fastcall__ tgi_unload (void);
82 /* Unload the currently loaded driver. */
84 void __fastcall__ tgi_init (unsigned char mode);
85 /* Initialize the given graphics mode. */
87 void __fastcall__ tgi_done (void);
88 /* End graphics mode, switch back to text mode. Will NOT unload the driver! */
90 unsigned char __fastcall__ tgi_geterror (void);
91 /* Return the error code for the last operation. This will also clear the
95 void __fastcall__ tgi_clear (void);
96 /* Clear the screen */
98 unsigned char __fastcall__ tgi_getmaxcolor (void);
99 /* Return the maximum supported color number (the number of colors would
100 * then be getmaxcolor()+1).
103 unsigned __fastcall__ tgi_getmaxx (void);
104 /* Return the maximum x coordinate. The resolution in x direction is
108 unsigned __fastcall__ tgi_getmaxy (void);
109 /* Return the maximum y coordinate. The resolution in y direction is
113 unsigned __fastcall__ tgi_getxres (void);
114 /* Return the resolution in X direction */
116 unsigned __fastcall__ tgi_getyres (void);
117 /* Return the resolution in Y direction */
119 void __fastcall__ tgi_setcolor (unsigned char color);
120 /* Set the current drawing color */
122 unsigned char __fastcall__ tgi_getcolor (void);
123 /* Return the current drawing color */
125 unsigned char __fastcall__ tgi_getbkcolor (void);
126 /* Return the current background color */
128 void __fastcall__ tgi_setbkcolor (unsigned char color);
129 /* Set the background color */
131 unsigned char __fastcall__ tgi_getpixel (int x, int y);
132 /* Get the color value of a pixel */
134 void __fastcall__ tgi_setpixel (int x, int y);
135 /* Plot a point in the current drawing color */
137 void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
138 /* Draw a line in the current drawing color */
140 void __fastcall__ tgi_lineto (int x2, int y2);
141 /* Draw a line in the current drawing color from the graphics cursor to the
145 void __fastcall__ tgi_circle (int x, int y, unsigned char radius);
146 /* Draw a circle in the current drawing color */
148 void __fastcall__ tgi_outtext (int x, int y, const char* text);
149 /* Print a text in graphics mode */
151 void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
152 /* Draw a bar (a filled rectangle) using the current color */