19a57b7d2SSøren Schmidt.\" Copyright (c) 1997 S�ren Schmidt 29a57b7d2SSøren Schmidt.\" All rights reserved. 39a57b7d2SSøren Schmidt.\" 49a57b7d2SSøren Schmidt.\" Redistribution and use in source and binary forms, with or without 59a57b7d2SSøren Schmidt.\" modification, are permitted provided that the following conditions 69a57b7d2SSøren Schmidt.\" are met: 79a57b7d2SSøren Schmidt.\" 1. Redistributions of source code must retain the above copyright 89a57b7d2SSøren Schmidt.\" notice, this list of conditions and the following disclaimer, 99a57b7d2SSøren Schmidt.\" in this position and unchanged. 109a57b7d2SSøren Schmidt.\" 2. Redistributions in binary form must reproduce the above copyright 119a57b7d2SSøren Schmidt.\" notice, this list of conditions and the following disclaimer in the 129a57b7d2SSøren Schmidt.\" documentation and/or other materials provided with the distribution. 139a57b7d2SSøren Schmidt.\" 3. The name of the author may not be used to endorse or promote products 14d0097656SRuslan Ermilov.\" derived from this software without specific prior written permission. 159a57b7d2SSøren Schmidt.\" 169a57b7d2SSøren Schmidt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 179a57b7d2SSøren Schmidt.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 189a57b7d2SSøren Schmidt.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 199a57b7d2SSøren Schmidt.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 209a57b7d2SSøren Schmidt.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 219a57b7d2SSøren Schmidt.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 229a57b7d2SSøren Schmidt.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 239a57b7d2SSøren Schmidt.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 249a57b7d2SSøren Schmidt.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 259a57b7d2SSøren Schmidt.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 269a57b7d2SSøren Schmidt.\" 277f3dea24SPeter Wemm.\" $FreeBSD$ 285acf51eaSKazutaka YOKOTA.Dd November 7, 1999 299a57b7d2SSøren Schmidt.Dt VGL 3 30a307d598SRuslan Ermilov.Os 319a57b7d2SSøren Schmidt.Sh NAME 325acf51eaSKazutaka YOKOTA.Nm VGLBitmapAllocateBits , 33b2e8bf35SAlexey Zelkin.Nm VGLBitmapCopy , 345acf51eaSKazutaka YOKOTA.Nm VGLBitmapCreate , 355acf51eaSKazutaka YOKOTA.Nm VGLBitmapDestroy , 36b2e8bf35SAlexey Zelkin.Nm VGLBitmapPutChar , 37b2e8bf35SAlexey Zelkin.Nm VGLBitmapString , 38b2e8bf35SAlexey Zelkin.Nm VGLBlankDisplay , 39b2e8bf35SAlexey Zelkin.Nm VGLBox , 40b2e8bf35SAlexey Zelkin.Nm VGLCheckSwitch , 41b2e8bf35SAlexey Zelkin.Nm VGLClear , 42b2e8bf35SAlexey Zelkin.Nm VGLEllipse , 43b2e8bf35SAlexey Zelkin.Nm VGLEnd , 44b2e8bf35SAlexey Zelkin.Nm VGLFilledBox , 45b2e8bf35SAlexey Zelkin.Nm VGLFilledEllipse , 464c9d1e54SAndrzej Bialecki.Nm VGLGetXY , 47b2e8bf35SAlexey Zelkin.Nm VGLInit , 48b2e8bf35SAlexey Zelkin.Nm VGLLine , 495acf51eaSKazutaka YOKOTA.Nm VGLKeyboardInit , 505acf51eaSKazutaka YOKOTA.Nm VGLKeyboardEnd , 515acf51eaSKazutaka YOKOTA.Nm VGLKeyboardGetCh , 52b2e8bf35SAlexey Zelkin.Nm VGLMouseInit , 53b2e8bf35SAlexey Zelkin.Nm VGLMouseMode , 54b2e8bf35SAlexey Zelkin.Nm VGLMouseSetImage , 55b2e8bf35SAlexey Zelkin.Nm VGLMouseSetStdImage , 56b2e8bf35SAlexey Zelkin.Nm VGLMouseStatus , 575acf51eaSKazutaka YOKOTA.Nm VGLPanScreen , 58b2e8bf35SAlexey Zelkin.Nm VGLSetBorder , 59b2e8bf35SAlexey Zelkin.Nm VGLSetPalette , 60b2e8bf35SAlexey Zelkin.Nm VGLSetPaletteIndex , 615acf51eaSKazutaka YOKOTA.Nm VGLSetVScreenSize , 624c9d1e54SAndrzej Bialecki.Nm VGLSetXY , 63b2e8bf35SAlexey Zelkin.Nm VGLTextSetFontFile 64ae23d9acSAlexey Zelkin.Nd Video Graphics Library functions 65ae23d9acSAlexey Zelkin.Sh LIBRARY 66ae23d9acSAlexey Zelkin.Lb libvgl 679a57b7d2SSøren Schmidt.Sh SYNOPSIS 6800d25f51SPoul-Henning Kamp.Fd #include <sys/fbio.h> 6900d25f51SPoul-Henning Kamp.Fd #include <sys/consio.h> 7000d25f51SPoul-Henning Kamp.Fd #include <sys/kbio.h> 719a57b7d2SSøren Schmidt.Fd #include <vgl.h> 72b2e8bf35SAlexey Zelkin.Ft int 73b2e8bf35SAlexey Zelkin.Fn VGLInit "int mode" 74b2e8bf35SAlexey Zelkin.Ft void 75b2e8bf35SAlexey Zelkin.Fn VGLEnd "void" 76b2e8bf35SAlexey Zelkin.Ft void 77b2e8bf35SAlexey Zelkin.Fn VGLCheckSwitch "void" 78b2e8bf35SAlexey Zelkin.Ft int 79b2e8bf35SAlexey Zelkin.Fn VGLTextSetFontFile "char *filename" 80b2e8bf35SAlexey Zelkin.Ft int 815acf51eaSKazutaka YOKOTA.Fn VGLKeyboardInit "int code" 825acf51eaSKazutaka YOKOTA.Ft void 835acf51eaSKazutaka YOKOTA.Fn VGLKeyboardEnd "void" 845acf51eaSKazutaka YOKOTA.Ft int 855acf51eaSKazutaka YOKOTA.Fn VGLKeyboardGetCh "void" 865acf51eaSKazutaka YOKOTA.Ft int 87b2e8bf35SAlexey Zelkin.Fn VGLMouseInit "int mode" 88b2e8bf35SAlexey Zelkin.Ft void 89b2e8bf35SAlexey Zelkin.Fn VGLMouseMode "int mode" 90b2e8bf35SAlexey Zelkin.Ft int 91b2e8bf35SAlexey Zelkin.Fn VGLMouseStatus "int *x" "int *y" "char *buttons" 92b2e8bf35SAlexey Zelkin.Ft void 93b2e8bf35SAlexey Zelkin.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask" 94b2e8bf35SAlexey Zelkin.Ft void 95b2e8bf35SAlexey Zelkin.Fn VGLMouseSetStdImage "void" 964c9d1e54SAndrzej Bialecki.Ft byte 974c9d1e54SAndrzej Bialecki.Fn VGLGetXY "VGLBitmap *object" "int x" "int y" 984c9d1e54SAndrzej Bialecki.Ft void 994c9d1e54SAndrzej Bialecki.Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "byte color" 100b2e8bf35SAlexey Zelkin.Ft void 101b2e8bf35SAlexey Zelkin.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 102b2e8bf35SAlexey Zelkin.Ft void 103b2e8bf35SAlexey Zelkin.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 104b2e8bf35SAlexey Zelkin.Ft void 105b2e8bf35SAlexey Zelkin.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color" 106b2e8bf35SAlexey Zelkin.Ft void 107b2e8bf35SAlexey Zelkin.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color" 108b2e8bf35SAlexey Zelkin.Ft void 109b2e8bf35SAlexey Zelkin.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color" 1105acf51eaSKazutaka YOKOTA.Ft VGLBitmap * 1115acf51eaSKazutaka YOKOTA.Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits" 1125acf51eaSKazutaka YOKOTA.Ft void 1135acf51eaSKazutaka YOKOTA.Fn VGLBitmapDestroy "VGLBitmap *object" 1145acf51eaSKazutaka YOKOTA.Ft int 1155acf51eaSKazutaka YOKOTA.Fn VGLBitmapAllocateBits "VGLBitmap *object" 116b2e8bf35SAlexey Zelkin.Ft int 117b2e8bf35SAlexey Zelkin.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight" 118b2e8bf35SAlexey Zelkin.Ft void 119b2e8bf35SAlexey Zelkin.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir" 120b2e8bf35SAlexey Zelkin.Ft void 121b2e8bf35SAlexey Zelkin.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir" 122b2e8bf35SAlexey Zelkin.Ft void 123b2e8bf35SAlexey Zelkin.Fn VGLClear "VGLBitmap *object" "byte color" 124b2e8bf35SAlexey Zelkin.Ft void 125b2e8bf35SAlexey Zelkin.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue" 126b2e8bf35SAlexey Zelkin.Ft void 127b2e8bf35SAlexey Zelkin.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue" 128b2e8bf35SAlexey Zelkin.Ft void 129b2e8bf35SAlexey Zelkin.Fn VGLSetBorder "byte color" 1305acf51eaSKazutaka YOKOTA.Ft int 1315acf51eaSKazutaka YOKOTA.Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize" 1325acf51eaSKazutaka YOKOTA.Ft int 133a0d660c2SBruce Evans.Fn VGLPanScreen "VGLBitmap *object" "int x" "int y" 134b2e8bf35SAlexey Zelkin.Ft void 135b2e8bf35SAlexey Zelkin.Fn VGLBlankDisplay "int blank" 1369a57b7d2SSøren Schmidt.Sh DESCRIPTION 137b2e8bf35SAlexey Zelkin.Nm Libvgl 138b2e8bf35SAlexey Zelkinis a library that enables the programmer access to the graphics 1399a57b7d2SSøren Schmidtmodes supported by the console driver (syscons). The library takes care of 1409a57b7d2SSøren Schmidtprogramming the actual video hardware, and provides a number of simple 141c6ff3a1bSSheldon Hearnfunctions to do various graphic operations. 142c6ff3a1bSSheldon HearnThere is also support for a 143b2e8bf35SAlexey Zelkinmouse via the standard mouse system in 144b2e8bf35SAlexey Zelkin.Fx , 145b2e8bf35SAlexey Zelkinsee 146b2e8bf35SAlexey Zelkin.Xr mouse 4 , 147b2e8bf35SAlexey Zelkinincluding the ability to transparently have a mouse pointer superimposed on 1489a57b7d2SSøren Schmidtthe graphic image currently being worked on. 1499a57b7d2SSøren SchmidtThe library takes care of screen switching by storing the current image in 150d877622aSJames Raynardmemory before switching to another virtual console, and restoring when the 151c6ff3a1bSSheldon Hearnuser switches back. 152c6ff3a1bSSheldon HearnThis allows several graphic applications at once, but 1539a57b7d2SSøren Schmidton different virtual consoles. 15442635956SRuslan Ermilov.Pp 1559a57b7d2SSøren SchmidtBelow is a short description of the various functions: 156b2e8bf35SAlexey Zelkin.Pp 157b2e8bf35SAlexey Zelkin.Fn VGLInit 158b2e8bf35SAlexey Zelkininitialize the library and set up the graphic mode 159fd6995f7SAlexey Zelkin.Va mode . 160b2e8bf35SAlexey Zelkin.Pp 161b2e8bf35SAlexey Zelkin.Fn VGLEnd 162b2e8bf35SAlexey Zelkinterminate graphic mode, and restore the screenmode that was active before 1639a57b7d2SSøren Schmidt.Fn VGLInit 1649a57b7d2SSøren Schmidtwas called. 165b2e8bf35SAlexey Zelkin.Pp 166b2e8bf35SAlexey Zelkin.Fn VGLCheckSwitch 167b2e8bf35SAlexey Zelkinif the program goes into longer periods of processing without doing 1689a57b7d2SSøren Schmidtany graphics output, calling this function occasionally will allow 1699a57b7d2SSøren Schmidtthe system to switch screens. 170b2e8bf35SAlexey Zelkin.Pp 171b2e8bf35SAlexey Zelkin.Fn VGLTextSetFontFile 172b2e8bf35SAlexey Zelkininstruct the char/string functions to use the font in file 173fd6995f7SAlexey Zelkin.Pa filename 174d877622aSJames Raynardinstead of the builtin font. 175b2e8bf35SAlexey Zelkin.Pp 1765acf51eaSKazutaka YOKOTA.Fn VGLKeyboardInit 177fd6995f7SAlexey Zelkinset up the keyboard in the 178fd6995f7SAlexey Zelkin.Dq raw 179fd6995f7SAlexey ZelkinI/O mode and 1805acf51eaSKazutaka YOKOTAspecify the key code to be used. 181fd6995f7SAlexey Zelkin.Va code 1825acf51eaSKazutaka YOKOTAmust be 183fd6995f7SAlexey Zelkin.Dv VGL_XLATEKEYS , 184fd6995f7SAlexey Zelkin.Dv VGL_CODEKEYS , 1855acf51eaSKazutaka YOKOTAor 186fd6995f7SAlexey Zelkin.Dv VGL_RAWKEYS . 1875acf51eaSKazutaka YOKOTAWhen 188fd6995f7SAlexey Zelkin.Dv VGL_XLATEKEYS 1895acf51eaSKazutaka YOKOTAis specified, the keyboard translate the raw keyboard scan code into 1905acf51eaSKazutaka YOKOTAa character code. 1915acf51eaSKazutaka YOKOTAIf 192fd6995f7SAlexey Zelkin.Dv VGL_RAWKEYS 1935acf51eaSKazutaka YOKOTAis used, the raw keyboard scan code is read as is. 194fd6995f7SAlexey Zelkin.Dv VGL_CODEKEYS 1955acf51eaSKazutaka YOKOTAis the intermediate key code; each key is assigned a unique code whereas 1965acf51eaSKazutaka YOKOTAmore than one raw scan code may be generated when a key is pressed. 1975acf51eaSKazutaka YOKOTA.Pp 1985acf51eaSKazutaka YOKOTA.Fn VGLKeyboardEnd 1995acf51eaSKazutaka YOKOTAwhen you have finished using the keyboard, call this function. 2005acf51eaSKazutaka YOKOTA.Pp 2015acf51eaSKazutaka YOKOTA.Fn VGLKeyboardGetCh 202fd6995f7SAlexey Zelkinread one byte from the keyboard. As the keyboard I/O is in the 203fd6995f7SAlexey Zelkin.Dq raw 2045acf51eaSKazutaka YOKOTAinput mode, the function will not block even if there is no input data, 2055acf51eaSKazutaka YOKOTAand returns 0. 2065acf51eaSKazutaka YOKOTA.Pp 207b2e8bf35SAlexey Zelkin.Fn VGLMouseInit 208c6ff3a1bSSheldon Hearninitialize the mouse. 209c6ff3a1bSSheldon HearnThe optional on-screen mouse pointer is shown if the 2109a57b7d2SSøren Schmidtargument is 211fd6995f7SAlexey Zelkin.Dv VGL_MOUSESHOW . 212b2e8bf35SAlexey Zelkin.Pp 213b2e8bf35SAlexey Zelkin.Fn VGLMouseMode 214b2e8bf35SAlexey Zelkineither shows the mouse pointer if the argument is 215fd6995f7SAlexey Zelkin.Dv VGL_MOUSESHOW , 216b2e8bf35SAlexey Zelkinor hides the mouse pointer if the argument is 217fd6995f7SAlexey Zelkin.Dv VGL_MOUSEHIDE . 218b2e8bf35SAlexey Zelkin.Pp 219b2e8bf35SAlexey Zelkin.Fn VGLMouseStatus 220b2e8bf35SAlexey Zelkinreturns the current mouse pointer coordinates and button state in 221fd6995f7SAlexey Zelkin.Va x , y , 222c6ff3a1bSSheldon Hearnbuttons. 223c6ff3a1bSSheldon HearnThe return value reflects if the mouse pointer 2249a57b7d2SSøren Schmidtis currently shown on screen or not. 225b2e8bf35SAlexey Zelkin.Pp 226b2e8bf35SAlexey Zelkin.Fn VGLMouseSetImage 227b2e8bf35SAlexey Zelkinwith this function it is possible to change the image of the mouse pointer 2289a57b7d2SSøren Schmidton screen. 229b2e8bf35SAlexey Zelkin.Pp 230b2e8bf35SAlexey Zelkin.Fn VGLMouseSetStdImage 231b2e8bf35SAlexey Zelkinthis function restores the mouse pointer to the standard arrow. 232b2e8bf35SAlexey Zelkin.Pp 2334c9d1e54SAndrzej Bialecki.Fn VGLGetXY 2344c9d1e54SAndrzej Bialeckiretrieves the color of the pixel located at 235fd6995f7SAlexey Zelkin.Va x , y , 2364c9d1e54SAndrzej Bialeckicoordinates of the 237fd6995f7SAlexey Zelkin.Va object 2384c9d1e54SAndrzej Bialeckiargument, and returns it as a byte value. 2394c9d1e54SAndrzej Bialecki.Pp 2404c9d1e54SAndrzej Bialecki.Fn VGLSetXY 2414c9d1e54SAndrzej Bialeckisets the color of the pixel located at 242fd6995f7SAlexey Zelkin.Va x , y , 2434c9d1e54SAndrzej Bialeckicoordinates of the 244fd6995f7SAlexey Zelkin.Va object 2454c9d1e54SAndrzej Bialeckiargument to 246fd6995f7SAlexey Zelkin.Va color 2474c9d1e54SAndrzej Bialeckibyte value. 2484c9d1e54SAndrzej Bialecki.Pp 249b2e8bf35SAlexey Zelkin.Fn VGLLine 250b2e8bf35SAlexey Zelkindraw a line from 251fd6995f7SAlexey Zelkin.Va x1 , y1 2529a57b7d2SSøren Schmidtto 253fd6995f7SAlexey Zelkin.Va x2 , y2 2549a57b7d2SSøren Schmidtin color 255fd6995f7SAlexey Zelkin.Va color . 256b2e8bf35SAlexey Zelkin.Pp 257b2e8bf35SAlexey Zelkin.Fn VGLBox 258b2e8bf35SAlexey Zelkindraw a box with upper left hand corner at 259fd6995f7SAlexey Zelkin.Va x1 , y1 2609a57b7d2SSøren Schmidtand lower right hand corner at 261fd6995f7SAlexey Zelkin.Va x2 , y2 2629a57b7d2SSøren Schmidtin color 263fd6995f7SAlexey Zelkin.Va color . 264b2e8bf35SAlexey Zelkin.Pp 265b2e8bf35SAlexey Zelkin.Fn VGLFilledBox 266b2e8bf35SAlexey Zelkindraw a filled (solid) box with upper left hand corner at 267fd6995f7SAlexey Zelkin.Va x1 , y1 2689a57b7d2SSøren Schmidtand lower right hand corner at 269fd6995f7SAlexey Zelkin.Va x2 , y2 2709a57b7d2SSøren Schmidtin color 271fd6995f7SAlexey Zelkin.Va color . 272b2e8bf35SAlexey Zelkin.Pp 273b2e8bf35SAlexey Zelkin.Fn VGLEllipse 274b2e8bf35SAlexey Zelkindraw an ellipse centered at 275fd6995f7SAlexey Zelkin.Va xc , yc 2769a57b7d2SSøren Schmidtmake it 277fd6995f7SAlexey Zelkin.Va a 2789a57b7d2SSøren Schmidtpixels wide, and 279fd6995f7SAlexey Zelkin.Va b 2809a57b7d2SSøren Schmidtpixels high in color 281fd6995f7SAlexey Zelkin.Va color . 282b2e8bf35SAlexey Zelkin.Pp 283b2e8bf35SAlexey Zelkin.Fn VGLFilledEllipse 284b2e8bf35SAlexey Zelkindraw a filled (solid) ellipse centered at 285fd6995f7SAlexey Zelkin.Va xc , yc 2869a57b7d2SSøren Schmidtmake it 287fd6995f7SAlexey Zelkin.Va a 2889a57b7d2SSøren Schmidtpixels wide, and 289fd6995f7SAlexey Zelkin.Va b 2909a57b7d2SSøren Schmidtpixels high in color 291fd6995f7SAlexey Zelkin.Va color . 292b2e8bf35SAlexey Zelkin.Pp 2935acf51eaSKazutaka YOKOTA.Fn VGLBitmapCreate 2945acf51eaSKazutaka YOKOTAcreate a bitmap object and initialize it with the specified 2955acf51eaSKazutaka YOKOTAvalues and bit data. 296fd6995f7SAlexey Zelkin.Va type 2975acf51eaSKazutaka YOKOTAmust be 298fd6995f7SAlexey Zelkin.Dv MEMBUF 2995acf51eaSKazutaka YOKOTAfor the in-memory bitmap. 300fd6995f7SAlexey Zelkin.Va bits 3015acf51eaSKazutaka YOKOTAmay be NULL so that bitmap data may be associated later. 3025acf51eaSKazutaka YOKOTA.Pp 3035acf51eaSKazutaka YOKOTAThere also is a macro, 3045acf51eaSKazutaka YOKOTA.Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits" 3055acf51eaSKazutaka YOKOTAto initialize a statically declared bitmap object. 3065acf51eaSKazutaka YOKOTA.Pp 3075acf51eaSKazutaka YOKOTA.Fn VGLBitmapDestroy 3085acf51eaSKazutaka YOKOTAfree the bitmap data and the bitmap object. 3095acf51eaSKazutaka YOKOTA.Pp 3105acf51eaSKazutaka YOKOTA.Fn VGLBitmapAllocateBits 3115acf51eaSKazutaka YOKOTAallocate a bit data buffer for the specified object. 3125acf51eaSKazutaka YOKOTA.Pp 313b2e8bf35SAlexey Zelkin.Fn VGLBitmapCopy 314b2e8bf35SAlexey Zelkincopy a rectangle of pixels from bitmap 315fd6995f7SAlexey Zelkin.Va src 3169a57b7d2SSøren Schmidtupper left hand corner at 317fd6995f7SAlexey Zelkin.Va srcx , srcy 3189a57b7d2SSøren Schmidtto bitmap 319fd6995f7SAlexey Zelkin.Va dst 3209a57b7d2SSøren Schmidtat 321fd6995f7SAlexey Zelkin.Va dstx , dsty 3229a57b7d2SSøren Schmidtof the size 323fd6995f7SAlexey Zelkin.Va width , height . 324b2e8bf35SAlexey Zelkin.Pp 325b2e8bf35SAlexey Zelkin.Fn VGLBitmapPutChar 326b2e8bf35SAlexey Zelkinwrite the character 327fd6995f7SAlexey Zelkin.Va ch 3289a57b7d2SSøren Schmidtat position 329fd6995f7SAlexey Zelkin.Va x , y 3309a57b7d2SSøren Schmidtin foreground color 331fd6995f7SAlexey Zelkin.Va fgcol . 3329a57b7d2SSøren SchmidtIf 333fd6995f7SAlexey Zelkin.Va fill 3349a57b7d2SSøren Schmidtis != 0, use the color 335fd6995f7SAlexey Zelkin.Va bgcol 3369fb4ca06SSøren Schmidtas background otherwise the background is transparent. 3379a57b7d2SSøren SchmidtThe character is drawn in the direction specified by the argument 338fd6995f7SAlexey Zelkin.Va dir . 339b2e8bf35SAlexey Zelkin.Pp 340b2e8bf35SAlexey Zelkin.Fn VGLBitmapString 341b2e8bf35SAlexey Zelkinwrite the string 342fd6995f7SAlexey Zelkin.Va str 3439a57b7d2SSøren Schmidtat position 344fd6995f7SAlexey Zelkin.Va x , y 3459a57b7d2SSøren Schmidtin foreground color 346fd6995f7SAlexey Zelkin.Va fgcol . 3479a57b7d2SSøren SchmidtIf 348fd6995f7SAlexey Zelkin.Va fill 3499a57b7d2SSøren Schmidtis != 0, use the color 350fd6995f7SAlexey Zelkin.Va bgcol 351d877622aSJames Raynardas background otherwise the background is transparent. 3529a57b7d2SSøren SchmidtThe string is drawn in the direction specified by the argument 353fd6995f7SAlexey Zelkin.Va dir . 354b2e8bf35SAlexey Zelkin.Pp 355b2e8bf35SAlexey Zelkin.Fn VGLClear 356b2e8bf35SAlexey Zelkinclears the entire bitmap to color 357fd6995f7SAlexey Zelkin.Va color . 358b2e8bf35SAlexey Zelkin.Pp 359b2e8bf35SAlexey Zelkin.Fn VGLSetPalette 360b2e8bf35SAlexey Zelkinthis function sets the palette used, the arguments 361fd6995f7SAlexey Zelkin.Va red , green , blue 3629a57b7d2SSøren Schmidtshould point to byte arrays of 256 positions each. 363b2e8bf35SAlexey Zelkin.Pp 364b2e8bf35SAlexey Zelkin.Fn VGLSetPaletteIndex 365b2e8bf35SAlexey Zelkinset the palette index 366fd6995f7SAlexey Zelkin.Va color 3679a57b7d2SSøren Schmidtto the specified RGB value. 368b2e8bf35SAlexey Zelkin.Pp 369b2e8bf35SAlexey Zelkin.Fn VGLSetBorder 370b2e8bf35SAlexey Zelkinset the border color to color 371fd6995f7SAlexey Zelkin.Va color . 372b2e8bf35SAlexey Zelkin.Pp 3735acf51eaSKazutaka YOKOTA.Fn VGLSetVScreenSize 3745acf51eaSKazutaka YOKOTAchange the virtual screen size of the display. Note that this 3755acf51eaSKazutaka YOKOTAfunction must be called when our vty is in the foreground. 3765acf51eaSKazutaka YOKOTAAnd 377fd6995f7SAlexey Zelkin.Va object 3785acf51eaSKazutaka YOKOTAmust be 379fd6995f7SAlexey Zelkin.Va VGLDisplay . 3805acf51eaSKazutaka YOKOTAPassing a in-memory bitmap to this function results in error. 3815acf51eaSKazutaka YOKOTA.Pp 3825acf51eaSKazutaka YOKOTAThe desired virtual screen width may not be achievable because 3835acf51eaSKazutaka YOKOTAof the video card hardware. In such case the video driver (and 3845acf51eaSKazutaka YOKOTAunderlaying video BIOS) may choose the next largest values. 3855acf51eaSKazutaka YOKOTAAlways examine 386fd6995f7SAlexey Zelkin.Va object->VXsize 3875acf51eaSKazutaka YOKOTAand 388fd6995f7SAlexey Zelkin.Va VYsize 3895acf51eaSKazutaka YOKOTAafter calling this function, in order to see how the virtual screen 3905acf51eaSKazutaka YOKOTAis actually set up. 3915acf51eaSKazutaka YOKOTA.Pp 3925acf51eaSKazutaka YOKOTAIn order to set up the largest possible virtual screen, you may 3935acf51eaSKazutaka YOKOTAcall this function with arbitrary large values. 3945acf51eaSKazutaka YOKOTA.Pp 3955acf51eaSKazutaka YOKOTA.Dl VGLSetVScreenSize(10000, 10000); 3965acf51eaSKazutaka YOKOTA.Pp 3975acf51eaSKazutaka YOKOTA.Fn VGLPanSreen 3985acf51eaSKazutaka YOKOTAchange the origin of the displayed screen in the virtual screen. 3995acf51eaSKazutaka YOKOTANote that this function must be called when our vty is in the 4005acf51eaSKazutaka YOKOTAforeground. 401fd6995f7SAlexey Zelkin.Va object 4025acf51eaSKazutaka YOKOTAmust be 403fd6995f7SAlexey Zelkin.Va VGLDisplay . 4045acf51eaSKazutaka YOKOTAPassing a in-memory bitmap to this function results in error. 4055acf51eaSKazutaka YOKOTA.Pp 406b2e8bf35SAlexey Zelkin.Fn VGLBlankDisplay 407d0097656SRuslan Ermilovblank the display if the argument 408fd6995f7SAlexey Zelkin.Va blank 409d877622aSJames Raynard!= 0. This can be done to shut off the screen during display updates that 410d877622aSJames Raynardthe user should first see when it's done. 41171a9e563SKazutaka YOKOTA.Ss Program termination and signal processing 41271a9e563SKazutaka YOKOTAIt is important to call 41371a9e563SKazutaka YOKOTA.Fn VGLEnd 41471a9e563SKazutaka YOKOTAbefore terminating the program. 41571a9e563SKazutaka YOKOTACare must be taken if you install signal handlers and try to call 41671a9e563SKazutaka YOKOTA.Fn VGLEnd 41771a9e563SKazutaka YOKOTAand 41871a9e563SKazutaka YOKOTA.Xr exit 3 41971a9e563SKazutaka YOKOTAto end the program. 42071a9e563SKazutaka YOKOTAIf a signal is caught while the program is inside 42171a9e563SKazutaka YOKOTA.Nm libvgl 42271a9e563SKazutaka YOKOTAfunctions, 42371a9e563SKazutaka YOKOTA.Fn VGLEnd 42471a9e563SKazutaka YOKOTAmay not be able to properly restore the graphics hardware. 42571a9e563SKazutaka YOKOTA.Pp 42671a9e563SKazutaka YOKOTAThe recommended way to handle signals and program termination is to 4278155f5e2SKazutaka YOKOTAhave a flag to indicate signal's delivery. 4288155f5e2SKazutaka YOKOTAYour signal handlers set this flag but do not terminate 42971a9e563SKazutaka YOKOTAthe program immediately. 43071a9e563SKazutaka YOKOTAThe main part of the program checks the flag to see if it is 431d0097656SRuslan Ermilovsupposed to terminate, and calls 43271a9e563SKazutaka YOKOTA.Fn VGLEnd 43371a9e563SKazutaka YOKOTAand 43471a9e563SKazutaka YOKOTA.Xr exit 3 43571a9e563SKazutaka YOKOTAif the flag is set. 43671a9e563SKazutaka YOKOTA.Pp 43771a9e563SKazutaka YOKOTANote that 43871a9e563SKazutaka YOKOTA.Fn VGLInit 43971a9e563SKazutaka YOKOTAinstalls its internal signal handlers for 44071a9e563SKazutaka YOKOTA.Dv SIGINT , SIGTERM , SIGSEGV , 44171a9e563SKazutaka YOKOTAand 44271a9e563SKazutaka YOKOTA.Dv SIGBUS , 44371a9e563SKazutaka YOKOTAand terminates the program at appropriate time, 44471a9e563SKazutaka YOKOTAafter one of these signals is caught. 44571a9e563SKazutaka YOKOTAIf you want to have your own signal handlers for these signals, 4468155f5e2SKazutaka YOKOTAinstall handlers 44771a9e563SKazutaka YOKOTA.Em after 44871a9e563SKazutaka YOKOTA.Fn VGLInit . 44971a9e563SKazutaka YOKOTA.Pp 45071a9e563SKazutaka YOKOTA.Dv SIGUSR1 45171a9e563SKazutaka YOKOTAand 45271a9e563SKazutaka YOKOTA.Dv SIGUSR2 45371a9e563SKazutaka YOKOTAare internally used by 45471a9e563SKazutaka YOKOTA.Nm libvgl 45571a9e563SKazutaka YOKOTAto control screen switching and the mouse pointer, 45671a9e563SKazutaka YOKOTAand are not available to 45771a9e563SKazutaka YOKOTA.Nm libvgl 45871a9e563SKazutaka YOKOTAclient programs. 459b2e8bf35SAlexey Zelkin.Sh AUTHORS 4608e8536e1SRuslan Ermilov.An S\(/oren Schmidt Aq sos@FreeBSD.org 4619a57b7d2SSøren Schmidt.Sh HISTORY 4629a57b7d2SSøren SchmidtThe 463b2e8bf35SAlexey Zelkin.Nm vgl 464b2e8bf35SAlexey Zelkinlibrary appeared in 46581bddaa0SMike Pritchard.Fx 3.0 . 466