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. */
93 void __fastcall__ tgi_clear (void);
94 /* Clear the screen */
96 unsigned char __fastcall__ tgi_getmaxcolor (void);
97 /* Return the maximum supported color number (the number of colors would
98 * then be getmaxcolor()+1).
101 unsigned __fastcall__ tgi_getmaxx (void);
102 /* Return the maximum x coordinate. The resolution in x direction is
106 unsigned __fastcall__ tgi_getmaxy (void);
107 /* Return the maximum y coordinate. The resolution in y direction is
111 unsigned __fastcall__ tgi_getxres (void);
112 /* Return the resolution in X direction */
114 unsigned __fastcall__ tgi_getyres (void);
115 /* Return the resolution in Y direction */
117 void __fastcall__ tgi_setcolor (unsigned char color);
118 /* Set the current drawing color */
120 unsigned char __fastcall__ tgi_getcolor (void);
121 /* Return the current drawing color */
123 unsigned char __fastcall__ tgi_getbkcolor (void);
124 /* Return the current background color */
126 void __fastcall__ tgi_setbkcolor (unsigned char color);
127 /* Set the background color */
129 unsigned char __fastcall__ tgi_getpixel (int x, int y);
130 /* Get the color value of a pixel */
132 void __fastcall__ tgi_setpixel (int x, int y);
133 /* Plot a point in the current drawing color */
135 void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
136 /* Draw a line in the current drawing color */
138 void __fastcall__ tgi_lineto (int x2, int y2);
139 /* Draw a line in the current drawing color from the graphics cursor to the
143 void __fastcall__ tgi_circle (int x, int y, unsigned radius);
144 /* Draw a circle in the current drawing color */
146 void __fastcall__ tgi_outtext (int x, int y, const char* text);
147 /* Print a text in graphics mode */
149 void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
150 /* Draw a bar (a filled rectangle) using the current color */