1 .\" Copyright (c) 1997 Søren Schmidt
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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 without specific prior written permission.
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.
27 .\" $FreeBSD: src/lib/libvgl/vgl.3,v 1.12.2.8 2001/12/17 10:08:35 ru Exp $
32 .Nm VGLBitmapAllocateBits ,
35 .Nm VGLBitmapDestroy ,
36 .Nm VGLBitmapPutChar ,
45 .Nm VGLFilledEllipse ,
51 .Nm VGLKeyboardGetCh ,
54 .Nm VGLMouseSetImage ,
55 .Nm VGLMouseSetStdImage ,
60 .Nm VGLSetPaletteIndex ,
61 .Nm VGLSetVScreenSize ,
63 .Nm VGLTextSetFontFile
64 .Nd Video Graphics Library functions
71 .Fn VGLInit "int mode"
75 .Fn VGLCheckSwitch "void"
77 .Fn VGLTextSetFontFile "char *filename"
79 .Fn VGLKeyboardInit "int code"
81 .Fn VGLKeyboardEnd "void"
83 .Fn VGLKeyboardGetCh "void"
85 .Fn VGLMouseInit "int mode"
87 .Fn VGLMouseMode "int mode"
89 .Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
91 .Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
93 .Fn VGLMouseSetStdImage "void"
95 .Fn VGLGetXY "VGLBitmap *object" "int x" "int y"
97 .Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "byte color"
99 .Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
101 .Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
103 .Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
105 .Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
107 .Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
109 .Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits"
111 .Fn VGLBitmapDestroy "VGLBitmap *object"
113 .Fn VGLBitmapAllocateBits "VGLBitmap *object"
115 .Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
117 .Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
119 .Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
121 .Fn VGLClear "VGLBitmap *object" "byte color"
123 .Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
125 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
127 .Fn VGLSetBorder "byte color"
129 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
131 .Fn VGLPanScreen "VGLBitmap *object" "int x" "int y"
133 .Fn VGLBlankDisplay "int blank"
136 is a library that enables the programmer access to the graphics
137 modes supported by the console driver
139 The library takes care of
140 programming the actual video hardware, and provides a number of simple
141 functions to do various graphic operations.
142 There is also support for a
143 mouse via the standard mouse system in
147 including the ability to transparently have a mouse pointer superimposed on
148 the graphic image currently being worked on.
149 The library takes care of screen switching by storing the current image in
150 memory before switching to another virtual console, and restoring when the
152 This allows several graphic applications at once, but
153 on different virtual consoles.
155 Below is a short description of the various functions:
158 initialize the library and set up the graphic mode
162 terminate graphic mode, and restore the screenmode that was active before
167 if the program goes into longer periods of processing without doing
168 any graphics output, calling this function occasionally will allow
169 the system to switch screens.
171 .Fn VGLTextSetFontFile
172 instruct the char/string functions to use the font in file
174 instead of the builtin font.
177 set up the keyboard in the
180 specify the key code to be used.
189 is specified, the keyboard translate the raw keyboard scan code into
193 is used, the raw keyboard scan code is read as is.
195 is the intermediate key code; each key is assigned a unique code whereas
196 more than one raw scan code may be generated when a key is pressed.
199 when you have finished using the keyboard, call this function.
202 read one byte from the keyboard. As the keyboard I/O is in the
204 input mode, the function will not block even if there is no input data,
208 initialize the mouse.
209 The optional on-screen mouse pointer is shown if the
214 either shows the mouse pointer if the argument is
216 or hides the mouse pointer if the argument is
220 returns the current mouse pointer coordinates and button state in
223 The return value reflects if the mouse pointer
224 is currently shown on screen or not.
227 with this function it is possible to change the image of the mouse pointer
230 .Fn VGLMouseSetStdImage
231 this function restores the mouse pointer to the standard arrow.
234 retrieves the color of the pixel located at
238 argument, and returns it as a byte value.
241 sets the color of the pixel located at
258 draw a box with upper left hand corner at
260 and lower right hand corner at
266 draw a filled (solid) box with upper left hand corner at
268 and lower right hand corner at
274 draw an ellipse centered at
284 draw a filled (solid) ellipse centered at
294 create a bitmap object and initialize it with the specified
299 for the in-memory bitmap.
301 may be NULL so that bitmap data may be associated later.
303 There also is a macro,
304 .Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits"
305 to initialize a statically declared bitmap object.
308 free the bitmap data and the bitmap object.
310 .Fn VGLBitmapAllocateBits
311 allocate a bit data buffer for the specified object.
314 copy a rectangle of pixels from bitmap
316 upper left hand corner at
334 is != 0, use the color
336 as background otherwise the background is transparent.
337 The character is drawn in the direction specified by the argument
349 is != 0, use the color
351 as background otherwise the background is transparent.
352 The string is drawn in the direction specified by the argument
356 clears the entire bitmap to color
360 this function sets the palette used, the arguments
361 .Va red , green , blue
362 should point to byte arrays of 256 positions each.
364 .Fn VGLSetPaletteIndex
365 set the palette index
367 to the specified RGB value.
370 set the border color to color
373 .Fn VGLSetVScreenSize
374 change the virtual screen size of the display. Note that this
375 function must be called when our vty is in the foreground.
380 Passing an in-memory bitmap to this function results in error.
382 The desired virtual screen width may not be achievable because
383 of the video card hardware. In such case the video driver (and
384 underlaying video BIOS) may choose the next largest values.
389 after calling this function, in order to see how the virtual screen
392 In order to set up the largest possible virtual screen, you may
393 call this function with arbitrary large values.
395 .Dl VGLSetVScreenSize(10000, 10000);
398 change the origin of the displayed screen in the virtual screen.
399 Note that this function must be called when our vty is in the
404 Passing an in-memory bitmap to this function results in error.
407 blank the display if the argument
410 This can be done to shut off the screen during display updates that
411 the user should first see when it's done.
412 .Ss Program termination and signal processing
413 It is important to call
415 before terminating the program.
416 Care must be taken if you install signal handlers and try to call
421 If a signal is caught while the program is inside
425 may not be able to properly restore the graphics hardware.
427 The recommended way to handle signals and program termination is to
428 have a flag to indicate signal's delivery.
429 Your signal handlers set this flag but do not terminate
430 the program immediately.
431 The main part of the program checks the flag to see if it is
432 supposed to terminate, and calls
440 installs its internal signal handlers for
441 .Dv SIGINT , SIGTERM , SIGSEGV ,
444 and terminates the program at appropriate time,
445 after one of these signals is caught.
446 If you want to have your own signal handlers for these signals,
454 are internally used by
456 to control screen switching and the mouse pointer,
457 and are not available to
466 .An S\(/oren Schmidt Aq Mt sos@FreeBSD.org