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 void __fastcall__ tgi_setviewpage (unsigned char page);
99 /* Set the visible page. */
101 void __fastcall__ tgi_setdrawpage (unsigned char page);
102 /* Set the drawable page */
104 unsigned char __fastcall__ tgi_getmaxcolor (void);
105 /* Return the maximum supported color number (the number of colors would
106 * then be getmaxcolor()+1).
109 unsigned __fastcall__ tgi_getmaxx (void);
110 /* Return the maximum x coordinate. The resolution in x direction is
114 unsigned __fastcall__ tgi_getmaxy (void);
115 /* Return the maximum y coordinate. The resolution in y direction is
119 unsigned char __fastcall__ tgi_getcolorcount (void);
120 /* Get the number of available colors */
122 unsigned __fastcall__ tgi_getxres (void);
123 /* Return the resolution in X direction */
125 unsigned __fastcall__ tgi_getyres (void);
126 /* Return the resolution in Y direction */
128 void __fastcall__ tgi_setcolor (unsigned char color);
129 /* Set the current drawing color */
131 unsigned char __fastcall__ tgi_getcolor (void);
132 /* Return the current drawing color */
134 unsigned char __fastcall__ tgi_getpixel (int x, int y);
135 /* Get the color value of a pixel */
137 void __fastcall__ tgi_setpixel (int x, int y);
138 /* Plot a point in the current drawing color */
140 void __fastcall__ tgi_gotoxy (int x, int y);
141 /* Set the graphics cursor to the given position. */
143 void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
144 /* Draw a line in the current drawing color. The graphics cursor will
145 * be set to x2/y2 by this call.
148 void __fastcall__ tgi_lineto (int x2, int y2);
149 /* Draw a line in the current drawing color from the graphics cursor to the
150 * new end point. The graphics cursor will be updated to x2/y2.
153 void __fastcall__ tgi_circle (int x, int y, unsigned char radius);
154 /* Draw a circle in the current drawing color. */
156 void __fastcall__ tgi_outtext (int x, int y, const char* text);
157 /* Print a text in graphics mode */
159 void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
160 /* Draw a bar (a filled rectangle) using the current color. */