Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libvgl / vgl.h
1 /*-
2  * Copyright (c) 1991-1997 Søren Schmidt
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer
10  *    in this position and unchanged.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software withough specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/lib/libvgl/vgl.h,v 1.5.2.1 2001/06/19 06:49:15 sobomax Exp $
29  */
30
31 #ifndef _VGL_H_
32 #define _VGL_H_
33
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <string.h>
37 #include <machine/cpufunc.h>
38
39 typedef unsigned char byte;
40 typedef struct {
41   byte  Type;
42   int   Xsize, Ysize;
43   int   VXsize, VYsize;
44   int   Xorigin, Yorigin;
45   byte  *Bitmap;
46 } VGLBitmap;
47
48 #define VGLBITMAP_INITIALIZER(t, x, y, bits)    \
49         { (t), (x), (y), (x), (y), 0, 0, (bits) }
50
51 /*
52  * Defined Type's
53  */
54 #define MEMBUF          0
55 #define VIDBUF4         1
56 #define VIDBUF8         2
57 #define VIDBUF8X        3
58 #define VIDBUF8S        4
59 #define VIDBUF4S        5
60 #define NOBUF           255
61
62 typedef struct VGLText {
63   byte  Width, Height;
64   byte  *BitmapArray;
65 } VGLText;
66
67 typedef struct VGLObject {
68   int           Id;
69   int           Type;
70   int           Status;
71   int           Xpos, Ypos;
72   int           Xhot, Yhot;
73   VGLBitmap     *Image;
74   VGLBitmap     *Mask;
75   int           (*CallBackFunction)();
76 } VGLObject;
77
78 #define MOUSE_IMG_SIZE          16
79 #define VGL_MOUSEHIDE           0
80 #define VGL_MOUSESHOW           1
81 #define VGL_MOUSEFREEZE         0
82 #define VGL_MOUSEUNFREEZE       1
83 #define VGL_DIR_RIGHT           0
84 #define VGL_DIR_UP              1
85 #define VGL_DIR_LEFT            2
86 #define VGL_DIR_DOWN            3
87 #define VGL_RAWKEYS             1
88 #define VGL_CODEKEYS            2
89 #define VGL_XLATEKEYS           3
90
91 extern video_adapter_info_t     VGLAdpInfo;
92 extern video_info_t             VGLModeInfo;
93 extern VGLBitmap                *VGLDisplay;
94 extern byte                     *VGLBuf;
95
96 /*
97  * Prototypes
98  */
99 /* bitmap.c */
100 int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
101 int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
102 VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits);
103 void VGLBitmapDestroy(VGLBitmap *object);
104 int VGLBitmapAllocateBits(VGLBitmap *object);
105 /* keyboard.c */
106 int VGLKeyboardInit(int mode);
107 void VGLKeyboardEnd(void);
108 int VGLKeyboardGetCh(void);
109 /* main.c */
110 void VGLEnd(void);
111 int VGLInit(int mode);
112 void VGLCheckSwitch(void);
113 int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize);
114 int VGLPanScreen(VGLBitmap *object, int x, int y);
115 int VGLSetSegment(unsigned int offset);
116 /* mouse.c */
117 void VGLMousePointerShow(void);
118 void VGLMousePointerHide(void);
119 void VGLMouseMode(int mode);
120 void VGLMouseAction(int dummy);
121 void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
122 void VGLMouseSetStdImage(void);
123 int VGLMouseInit(int mode);
124 int VGLMouseStatus(int *x, int *y, char *buttons);
125 int VGLMouseFreeze(int x, int y, int width, int hight, byte color);
126 void VGLMouseUnFreeze(void);
127 /* simple.c */
128 void VGLSetXY(VGLBitmap *object, int x, int y, byte color);
129 byte VGLGetXY(VGLBitmap *object, int x, int y);
130 void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
131 void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
132 void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
133 void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
134 void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
135 void VGLClear(VGLBitmap *object, byte color);
136 void VGLRestorePalette(void);
137 void VGLSavePalette(void);
138 void VGLSetPalette(byte *red, byte *green, byte *blue);
139 void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
140 void VGLSetBorder(byte color);
141 void VGLBlankDisplay(int blank);
142 /* text.c */
143 int VGLTextSetFontFile(char *filename);
144 void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir);
145 void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir);
146
147 #endif /* !_VGL_H_ */