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