2 .\" Copyright (c) 1997 Søren Schmidt
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer,
10 .\" in this position and unchanged.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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
74 .Fn VGLInit "int mode"
78 .Fn VGLCheckSwitch "void"
80 .Fn VGLTextSetFontFile "char *filename"
82 .Fn VGLKeyboardInit "int code"
84 .Fn VGLKeyboardEnd "void"
86 .Fn VGLKeyboardGetCh "void"
88 .Fn VGLMouseInit "int mode"
90 .Fn VGLMouseMode "int mode"
92 .Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
94 .Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
96 .Fn VGLMouseSetStdImage "void"
98 .Fn VGLGetXY "VGLBitmap *object" "int x" "int y"
100 .Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "u_long color"
102 .Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
104 .Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
106 .Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
108 .Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
110 .Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
112 .Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits"
114 .Fn VGLBitmapDestroy "VGLBitmap *object"
116 .Fn VGLBitmapAllocateBits "VGLBitmap *object"
118 .Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
120 .Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
122 .Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
124 .Fn VGLClear "VGLBitmap *object" "u_long color"
126 .Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
128 .Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
130 .Fn VGLSetBorder "byte color"
132 .Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
134 .Fn VGLPanScreen "VGLBitmap *object" "int x" "int y"
136 .Fn VGLBlankDisplay "int blank"
139 is a library that enables the programmer access to the graphics
140 modes supported by the console driver (syscons).
141 The library takes care of
142 programming the actual video hardware, and provides a number of simple
143 functions to do various graphic operations.
144 There is also support for a
145 mouse via the standard mouse system in
149 including the ability to transparently have a mouse pointer superimposed on
150 the graphic image currently being worked on.
151 The library takes care of screen switching by storing the current image in
152 memory before switching to another virtual console, and restoring when the
154 This allows several graphic applications at once, but
155 on different virtual consoles.
157 Below is a short description of the various functions:
160 initialize the library and set up the graphic mode
164 terminate graphic mode, and restore the screenmode that was active before
169 if the program goes into longer periods of processing without doing
170 any graphics output, calling this function occasionally will allow
171 the system to switch screens.
173 .Fn VGLTextSetFontFile
174 instruct the char/string functions to use the font in file
176 instead of the builtin font.
179 set up the keyboard in the
182 specify the key code to be used.
191 is specified, the keyboard translates the raw keyboard scan code into
195 is used, the raw keyboard scan code is read as is.
197 is the intermediate key code; each key is assigned a unique code whereas
198 more than one raw scan code may be generated when a key is pressed.
201 when you have finished using the keyboard, call this function.
204 read one byte from the keyboard.
205 As the keyboard I/O is in the
207 input mode, the function will not block even if there is no input data,
211 initialize the mouse.
212 The optional on-screen mouse pointer is shown if the
217 either shows the mouse pointer if the argument is
219 or hides the mouse pointer if the argument is
223 returns the current mouse pointer coordinates and button state in
226 The return value reflects if the mouse pointer
227 is currently shown on screen or not.
230 with this function it is possible to change the image of the mouse pointer
233 .Fn VGLMouseSetStdImage
234 this function restores the mouse pointer to the standard arrow.
237 retrieves the color of the pixel located at
241 argument, and returns it as a byte value.
244 sets the color of the pixel located at
261 draw a box with upper left hand corner at
263 and lower right hand corner at
269 draw a filled (solid) box with upper left hand corner at
271 and lower right hand corner at
277 draw an ellipse centered at
287 draw a filled (solid) ellipse centered at
297 create a bitmap object and initialize it with the specified
302 for the in-memory bitmap.
304 may be NULL so that bitmap data may be associated later.
306 There also is a macro,
307 .Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits"
308 to initialize a statically declared bitmap object.
311 free the bitmap data and the bitmap object.
313 .Fn VGLBitmapAllocateBits
314 allocate a bit data buffer for the specified object.
317 copy a rectangle of pixels from bitmap
319 upper left hand corner at
337 is != 0, use the color
339 as background otherwise the background is transparent.
340 The character is drawn in the direction specified by the argument
352 is != 0, use the color
354 as background otherwise the background is transparent.
355 The string is drawn in the direction specified by the argument
359 clears the entire bitmap to color
363 this function sets the palette used, the arguments
364 .Va red , green , blue
365 should point to byte arrays of 256 positions each.
367 .Fn VGLSetPaletteIndex
368 set the palette index
370 to the specified RGB value.
373 set the border color to color
376 .Fn VGLSetVScreenSize
377 change the virtual screen size of the display.
379 function must be called when our vty is in the foreground.
384 Passing an in-memory bitmap to this function results in error.
386 The desired virtual screen width may not be achievable because
387 of the video card hardware.
388 In such case the video driver (and
389 underlying video BIOS) may choose the next largest values.
394 after calling this function, in order to see how the virtual screen
397 In order to set up the largest possible virtual screen, you may
398 call this function with arbitrary large values.
400 .Dl VGLSetVScreenSize(10000, 10000);
403 change the origin of the displayed screen in the virtual screen.
404 Note that this function must be called when our vty is in the
409 Passing an in-memory bitmap to this function results in error.
412 blank the display if the argument
415 This can be done to shut off the screen during display updates that
416 the user should first see when it is done.
417 .Ss Program termination and signal processing
418 It is important to call
420 before terminating the program.
421 Care must be taken if you install signal handlers and try to call
426 If a signal is caught while the program is inside
430 may not be able to properly restore the graphics hardware.
432 The recommended way to handle signals and program termination is to
433 have a flag to indicate signal's delivery.
434 Your signal handlers set this flag but do not terminate
435 the program immediately.
436 The main part of the program checks the flag to see if it is
437 supposed to terminate, and calls
445 installs its internal signal handlers for
446 .Dv SIGINT , SIGTERM , SIGSEGV ,
449 and terminates the program at appropriate time,
450 after one of these signals is caught.
451 If you want to have your own signal handlers for these signals,
459 are internally used by
461 to control screen switching and the mouse pointer,
462 and are not available to
471 .An S\(/oren Schmidt Aq Mt sos@FreeBSD.org