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.
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
73 .Fn VGLInit "int mode"
77 .Fn VGLCheckSwitch "void"
79 .Fn VGLTextSetFontFile "char *filename"
81 .Fn VGLKeyboardInit "int code"
83 .Fn VGLKeyboardEnd "void"
85 .Fn VGLKeyboardGetCh "void"
87 .Fn VGLMouseInit "int mode"
89 .Fn VGLMouseMode "int mode"
91 .Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
93 .Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
95 .Fn VGLMouseSetStdImage "void"
97 .Fn VGLGetXY "VGLBitmap *object" "int x" "int y"
99 .Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "u_long color"
101 .Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
103 .Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
105 .Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
107 .Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
109 .Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
111 .Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits"
113 .Fn VGLBitmapDestroy "VGLBitmap *object"
115 .Fn VGLBitmapAllocateBits "VGLBitmap *object"
117 .Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
119 .Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
121 .Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
123 .Fn VGLClear "VGLBitmap *object" "u_long color"
125 .Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
127 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
129 .Fn VGLSetBorder "byte color"
131 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
133 .Fn VGLPanScreen "VGLBitmap *object" "int x" "int y"
135 .Fn VGLBlankDisplay "int blank"
138 is a library that enables the programmer access to the graphics
139 modes supported by the console driver (syscons).
140 The library takes care of
141 programming the actual video hardware, and provides a number of simple
142 functions to do various graphic operations.
143 There is also support for a
144 mouse via the standard mouse system in
148 including the ability to transparently have a mouse pointer superimposed on
149 the graphic image currently being worked on.
150 The library takes care of screen switching by storing the current image in
151 memory before switching to another virtual console, and restoring when the
153 This allows several graphic applications at once, but
154 on different virtual consoles.
156 Below is a short description of the various functions:
159 initialize the library and set up the graphic mode
163 terminate graphic mode, and restore the screenmode that was active before
168 if the program goes into longer periods of processing without doing
169 any graphics output, calling this function occasionally will allow
170 the system to switch screens.
172 .Fn VGLTextSetFontFile
173 instruct the char/string functions to use the font in file
175 instead of the builtin font.
178 set up the keyboard in the
181 specify the key code to be used.
190 is specified, the keyboard translates the raw keyboard scan code into
194 is used, the raw keyboard scan code is read as is.
196 is the intermediate key code; each key is assigned a unique code whereas
197 more than one raw scan code may be generated when a key is pressed.
200 when you have finished using the keyboard, call this function.
203 read one byte from the keyboard.
204 As the keyboard I/O is in the
206 input mode, the function will not block even if there is no input data,
210 initialize the mouse.
211 The optional on-screen mouse pointer is shown if the
216 either shows the mouse pointer if the argument is
218 or hides the mouse pointer if the argument is
222 returns the current mouse pointer coordinates and button state in
225 The return value reflects if the mouse pointer
226 is currently shown on screen or not.
229 with this function it is possible to change the image of the mouse pointer
232 .Fn VGLMouseSetStdImage
233 this function restores the mouse pointer to the standard arrow.
236 retrieves the color of the pixel located at
240 argument, and returns it as a byte value.
243 sets the color of the pixel located at
260 draw a box with upper left hand corner at
262 and lower right hand corner at
268 draw a filled (solid) box with upper left hand corner at
270 and lower right hand corner at
276 draw an ellipse centered at
286 draw a filled (solid) ellipse centered at
296 create a bitmap object and initialize it with the specified
301 for the in-memory bitmap.
303 may be NULL so that bitmap data may be associated later.
305 There also is a macro,
306 .Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits"
307 to initialize a statically declared bitmap object.
310 free the bitmap data and the bitmap object.
312 .Fn VGLBitmapAllocateBits
313 allocate a bit data buffer for the specified object.
316 copy a rectangle of pixels from bitmap
318 upper left hand corner at
336 is != 0, use the color
338 as background otherwise the background is transparent.
339 The character is drawn in the direction specified by the argument
351 is != 0, use the color
353 as background otherwise the background is transparent.
354 The string is drawn in the direction specified by the argument
358 clears the entire bitmap to color
362 this function sets the palette used, the arguments
363 .Va red , green , blue
364 should point to byte arrays of 256 positions each.
366 .Fn VGLSetPaletteIndex
367 set the palette index
369 to the specified RGB value.
372 set the border color to color
375 .Fn VGLSetVScreenSize
376 change the virtual screen size of the display.
378 function must be called when our vty is in the foreground.
383 Passing an in-memory bitmap to this function results in error.
385 The desired virtual screen width may not be achievable because
386 of the video card hardware.
387 In such case the video driver (and
388 underlaying video BIOS) may choose the next largest values.
393 after calling this function, in order to see how the virtual screen
396 In order to set up the largest possible virtual screen, you may
397 call this function with arbitrary large values.
399 .Dl VGLSetVScreenSize(10000, 10000);
402 change the origin of the displayed screen in the virtual screen.
403 Note that this function must be called when our vty is in the
408 Passing an in-memory bitmap to this function results in error.
411 blank the display if the argument
414 This can be done to shut off the screen during display updates that
415 the user should first see when it is done.
416 .Ss Program termination and signal processing
417 It is important to call
419 before terminating the program.
420 Care must be taken if you install signal handlers and try to call
425 If a signal is caught while the program is inside
429 may not be able to properly restore the graphics hardware.
431 The recommended way to handle signals and program termination is to
432 have a flag to indicate signal's delivery.
433 Your signal handlers set this flag but do not terminate
434 the program immediately.
435 The main part of the program checks the flag to see if it is
436 supposed to terminate, and calls
444 installs its internal signal handlers for
445 .Dv SIGINT , SIGTERM , SIGSEGV ,
448 and terminates the program at appropriate time,
449 after one of these signals is caught.
450 If you want to have your own signal handlers for these signals,
458 are internally used by
460 to control screen switching and the mouse pointer,
461 and are not available to
470 .An S\(/oren Schmidt Aq sos@FreeBSD.org