vgl.h revision 53052
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: head/lib/libvgl/vgl.h 53052 1999-11-09 12:11:24Z yokota $ 29 */ 30 31#include <stdlib.h> 32#include <unistd.h> 33#include <string.h> 34#include <machine/cpufunc.h> 35 36typedef unsigned char byte; 37typedef struct { 38 byte Type; 39 int Xsize, Ysize; 40 int VXsize, VYsize; 41 int Xorigin, Yorigin; 42 byte *Bitmap; 43} VGLBitmap; 44 45#define VGLBITMAP_INITIALIZER(t, x, y, bits) \ 46 { (t), (x), (y), (x), (y), 0, 0, (bits) } 47 48/* 49 * Defined Type's 50 */ 51#define MEMBUF 0 52#define VIDBUF4 1 53#define VIDBUF8 2 54#define VIDBUF8X 3 55#define VIDBUF8S 4 56#define VIDBUF4S 5 57#define NOBUF 255 58 59typedef struct VGLText { 60 byte Width, Height; 61 byte *BitmapArray; 62} VGLText; 63 64typedef struct VGLObject { 65 int Id; 66 int Type; 67 int Status; 68 int Xpos, Ypos; 69 int Xhot, Yhot; 70 VGLBitmap *Image; 71 VGLBitmap *Mask; 72 int (*CallBackFunction)(); 73} VGLObject; 74 75#define MOUSE_IMG_SIZE 16 76#define VGL_MOUSEHIDE 0 77#define VGL_MOUSESHOW 1 78#define VGL_MOUSEFREEZE 0 79#define VGL_MOUSEUNFREEZE 1 80#define VGL_DIR_RIGHT 0 81#define VGL_DIR_UP 1 82#define VGL_DIR_LEFT 2 83#define VGL_DIR_DOWN 3 84#define VGL_RAWKEYS 1 85#define VGL_CODEKEYS 2 86#define VGL_XLATEKEYS 3 87 88extern video_adapter_info_t VGLAdpInfo; 89extern video_info_t VGLModeInfo; 90extern VGLBitmap *VGLDisplay; 91extern byte *VGLBuf; 92 93/* 94 * Prototypes 95 */ 96/* bitmap.c */ 97int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 98int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 99VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits); 100void VGLBitmapDestroy(VGLBitmap *object); 101int VGLBitmapAllocateBits(VGLBitmap *object); 102/* keyboard.c */ 103int VGLKeyboardInit(int mode); 104void VGLKeyboardEnd(void); 105int VGLKeyboardGetCh(void); 106/* main.c */ 107void VGLEnd(void); 108int VGLInit(int mode); 109void VGLCheckSwitch(void); 110int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize); 111int VGLPanScreen(VGLBitmap *object, int x, int y); 112int VGLSetSegment(unsigned int offset); 113/* mouse.c */ 114void VGLMousePointerShow(void); 115void VGLMousePointerHide(void); 116void VGLMouseMode(int mode); 117void VGLMouseAction(int dummy); 118void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask); 119void VGLMouseSetStdImage(void); 120int VGLMouseInit(int mode); 121int VGLMouseStatus(int *x, int *y, char *buttons); 122int VGLMouseFreeze(int x, int y, int width, int hight, byte color); 123void VGLMouseUnFreeze(void); 124/* simple.c */ 125void VGLSetXY(VGLBitmap *object, int x, int y, byte color); 126byte VGLGetXY(VGLBitmap *object, int x, int y); 127void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 128void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 129void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 130void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color); 131void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color); 132void VGLClear(VGLBitmap *object, byte color); 133void VGLRestorePalette(void); 134void VGLSavePalette(void); 135void VGLSetPalette(byte *red, byte *green, byte *blue); 136void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue); 137void VGLSetBorder(byte color); 138void VGLBlankDisplay(int blank); 139/* text.c */ 140int VGLTextSetFontFile(char *filename); 141void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir); 142void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir); 143