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 $
28 .\" $DragonFly: src/lib/libvgl/vgl.3,v 1.5 2006/10/20 19:11:25 swildner Exp $
33 .Nm VGLBitmapAllocateBits ,
36 .Nm VGLBitmapDestroy ,
37 .Nm VGLBitmapPutChar ,
46 .Nm VGLFilledEllipse ,
52 .Nm VGLKeyboardGetCh ,
55 .Nm VGLMouseSetImage ,
56 .Nm VGLMouseSetStdImage ,
61 .Nm VGLSetPaletteIndex ,
62 .Nm VGLSetVScreenSize ,
64 .Nm VGLTextSetFontFile
65 .Nd Video Graphics Library functions
72 .Fn VGLInit "int mode"
76 .Fn VGLCheckSwitch "void"
78 .Fn VGLTextSetFontFile "char *filename"
80 .Fn VGLKeyboardInit "int code"
82 .Fn VGLKeyboardEnd "void"
84 .Fn VGLKeyboardGetCh "void"
86 .Fn VGLMouseInit "int mode"
88 .Fn VGLMouseMode "int mode"
90 .Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
92 .Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
94 .Fn VGLMouseSetStdImage "void"
96 .Fn VGLGetXY "VGLBitmap *object" "int x" "int y"
98 .Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "byte color"
100 .Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
102 .Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
104 .Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
106 .Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
108 .Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
110 .Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits"
112 .Fn VGLBitmapDestroy "VGLBitmap *object"
114 .Fn VGLBitmapAllocateBits "VGLBitmap *object"
116 .Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
118 .Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
120 .Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
122 .Fn VGLClear "VGLBitmap *object" "byte color"
124 .Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
126 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
128 .Fn VGLSetBorder "byte color"
130 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
132 .Fn VGLPanScreen "VGLBitmap *object" "int x" "int y"
134 .Fn VGLBlankDisplay "int blank"
137 is a library that enables the programmer access to the graphics
138 modes supported by the console driver (syscons). The library takes care of
139 programming the actual video hardware, and provides a number of simple
140 functions to do various graphic operations.
141 There is also support for a
142 mouse via the standard mouse system in
146 including the ability to transparently have a mouse pointer superimposed on
147 the graphic image currently being worked on.
148 The library takes care of screen switching by storing the current image in
149 memory before switching to another virtual console, and restoring when the
151 This allows several graphic applications at once, but
152 on different virtual consoles.
154 Below is a short description of the various functions:
157 initialize the library and set up the graphic mode
161 terminate graphic mode, and restore the screenmode that was active before
166 if the program goes into longer periods of processing without doing
167 any graphics output, calling this function occasionally will allow
168 the system to switch screens.
170 .Fn VGLTextSetFontFile
171 instruct the char/string functions to use the font in file
173 instead of the builtin font.
176 set up the keyboard in the
179 specify the key code to be used.
188 is specified, the keyboard translate the raw keyboard scan code into
192 is used, the raw keyboard scan code is read as is.
194 is the intermediate key code; each key is assigned a unique code whereas
195 more than one raw scan code may be generated when a key is pressed.
198 when you have finished using the keyboard, call this function.
201 read one byte from the keyboard. As the keyboard I/O is in the
203 input mode, the function will not block even if there is no input data,
207 initialize the mouse.
208 The optional on-screen mouse pointer is shown if the
213 either shows the mouse pointer if the argument is
215 or hides the mouse pointer if the argument is
219 returns the current mouse pointer coordinates and button state in
222 The return value reflects if the mouse pointer
223 is currently shown on screen or not.
226 with this function it is possible to change the image of the mouse pointer
229 .Fn VGLMouseSetStdImage
230 this function restores the mouse pointer to the standard arrow.
233 retrieves the color of the pixel located at
237 argument, and returns it as a byte value.
240 sets the color of the pixel located at
257 draw a box with upper left hand corner at
259 and lower right hand corner at
265 draw a filled (solid) box with upper left hand corner at
267 and lower right hand corner at
273 draw an ellipse centered at
283 draw a filled (solid) ellipse centered at
293 create a bitmap object and initialize it with the specified
298 for the in-memory bitmap.
300 may be NULL so that bitmap data may be associated later.
302 There also is a macro,
303 .Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits"
304 to initialize a statically declared bitmap object.
307 free the bitmap data and the bitmap object.
309 .Fn VGLBitmapAllocateBits
310 allocate a bit data buffer for the specified object.
313 copy a rectangle of pixels from bitmap
315 upper left hand corner at
333 is != 0, use the color
335 as background otherwise the background is transparent.
336 The character is drawn in the direction specified by the argument
348 is != 0, use the color
350 as background otherwise the background is transparent.
351 The string is drawn in the direction specified by the argument
355 clears the entire bitmap to color
359 this function sets the palette used, the arguments
360 .Va red , green , blue
361 should point to byte arrays of 256 positions each.
363 .Fn VGLSetPaletteIndex
364 set the palette index
366 to the specified RGB value.
369 set the border color to color
372 .Fn VGLSetVScreenSize
373 change the virtual screen size of the display. Note that this
374 function must be called when our vty is in the foreground.
379 Passing a in-memory bitmap to this function results in error.
381 The desired virtual screen width may not be achievable because
382 of the video card hardware. In such case the video driver (and
383 underlaying video BIOS) may choose the next largest values.
388 after calling this function, in order to see how the virtual screen
391 In order to set up the largest possible virtual screen, you may
392 call this function with arbitrary large values.
394 .Dl VGLSetVScreenSize(10000, 10000);
397 change the origin of the displayed screen in the virtual screen.
398 Note that this function must be called when our vty is in the
403 Passing a in-memory bitmap to this function results in error.
406 blank the display if the argument
409 This can be done to shut off the screen during display updates that
410 the user should first see when it's done.
411 .Ss Program termination and signal processing
412 It is important to call
414 before terminating the program.
415 Care must be taken if you install signal handlers and try to call
420 If a signal is caught while the program is inside
424 may not be able to properly restore the graphics hardware.
426 The recommended way to handle signals and program termination is to
427 have a flag to indicate signal's delivery.
428 Your signal handlers set this flag but do not terminate
429 the program immediately.
430 The main part of the program checks the flag to see if it is
431 supposed to terminate, and calls
439 installs its internal signal handlers for
440 .Dv SIGINT , SIGTERM , SIGSEGV ,
443 and terminates the program at appropriate time,
444 after one of these signals is caught.
445 If you want to have your own signal handlers for these signals,
453 are internally used by
455 to control screen switching and the mouse pointer,
456 and are not available to
465 .An S\(/oren Schmidt Aq sos@FreeBSD.org