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 /*****************************************************************************/
56 void __fastcall__ tgi_load (unsigned char mode);
57 /* Install the matching driver for the given mode. Will just load the driver
58 * and check if loading was successul. Will not switch to gaphics mode.
61 void __fastcall__ tgi_load_driver (const char* name);
62 /* Install the given driver. This function is identical to tgi_load with the
63 * only difference that the name of the driver is specified explicitly. You
64 * should NOT use this function in most cases, use tgi_load() instead.
67 void __fastcall__ tgi_unload (void);
68 /* Unload the currently loaded driver. Will call tgi_done if necessary. */
70 void __fastcall__ tgi_init (unsigned char mode);
71 /* Initialize the given graphics mode. */
73 void __fastcall__ tgi_done (void);
74 /* End graphics mode, switch back to text mode. Will NOT unload the driver! */
76 unsigned char __fastcall__ tgi_geterror (void);
77 /* Return the error code for the last operation. This will also clear the
81 void __fastcall__ tgi_clear (void);
82 /* Clear the screen. */
84 void __fastcall__ tgi_getpagecount (void);
85 /* Returns the number of screen pages available. */
87 void __fastcall__ tgi_setviewpage (unsigned char page);
88 /* Set the visible page. Will set an error if the page is not available. */
90 void __fastcall__ tgi_setdrawpage (unsigned char page);
91 /* Set the drawable page. Will set an error if the page is not available. */
93 unsigned char __fastcall__ tgi_getcolorcount (void);
94 /* Get the number of available colors. */
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 void __fastcall__ tgi_setcolor (unsigned char color);
102 /* Set the current drawing color. */
104 unsigned char __fastcall__ tgi_getcolor (void);
105 /* Return the current drawing color. */
107 void __fastcall__ tgi_setpalette (const unsigned char* palette);
108 /* Set the palette (not available with all drivers/hardware). palette is
109 * a pointer to as many entries as there are colors.
112 const unsigned char* __fastcall__ tgi_getpalette (void);
113 /* Return the current palette. Will return NULL for drivers that do not
117 const unsigned char* __fastcall__ tgi_getdefpalette (void);
118 /* Return the default palette. Will return NULL for drivers that do not
122 unsigned __fastcall__ tgi_getxres (void);
123 /* Return the resolution in X direction. */
125 unsigned __fastcall__ tgi_getmaxx (void);
126 /* Return the maximum x coordinate. The resolution in x direction is
130 unsigned __fastcall__ tgi_getyres (void);
131 /* Return the resolution in Y direction. */
133 unsigned __fastcall__ tgi_getmaxy (void);
134 /* Return the maximum y coordinate. The resolution in y direction is
138 unsigned char __fastcall__ tgi_getpixel (int x, int y);
139 /* Get the color value of a pixel. */
141 void __fastcall__ tgi_setpixel (int x, int y);
142 /* Plot a pixel in the current drawing color. */
144 void __fastcall__ tgi_gotoxy (int x, int y);
145 /* Set the graphics cursor to the given position. */
147 void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
148 /* Draw a line in the current drawing color. The graphics cursor will
149 * be set to x2/y2 by this call.
152 void __fastcall__ tgi_lineto (int x2, int y2);
153 /* Draw a line in the current drawing color from the graphics cursor to the
154 * new end point. The graphics cursor will be updated to x2/y2.
157 void __fastcall__ tgi_circle (int x, int y, unsigned char radius);
158 /* Draw a circle in the current drawing color. */
160 void __fastcall__ tgi_outtext (int x, int y, const char* text);
161 /* Print a text in graphics mode */
163 void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
164 /* Draw a bar (a filled rectangle) using the current color. */