1.\" Copyright (c) 1997 S�ren Schmidt 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer, 9.\" in this position and unchanged. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 3. The name of the author may not be used to endorse or promote products 14.\" derived from this software withough specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" 27.\" $Id: vgl.3,v 1.2 1997/08/15 12:35:02 sos Exp $ 28 29.Dd August 13, 1997 30.Dt VGL 3 31.Os FreeBSD 3 32.Sh NAME 33.Nm vgl 34.Nd Video Graphics Library functions 35.Sh SYNOPSIS 36.Fd #include <vgl.h> 37 38.Sh DESCRIPTION 39Libvgl is a library that enables the programmer access to the graphics 40modes supported by the console driver (syscons). The library takes care of 41programming the actual video hardware, and provides a number of simple 42functions to do various graphic operations. There is also support for a 43mouse via the standard mouse system in FreeBSD, see 44.Fn moused 45, including the ability to transparantly have a mousepointer superimposed on 46the graphic image currently being worked on. 47The library takes care of screenswitching by storing the current image in 48memory before swithing to another virtual console, and restoring when the 49user switches back. This allows several graphic applications at once, but 50on different virtual consoles. 51 52Below is a short description of the various functions: 53 54.Sh AUTHOR 55.An S�ren Schmidt (sos@FreeBSD.org) 56 57.Sh FUNCTIONS 58 59.Ft int 60.Fn VGLInit "int mode" 61 62Initialize the library and set up the graphic mode 63.Em mode 64 65 66.Ft void 67.Fn VGLEnd "void" 68 69Terminate graphic mode, and restore the screenmode that was active before 70.Fn VGLInit 71was called. 72 73 74.Ft void 75.Fn VGLCheckSwitch "void" 76 77If the program goes into longer periods of processing without doing 78any graphics output, calling this function occasionally will allow 79the system to switch screens. 80 81 82.Ft int 83.Fn VGLTextSetFontFile "char *filename" 84 85Instruct the char/string functions to use the font in file 86.Em filename 87instead of the buildin font. 88 89 90.Ft int 91.Fn VGLMouseInit "int mode" 92 93Initialize the mouse. The optional onscreen mousepointer is shown if the 94argument is 95.Em VGL_SHOWMOUSE 96 97 98.Ft void 99.Fn VGLMouseMode "int mode" 100 101Either shows the mousepointer if the argument is 102.Em VGL_SHOWMOUSE 103, or hide the mousepointer if the argument is 104.Em VGL_HIDEMOUSE 105 106 107.Ft int 108.Fn VGLMouseStatus "int *x" "int *y" "char *buttons" 109 110Returns the current mousepointer coordiantes and button state in 111.Em x, y, buttons. The return value reflects if the mousepointer 112is currently shown on screen or not. 113 114 115.Ft void 116.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask" 117 118With this function it is possible to change the image of the mousepointer 119on screen. 120 121 122.Ft void 123.Fn VGLMouseSetStdImage "void" 124 125This function restores the mousepointer to the standard arrow. 126 127 128.Ft void 129.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 130 131Draw a line from 132.Em x1, y1 133to 134.Em x2, y2 135in color 136.Em color 137 138 139.Ft void 140.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 141 142Draw a box with upper left hand corner at 143.Em x1, y1 144and lower right hand corner at 145.Em x2, y2 146in color 147.Em color 148 149 150.Ft void 151.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 152 153Draw a filled (solid) box with upper left hand corner at 154.Em x1, y1 155and lower right hand corner at 156.Em x2, y2 157in color 158.Em color 159 160 161.Ft void 162.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color" 163 164Draw an ellipse centered at 165.Em xc, yc 166make it 167.Em a 168pixels wide, and 169.Em b 170pixels high in color 171.Em color 172 173 174.Ft void 175.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color" 176 177Draw a filled (solid) ellipse centered at 178.Em xc, yc 179make it 180.Em a 181pixels wide, and 182.Em b 183pixels high in color 184.Em color 185 186 187.Ft int 188.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight" 189 190Copy a rectangle of pixels from bitmap 191.Em src 192upper lefthand corner at 193.Em srcx, srcy 194to bitmap 195.Em dst 196at 197.Em dstx, dsty 198of the size 199.Em width, hight 200 201 202.Ft void 203.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir" 204 205Write the character 206.Em ch 207at position 208.Em x, y 209in foregroundcolor 210.Em fgcol. 211If 212.Em fill 213is != 0, use the color 214.Em bgcol 215as background otherwise the background is transparant. 216The character is drawn in the direction specified by the argument 217.Em dir 218 219 220.Ft void 221.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir" 222 223Write the string 224.Em str 225at position 226.Em x, y 227in foregroundcolor 228.Em fgcol. 229If 230.Em fill 231is != 0, use the color 232.Em bgcol 233as background otherwise the background is transparant. 234The string is drawn in the direction specified by the argument 235.Em dir 236 237.Ft void 238.Fn VGLClear "VGLBitmap *object" "byte color" 239 240Clears the entire bitmap to color 241.Em color 242 243 244.Ft void 245.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue" 246 247This function sets the palette used, the arguments 248.Em red, green, blue 249should point to byte arrays of 256 positions each. 250 251 252.Ft void 253.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue" 254 255Set the palette index 256.Em color 257to the specified RGB value. 258 259 260.Ft void 261.Fn VGLSetBorder "byte color" 262 263Set the bordercolor to color 264.Em color 265 266 267.Ft void 268.Fn VGLBlankDisplay "int blank" 269 270Blank the display if the argment 271.Em blank 272!= 0. This can be done to shut off the screen during diplay updates that 273the use hould first see when its done. 274 275 276.Sh HISTORY 277The 278.Nm 279library appeared in FreeBSD 3.0 280