19a57b7d2SSøren Schmidt /*- 25e53a4f9SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 35e53a4f9SPedro F. Giffuni * 4bf3f9db6SUlrich Spörlein * Copyright (c) 1991-1997 Søren Schmidt 59a57b7d2SSøren Schmidt * All rights reserved. 69a57b7d2SSøren Schmidt * 79a57b7d2SSøren Schmidt * Redistribution and use in source and binary forms, with or without 89a57b7d2SSøren Schmidt * modification, are permitted provided that the following conditions 99a57b7d2SSøren Schmidt * are met: 109a57b7d2SSøren Schmidt * 1. Redistributions of source code must retain the above copyright 119a57b7d2SSøren Schmidt * notice, this list of conditions and the following disclaimer 129a57b7d2SSøren Schmidt * in this position and unchanged. 139a57b7d2SSøren Schmidt * 2. Redistributions in binary form must reproduce the above copyright 149a57b7d2SSøren Schmidt * notice, this list of conditions and the following disclaimer in the 159a57b7d2SSøren Schmidt * documentation and/or other materials provided with the distribution. 169a57b7d2SSøren Schmidt * 3. The name of the author may not be used to endorse or promote products 1721dc7d4fSJens Schweikhardt * derived from this software without specific prior written permission 189a57b7d2SSøren Schmidt * 199a57b7d2SSøren Schmidt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 209a57b7d2SSøren Schmidt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 219a57b7d2SSøren Schmidt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 229a57b7d2SSøren Schmidt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 239a57b7d2SSøren Schmidt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 249a57b7d2SSøren Schmidt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 259a57b7d2SSøren Schmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 269a57b7d2SSøren Schmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 279a57b7d2SSøren Schmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 289a57b7d2SSøren Schmidt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 299a57b7d2SSøren Schmidt * 307f3dea24SPeter Wemm * $FreeBSD$ 319a57b7d2SSøren Schmidt */ 329a57b7d2SSøren Schmidt 330e2fa3bbSMaxim Sobolev #ifndef _VGL_H_ 340e2fa3bbSMaxim Sobolev #define _VGL_H_ 350e2fa3bbSMaxim Sobolev 369a57b7d2SSøren Schmidt #include <stdlib.h> 379a57b7d2SSøren Schmidt #include <unistd.h> 389a57b7d2SSøren Schmidt #include <string.h> 399a57b7d2SSøren Schmidt #include <machine/cpufunc.h> 409a57b7d2SSøren Schmidt 419a57b7d2SSøren Schmidt typedef unsigned char byte; 429a57b7d2SSøren Schmidt typedef struct { 439a57b7d2SSøren Schmidt byte Type; 449a57b7d2SSøren Schmidt int Xsize, Ysize; 455acf51eaSKazutaka YOKOTA int VXsize, VYsize; 465acf51eaSKazutaka YOKOTA int Xorigin, Yorigin; 479a57b7d2SSøren Schmidt byte *Bitmap; 48933d455fSNicolas Souchu int PixelBytes; 499a57b7d2SSøren Schmidt } VGLBitmap; 509a57b7d2SSøren Schmidt 515acf51eaSKazutaka YOKOTA #define VGLBITMAP_INITIALIZER(t, x, y, bits) \ 52fbc6daa1SBruce Evans { (t), (x), (y), (x), (y), 0, 0, (bits), -1 } 535acf51eaSKazutaka YOKOTA 549a57b7d2SSøren Schmidt /* 559a57b7d2SSøren Schmidt * Defined Type's 569a57b7d2SSøren Schmidt */ 579a57b7d2SSøren Schmidt #define MEMBUF 0 589a57b7d2SSøren Schmidt #define VIDBUF4 1 599a57b7d2SSøren Schmidt #define VIDBUF8 2 609a57b7d2SSøren Schmidt #define VIDBUF8X 3 615acf51eaSKazutaka YOKOTA #define VIDBUF8S 4 625acf51eaSKazutaka YOKOTA #define VIDBUF4S 5 63933d455fSNicolas Souchu #define VIDBUF16 6 /* Direct Color linear buffer */ 64933d455fSNicolas Souchu #define VIDBUF24 7 /* Direct Color linear buffer */ 65933d455fSNicolas Souchu #define VIDBUF32 8 /* Direct Color linear buffer */ 66933d455fSNicolas Souchu #define VIDBUF16S 9 /* Direct Color segmented buffer */ 67933d455fSNicolas Souchu #define VIDBUF24S 10 /* Direct Color segmented buffer */ 68933d455fSNicolas Souchu #define VIDBUF32S 11 /* Direct Color segmented buffer */ 699a57b7d2SSøren Schmidt #define NOBUF 255 709a57b7d2SSøren Schmidt 719a57b7d2SSøren Schmidt typedef struct VGLText { 729a57b7d2SSøren Schmidt byte Width, Height; 739a57b7d2SSøren Schmidt byte *BitmapArray; 749a57b7d2SSøren Schmidt } VGLText; 759a57b7d2SSøren Schmidt 769a57b7d2SSøren Schmidt typedef struct VGLObject { 779a57b7d2SSøren Schmidt int Id; 789a57b7d2SSøren Schmidt int Type; 799a57b7d2SSøren Schmidt int Status; 809a57b7d2SSøren Schmidt int Xpos, Ypos; 819a57b7d2SSøren Schmidt int Xhot, Yhot; 829a57b7d2SSøren Schmidt VGLBitmap *Image; 839a57b7d2SSøren Schmidt VGLBitmap *Mask; 849a57b7d2SSøren Schmidt int (*CallBackFunction)(); 859a57b7d2SSøren Schmidt } VGLObject; 869a57b7d2SSøren Schmidt 879a57b7d2SSøren Schmidt #define MOUSE_IMG_SIZE 16 889a57b7d2SSøren Schmidt #define VGL_MOUSEHIDE 0 899a57b7d2SSøren Schmidt #define VGL_MOUSESHOW 1 909a57b7d2SSøren Schmidt #define VGL_MOUSEFREEZE 0 919a57b7d2SSøren Schmidt #define VGL_MOUSEUNFREEZE 1 929a57b7d2SSøren Schmidt #define VGL_DIR_RIGHT 0 939a57b7d2SSøren Schmidt #define VGL_DIR_UP 1 949a57b7d2SSøren Schmidt #define VGL_DIR_LEFT 2 959a57b7d2SSøren Schmidt #define VGL_DIR_DOWN 3 96b478da36SSøren Schmidt #define VGL_RAWKEYS 1 97b478da36SSøren Schmidt #define VGL_CODEKEYS 2 98b478da36SSøren Schmidt #define VGL_XLATEKEYS 3 999a57b7d2SSøren Schmidt 1005acf51eaSKazutaka YOKOTA extern video_adapter_info_t VGLAdpInfo; 1015acf51eaSKazutaka YOKOTA extern video_info_t VGLModeInfo; 1029a57b7d2SSøren Schmidt extern VGLBitmap *VGLDisplay; 1035acf51eaSKazutaka YOKOTA extern byte *VGLBuf; 1049a57b7d2SSøren Schmidt 1059a57b7d2SSøren Schmidt /* 1069a57b7d2SSøren Schmidt * Prototypes 1079a57b7d2SSøren Schmidt */ 1089a57b7d2SSøren Schmidt /* bitmap.c */ 1099a57b7d2SSøren Schmidt int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 1109a57b7d2SSøren Schmidt int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 1115acf51eaSKazutaka YOKOTA VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits); 1125acf51eaSKazutaka YOKOTA void VGLBitmapDestroy(VGLBitmap *object); 1135acf51eaSKazutaka YOKOTA int VGLBitmapAllocateBits(VGLBitmap *object); 114b478da36SSøren Schmidt /* keyboard.c */ 115b478da36SSøren Schmidt int VGLKeyboardInit(int mode); 116b478da36SSøren Schmidt void VGLKeyboardEnd(void); 117b478da36SSøren Schmidt int VGLKeyboardGetCh(void); 1189a57b7d2SSøren Schmidt /* main.c */ 1199a57b7d2SSøren Schmidt void VGLEnd(void); 1209a57b7d2SSøren Schmidt int VGLInit(int mode); 1219a57b7d2SSøren Schmidt void VGLCheckSwitch(void); 1225acf51eaSKazutaka YOKOTA int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize); 1235acf51eaSKazutaka YOKOTA int VGLPanScreen(VGLBitmap *object, int x, int y); 1245acf51eaSKazutaka YOKOTA int VGLSetSegment(unsigned int offset); 1259a57b7d2SSøren Schmidt /* mouse.c */ 1269a57b7d2SSøren Schmidt void VGLMousePointerShow(void); 1279a57b7d2SSøren Schmidt void VGLMousePointerHide(void); 1289a57b7d2SSøren Schmidt void VGLMouseMode(int mode); 1299a57b7d2SSøren Schmidt void VGLMouseAction(int dummy); 1309a57b7d2SSøren Schmidt void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask); 1319a57b7d2SSøren Schmidt void VGLMouseSetStdImage(void); 1329a57b7d2SSøren Schmidt int VGLMouseInit(int mode); 133*e848f3d1SBruce Evans void VGLMouseRestore(void); 1349a57b7d2SSøren Schmidt int VGLMouseStatus(int *x, int *y, char *buttons); 135dd31deb8SBruce Evans int VGLMouseFreeze(int x, int y, int width, int hight, u_long color); 1369a57b7d2SSøren Schmidt void VGLMouseUnFreeze(void); 1379a57b7d2SSøren Schmidt /* simple.c */ 138933d455fSNicolas Souchu void VGLSetXY(VGLBitmap *object, int x, int y, u_long color); 139933d455fSNicolas Souchu u_long VGLGetXY(VGLBitmap *object, int x, int y); 140933d455fSNicolas Souchu void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); 141933d455fSNicolas Souchu void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); 142933d455fSNicolas Souchu void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); 143933d455fSNicolas Souchu void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); 144933d455fSNicolas Souchu void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); 145933d455fSNicolas Souchu void VGLClear(VGLBitmap *object, u_long color); 146*e848f3d1SBruce Evans void VGLRestoreBlank(void); 147*e848f3d1SBruce Evans void VGLRestoreBorder(void); 1489a57b7d2SSøren Schmidt void VGLRestorePalette(void); 1499a57b7d2SSøren Schmidt void VGLSavePalette(void); 1509a57b7d2SSøren Schmidt void VGLSetPalette(byte *red, byte *green, byte *blue); 1519a57b7d2SSøren Schmidt void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue); 15231d09534SBruce Evans void VGLSetBorder(byte color); 1539a57b7d2SSøren Schmidt void VGLBlankDisplay(int blank); 1549a57b7d2SSøren Schmidt /* text.c */ 1559a57b7d2SSøren Schmidt int VGLTextSetFontFile(char *filename); 156dd31deb8SBruce Evans void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, u_long fgcol, u_long bgcol, int fill, int dir); 157dd31deb8SBruce Evans void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, u_long fgcol, u_long bgcol, int fill, int dir); 1580e2fa3bbSMaxim Sobolev 1590e2fa3bbSMaxim Sobolev #endif /* !_VGL_H_ */ 160