Bring ifnet(9) a bit closer to reality.
[dragonfly.git] / lib / libvgl / vgl.h
blobde5d8a3aa596a7460fb10bb6b8194a9a8beaa7dd
1 /*-
2 * Copyright (c) 1991-1997 Søren Schmidt
3 * All rights reserved.
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
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.
28 * $FreeBSD: src/lib/libvgl/vgl.h,v 1.5.2.1 2001/06/19 06:49:15 sobomax Exp $
29 * $DragonFly: src/lib/libvgl/vgl.h,v 1.2 2003/06/17 04:26:52 dillon Exp $
32 #ifndef _VGL_H_
33 #define _VGL_H_
35 #include <stdlib.h>
36 #include <unistd.h>
37 #include <string.h>
38 #include <machine/cpufunc.h>
40 typedef unsigned char byte;
41 typedef struct {
42 byte Type;
43 int Xsize, Ysize;
44 int VXsize, VYsize;
45 int Xorigin, Yorigin;
46 byte *Bitmap;
47 } VGLBitmap;
49 #define VGLBITMAP_INITIALIZER(t, x, y, bits) \
50 { (t), (x), (y), (x), (y), 0, 0, (bits) }
53 * Defined Type's
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 NOBUF 255
63 typedef struct VGLText {
64 byte Width, Height;
65 byte *BitmapArray;
66 } VGLText;
68 typedef struct VGLObject {
69 int Id;
70 int Type;
71 int Status;
72 int Xpos, Ypos;
73 int Xhot, Yhot;
74 VGLBitmap *Image;
75 VGLBitmap *Mask;
76 int (*CallBackFunction)();
77 } VGLObject;
79 #define MOUSE_IMG_SIZE 16
80 #define VGL_MOUSEHIDE 0
81 #define VGL_MOUSESHOW 1
82 #define VGL_MOUSEFREEZE 0
83 #define VGL_MOUSEUNFREEZE 1
84 #define VGL_DIR_RIGHT 0
85 #define VGL_DIR_UP 1
86 #define VGL_DIR_LEFT 2
87 #define VGL_DIR_DOWN 3
88 #define VGL_RAWKEYS 1
89 #define VGL_CODEKEYS 2
90 #define VGL_XLATEKEYS 3
92 extern video_adapter_info_t VGLAdpInfo;
93 extern video_info_t VGLModeInfo;
94 extern VGLBitmap *VGLDisplay;
95 extern byte *VGLBuf;
98 * Prototypes
100 /* bitmap.c */
101 int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
102 int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
103 VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits);
104 void VGLBitmapDestroy(VGLBitmap *object);
105 int VGLBitmapAllocateBits(VGLBitmap *object);
106 /* keyboard.c */
107 int VGLKeyboardInit(int mode);
108 void VGLKeyboardEnd(void);
109 int VGLKeyboardGetCh(void);
110 /* main.c */
111 void VGLEnd(void);
112 int VGLInit(int mode);
113 void VGLCheckSwitch(void);
114 int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize);
115 int VGLPanScreen(VGLBitmap *object, int x, int y);
116 int VGLSetSegment(unsigned int offset);
117 /* mouse.c */
118 void VGLMousePointerShow(void);
119 void VGLMousePointerHide(void);
120 void VGLMouseMode(int mode);
121 void VGLMouseAction(int dummy);
122 void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
123 void VGLMouseSetStdImage(void);
124 int VGLMouseInit(int mode);
125 int VGLMouseStatus(int *x, int *y, char *buttons);
126 int VGLMouseFreeze(int x, int y, int width, int hight, byte color);
127 void VGLMouseUnFreeze(void);
128 /* simple.c */
129 void VGLSetXY(VGLBitmap *object, int x, int y, byte color);
130 byte VGLGetXY(VGLBitmap *object, int x, int y);
131 void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
132 void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
133 void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
134 void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
135 void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
136 void VGLClear(VGLBitmap *object, byte color);
137 void VGLRestorePalette(void);
138 void VGLSavePalette(void);
139 void VGLSetPalette(byte *red, byte *green, byte *blue);
140 void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
141 void VGLSetBorder(byte color);
142 void VGLBlankDisplay(int blank);
143 /* text.c */
144 int VGLTextSetFontFile(char *filename);
145 void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir);
146 void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir);
148 #endif /* !_VGL_H_ */