xref: /freebsd/lib/libvgl/vgl.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1bf3f9db6SUlrich Spörlein.\"-
2bf3f9db6SUlrich Spörlein.\" Copyright (c) 1997 Søren Schmidt
39a57b7d2SSøren Schmidt.\" All rights reserved.
49a57b7d2SSøren Schmidt.\"
59a57b7d2SSøren Schmidt.\" Redistribution and use in source and binary forms, with or without
69a57b7d2SSøren Schmidt.\" modification, are permitted provided that the following conditions
79a57b7d2SSøren Schmidt.\" are met:
89a57b7d2SSøren Schmidt.\" 1. Redistributions of source code must retain the above copyright
99a57b7d2SSøren Schmidt.\"    notice, this list of conditions and the following disclaimer,
109a57b7d2SSøren Schmidt.\"    in this position and unchanged.
119a57b7d2SSøren Schmidt.\" 2. Redistributions in binary form must reproduce the above copyright
129a57b7d2SSøren Schmidt.\"    notice, this list of conditions and the following disclaimer in the
139a57b7d2SSøren Schmidt.\"    documentation and/or other materials provided with the distribution.
149a57b7d2SSøren Schmidt.\" 3. The name of the author may not be used to endorse or promote products
15d0097656SRuslan Ermilov.\"    derived from this software without specific prior written permission.
169a57b7d2SSøren Schmidt.\"
179a57b7d2SSøren Schmidt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
189a57b7d2SSøren Schmidt.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
199a57b7d2SSøren Schmidt.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
209a57b7d2SSøren Schmidt.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
219a57b7d2SSøren Schmidt.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
229a57b7d2SSøren Schmidt.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239a57b7d2SSøren Schmidt.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249a57b7d2SSøren Schmidt.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259a57b7d2SSøren Schmidt.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
269a57b7d2SSøren Schmidt.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273102cfe2SGlen Barber.Dd February 25, 2012
289a57b7d2SSøren Schmidt.Dt VGL 3
29a307d598SRuslan Ermilov.Os
309a57b7d2SSøren Schmidt.Sh NAME
315acf51eaSKazutaka YOKOTA.Nm VGLBitmapAllocateBits ,
32b2e8bf35SAlexey Zelkin.Nm VGLBitmapCopy ,
335acf51eaSKazutaka YOKOTA.Nm VGLBitmapCreate ,
345acf51eaSKazutaka YOKOTA.Nm VGLBitmapDestroy ,
35b2e8bf35SAlexey Zelkin.Nm VGLBitmapPutChar ,
36b2e8bf35SAlexey Zelkin.Nm VGLBitmapString ,
37b2e8bf35SAlexey Zelkin.Nm VGLBlankDisplay ,
38b2e8bf35SAlexey Zelkin.Nm VGLBox ,
39b2e8bf35SAlexey Zelkin.Nm VGLCheckSwitch ,
40b2e8bf35SAlexey Zelkin.Nm VGLClear ,
41b2e8bf35SAlexey Zelkin.Nm VGLEllipse ,
42b2e8bf35SAlexey Zelkin.Nm VGLEnd ,
43b2e8bf35SAlexey Zelkin.Nm VGLFilledBox ,
44b2e8bf35SAlexey Zelkin.Nm VGLFilledEllipse ,
454c9d1e54SAndrzej Bialecki.Nm VGLGetXY ,
46b2e8bf35SAlexey Zelkin.Nm VGLInit ,
47b2e8bf35SAlexey Zelkin.Nm VGLLine ,
485acf51eaSKazutaka YOKOTA.Nm VGLKeyboardInit ,
495acf51eaSKazutaka YOKOTA.Nm VGLKeyboardEnd ,
505acf51eaSKazutaka YOKOTA.Nm VGLKeyboardGetCh ,
51b2e8bf35SAlexey Zelkin.Nm VGLMouseInit ,
52b2e8bf35SAlexey Zelkin.Nm VGLMouseMode ,
53b2e8bf35SAlexey Zelkin.Nm VGLMouseSetImage ,
54b2e8bf35SAlexey Zelkin.Nm VGLMouseSetStdImage ,
55b2e8bf35SAlexey Zelkin.Nm VGLMouseStatus ,
565acf51eaSKazutaka YOKOTA.Nm VGLPanScreen ,
57b2e8bf35SAlexey Zelkin.Nm VGLSetBorder ,
58b2e8bf35SAlexey Zelkin.Nm VGLSetPalette ,
59b2e8bf35SAlexey Zelkin.Nm VGLSetPaletteIndex ,
605acf51eaSKazutaka YOKOTA.Nm VGLSetVScreenSize ,
614c9d1e54SAndrzej Bialecki.Nm VGLSetXY ,
62b2e8bf35SAlexey Zelkin.Nm VGLTextSetFontFile
63ae23d9acSAlexey Zelkin.Nd Video Graphics Library functions
64ae23d9acSAlexey Zelkin.Sh LIBRARY
65ae23d9acSAlexey Zelkin.Lb libvgl
669a57b7d2SSøren Schmidt.Sh SYNOPSIS
6732eef9aeSRuslan Ermilov.In sys/fbio.h
6832eef9aeSRuslan Ermilov.In sys/consio.h
6932eef9aeSRuslan Ermilov.In sys/kbio.h
7032eef9aeSRuslan Ermilov.In vgl.h
71b2e8bf35SAlexey Zelkin.Ft int
72b2e8bf35SAlexey Zelkin.Fn VGLInit "int mode"
73b2e8bf35SAlexey Zelkin.Ft void
74b2e8bf35SAlexey Zelkin.Fn VGLEnd "void"
75b2e8bf35SAlexey Zelkin.Ft void
76b2e8bf35SAlexey Zelkin.Fn VGLCheckSwitch "void"
77b2e8bf35SAlexey Zelkin.Ft int
78b2e8bf35SAlexey Zelkin.Fn VGLTextSetFontFile "char *filename"
79b2e8bf35SAlexey Zelkin.Ft int
805acf51eaSKazutaka YOKOTA.Fn VGLKeyboardInit "int code"
815acf51eaSKazutaka YOKOTA.Ft void
825acf51eaSKazutaka YOKOTA.Fn VGLKeyboardEnd "void"
835acf51eaSKazutaka YOKOTA.Ft int
845acf51eaSKazutaka YOKOTA.Fn VGLKeyboardGetCh "void"
855acf51eaSKazutaka YOKOTA.Ft int
86b2e8bf35SAlexey Zelkin.Fn VGLMouseInit "int mode"
87b2e8bf35SAlexey Zelkin.Ft void
88b2e8bf35SAlexey Zelkin.Fn VGLMouseMode "int mode"
89b2e8bf35SAlexey Zelkin.Ft int
90b2e8bf35SAlexey Zelkin.Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
91b2e8bf35SAlexey Zelkin.Ft void
92b2e8bf35SAlexey Zelkin.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
93b2e8bf35SAlexey Zelkin.Ft void
94b2e8bf35SAlexey Zelkin.Fn VGLMouseSetStdImage "void"
95d3958121SBruce Evans.Ft u_long
964c9d1e54SAndrzej Bialecki.Fn VGLGetXY "VGLBitmap *object" "int x" "int y"
974c9d1e54SAndrzej Bialecki.Ft void
98d3958121SBruce Evans.Fn VGLSetXY "VGLBitmap *object" "int x" "int y" "u_long color"
99b2e8bf35SAlexey Zelkin.Ft void
100d3958121SBruce Evans.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
101b2e8bf35SAlexey Zelkin.Ft void
102d3958121SBruce Evans.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
103b2e8bf35SAlexey Zelkin.Ft void
104d3958121SBruce Evans.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "u_long color"
105b2e8bf35SAlexey Zelkin.Ft void
106d3958121SBruce Evans.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
107b2e8bf35SAlexey Zelkin.Ft void
108d3958121SBruce Evans.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "u_long color"
1095acf51eaSKazutaka YOKOTA.Ft VGLBitmap *
1105acf51eaSKazutaka YOKOTA.Fn VGLBitmapCreate "int type" "int xsize" "int ysize" "byte *bits"
1115acf51eaSKazutaka YOKOTA.Ft void
1125acf51eaSKazutaka YOKOTA.Fn VGLBitmapDestroy "VGLBitmap *object"
1135acf51eaSKazutaka YOKOTA.Ft int
1145acf51eaSKazutaka YOKOTA.Fn VGLBitmapAllocateBits "VGLBitmap *object"
115b2e8bf35SAlexey Zelkin.Ft int
116b2e8bf35SAlexey Zelkin.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
117b2e8bf35SAlexey Zelkin.Ft void
118dd31deb8SBruce Evans.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "u_long fgcol" "u_long bgcol" "int fill" "int dir"
119b2e8bf35SAlexey Zelkin.Ft void
120dd31deb8SBruce Evans.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "u_long fgcol" "u_long bgcol" "int fill" "int dir"
121b2e8bf35SAlexey Zelkin.Ft void
122d3958121SBruce Evans.Fn VGLClear "VGLBitmap *object" "u_long color"
123b2e8bf35SAlexey Zelkin.Ft void
124b2e8bf35SAlexey Zelkin.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
125b2e8bf35SAlexey Zelkin.Ft void
126b2e8bf35SAlexey Zelkin.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
127b2e8bf35SAlexey Zelkin.Ft void
128*31d09534SBruce Evans.Fn VGLSetBorder "byte color"
1295acf51eaSKazutaka YOKOTA.Ft int
1305acf51eaSKazutaka YOKOTA.Fn VGLSetVScreenSize "VGLBitmap *object" "int vxsize" "int vysize"
1315acf51eaSKazutaka YOKOTA.Ft int
132a0d660c2SBruce Evans.Fn VGLPanScreen "VGLBitmap *object" "int x" "int y"
133b2e8bf35SAlexey Zelkin.Ft void
134b2e8bf35SAlexey Zelkin.Fn VGLBlankDisplay "int blank"
1359a57b7d2SSøren Schmidt.Sh DESCRIPTION
136b2e8bf35SAlexey Zelkin.Nm Libvgl
137b2e8bf35SAlexey Zelkinis a library that enables the programmer access to the graphics
1381a0a9345SRuslan Ermilovmodes supported by the console driver (syscons).
1391a0a9345SRuslan ErmilovThe 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
189c12fc53cSJosef El-Rayesis specified, the keyboard translates 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
2021a0a9345SRuslan Ermilovread one byte from the keyboard.
2031a0a9345SRuslan ErmilovAs the keyboard I/O is in the
204fd6995f7SAlexey Zelkin.Dq raw
2055acf51eaSKazutaka YOKOTAinput mode, the function will not block even if there is no input data,
2065acf51eaSKazutaka YOKOTAand returns 0.
2075acf51eaSKazutaka YOKOTA.Pp
208b2e8bf35SAlexey Zelkin.Fn VGLMouseInit
209c6ff3a1bSSheldon Hearninitialize the mouse.
210c6ff3a1bSSheldon HearnThe optional on-screen mouse pointer is shown if the
2119a57b7d2SSøren Schmidtargument is
212fd6995f7SAlexey Zelkin.Dv VGL_MOUSESHOW .
213b2e8bf35SAlexey Zelkin.Pp
214b2e8bf35SAlexey Zelkin.Fn VGLMouseMode
215b2e8bf35SAlexey Zelkineither shows the mouse pointer if the argument is
216fd6995f7SAlexey Zelkin.Dv VGL_MOUSESHOW ,
217b2e8bf35SAlexey Zelkinor hides the mouse pointer if the argument is
218fd6995f7SAlexey Zelkin.Dv VGL_MOUSEHIDE .
219b2e8bf35SAlexey Zelkin.Pp
220b2e8bf35SAlexey Zelkin.Fn VGLMouseStatus
221b2e8bf35SAlexey Zelkinreturns the current mouse pointer coordinates and button state in
222fd6995f7SAlexey Zelkin.Va x , y ,
223c6ff3a1bSSheldon Hearnbuttons.
224c6ff3a1bSSheldon HearnThe return value reflects if the mouse pointer
2259a57b7d2SSøren Schmidtis currently shown on screen or not.
226b2e8bf35SAlexey Zelkin.Pp
227b2e8bf35SAlexey Zelkin.Fn VGLMouseSetImage
228b2e8bf35SAlexey Zelkinwith this function it is possible to change the image of the mouse pointer
2299a57b7d2SSøren Schmidton screen.
230b2e8bf35SAlexey Zelkin.Pp
231b2e8bf35SAlexey Zelkin.Fn VGLMouseSetStdImage
232b2e8bf35SAlexey Zelkinthis function restores the mouse pointer to the standard arrow.
233b2e8bf35SAlexey Zelkin.Pp
2344c9d1e54SAndrzej Bialecki.Fn VGLGetXY
2354c9d1e54SAndrzej Bialeckiretrieves the color of the pixel located at
236fd6995f7SAlexey Zelkin.Va x , y ,
2374c9d1e54SAndrzej Bialeckicoordinates of the
238fd6995f7SAlexey Zelkin.Va object
239dd31deb8SBruce Evansargument, and returns it as a u_long value.
2404c9d1e54SAndrzej Bialecki.Pp
2414c9d1e54SAndrzej Bialecki.Fn VGLSetXY
2424c9d1e54SAndrzej Bialeckisets the color of the pixel located at
243fd6995f7SAlexey Zelkin.Va x , y ,
2444c9d1e54SAndrzej Bialeckicoordinates of the
245fd6995f7SAlexey Zelkin.Va object
2464c9d1e54SAndrzej Bialeckiargument to
247fd6995f7SAlexey Zelkin.Va color
248dd31deb8SBruce Evansu_long value.
2494c9d1e54SAndrzej Bialecki.Pp
250b2e8bf35SAlexey Zelkin.Fn VGLLine
251b2e8bf35SAlexey Zelkindraw a line from
252fd6995f7SAlexey Zelkin.Va x1 , y1
2539a57b7d2SSøren Schmidtto
254fd6995f7SAlexey Zelkin.Va x2 , y2
2559a57b7d2SSøren Schmidtin color
256fd6995f7SAlexey Zelkin.Va color .
257b2e8bf35SAlexey Zelkin.Pp
258b2e8bf35SAlexey Zelkin.Fn VGLBox
259b2e8bf35SAlexey Zelkindraw a box with upper left hand corner at
260fd6995f7SAlexey Zelkin.Va x1 , y1
2619a57b7d2SSøren Schmidtand lower right hand corner at
262fd6995f7SAlexey Zelkin.Va x2 , y2
2639a57b7d2SSøren Schmidtin color
264fd6995f7SAlexey Zelkin.Va color .
265b2e8bf35SAlexey Zelkin.Pp
266b2e8bf35SAlexey Zelkin.Fn VGLFilledBox
267b2e8bf35SAlexey Zelkindraw a filled (solid) box with upper left hand corner at
268fd6995f7SAlexey Zelkin.Va x1 , y1
2699a57b7d2SSøren Schmidtand lower right hand corner at
270fd6995f7SAlexey Zelkin.Va x2 , y2
2719a57b7d2SSøren Schmidtin color
272fd6995f7SAlexey Zelkin.Va color .
273b2e8bf35SAlexey Zelkin.Pp
274b2e8bf35SAlexey Zelkin.Fn VGLEllipse
275b2e8bf35SAlexey Zelkindraw an ellipse centered at
276fd6995f7SAlexey Zelkin.Va xc , yc
2779a57b7d2SSøren Schmidtmake it
278fd6995f7SAlexey Zelkin.Va a
2799a57b7d2SSøren Schmidtpixels wide, and
280fd6995f7SAlexey Zelkin.Va b
2819a57b7d2SSøren Schmidtpixels high in color
282fd6995f7SAlexey Zelkin.Va color .
283b2e8bf35SAlexey Zelkin.Pp
284b2e8bf35SAlexey Zelkin.Fn VGLFilledEllipse
285b2e8bf35SAlexey Zelkindraw a filled (solid) ellipse centered at
286fd6995f7SAlexey Zelkin.Va xc , yc
2879a57b7d2SSøren Schmidtmake it
288fd6995f7SAlexey Zelkin.Va a
2899a57b7d2SSøren Schmidtpixels wide, and
290fd6995f7SAlexey Zelkin.Va b
2919a57b7d2SSøren Schmidtpixels high in color
292fd6995f7SAlexey Zelkin.Va color .
293b2e8bf35SAlexey Zelkin.Pp
2945acf51eaSKazutaka YOKOTA.Fn VGLBitmapCreate
2955acf51eaSKazutaka YOKOTAcreate a bitmap object and initialize it with the specified
2965acf51eaSKazutaka YOKOTAvalues and bit data.
297fd6995f7SAlexey Zelkin.Va type
2985acf51eaSKazutaka YOKOTAmust be
299fd6995f7SAlexey Zelkin.Dv MEMBUF
3005acf51eaSKazutaka YOKOTAfor the in-memory bitmap.
301fd6995f7SAlexey Zelkin.Va bits
3025acf51eaSKazutaka YOKOTAmay be NULL so that bitmap data may be associated later.
3035acf51eaSKazutaka YOKOTA.Pp
3045acf51eaSKazutaka YOKOTAThere also is a macro,
3055acf51eaSKazutaka YOKOTA.Fn VGLBITMAP_INITIALIZER "type" "xsize" "ysize" "bits"
3065acf51eaSKazutaka YOKOTAto initialize a statically declared bitmap object.
3075acf51eaSKazutaka YOKOTA.Pp
3085acf51eaSKazutaka YOKOTA.Fn VGLBitmapDestroy
3095acf51eaSKazutaka YOKOTAfree the bitmap data and the bitmap object.
3105acf51eaSKazutaka YOKOTA.Pp
3115acf51eaSKazutaka YOKOTA.Fn VGLBitmapAllocateBits
3125acf51eaSKazutaka YOKOTAallocate a bit data buffer for the specified object.
3135acf51eaSKazutaka YOKOTA.Pp
314b2e8bf35SAlexey Zelkin.Fn VGLBitmapCopy
315b2e8bf35SAlexey Zelkincopy a rectangle of pixels from bitmap
316fd6995f7SAlexey Zelkin.Va src
3179a57b7d2SSøren Schmidtupper left hand corner at
318fd6995f7SAlexey Zelkin.Va srcx , srcy
3199a57b7d2SSøren Schmidtto bitmap
320fd6995f7SAlexey Zelkin.Va dst
3219a57b7d2SSøren Schmidtat
322fd6995f7SAlexey Zelkin.Va dstx , dsty
3239a57b7d2SSøren Schmidtof the size
324fd6995f7SAlexey Zelkin.Va width , height .
325b2e8bf35SAlexey Zelkin.Pp
326b2e8bf35SAlexey Zelkin.Fn VGLBitmapPutChar
327b2e8bf35SAlexey Zelkinwrite the character
328fd6995f7SAlexey Zelkin.Va ch
3299a57b7d2SSøren Schmidtat position
330fd6995f7SAlexey Zelkin.Va x , y
3319a57b7d2SSøren Schmidtin foreground color
332fd6995f7SAlexey Zelkin.Va fgcol .
3339a57b7d2SSøren SchmidtIf
334fd6995f7SAlexey Zelkin.Va fill
3359a57b7d2SSøren Schmidtis != 0, use the color
336fd6995f7SAlexey Zelkin.Va bgcol
3379fb4ca06SSøren Schmidtas background otherwise the background is transparent.
3389a57b7d2SSøren SchmidtThe character is drawn in the direction specified by the argument
339fd6995f7SAlexey Zelkin.Va dir .
340b2e8bf35SAlexey Zelkin.Pp
341b2e8bf35SAlexey Zelkin.Fn VGLBitmapString
342b2e8bf35SAlexey Zelkinwrite the string
343fd6995f7SAlexey Zelkin.Va str
3449a57b7d2SSøren Schmidtat position
345fd6995f7SAlexey Zelkin.Va x , y
3469a57b7d2SSøren Schmidtin foreground color
347fd6995f7SAlexey Zelkin.Va fgcol .
3489a57b7d2SSøren SchmidtIf
349fd6995f7SAlexey Zelkin.Va fill
3509a57b7d2SSøren Schmidtis != 0, use the color
351fd6995f7SAlexey Zelkin.Va bgcol
352d877622aSJames Raynardas background otherwise the background is transparent.
3539a57b7d2SSøren SchmidtThe string is drawn in the direction specified by the argument
354fd6995f7SAlexey Zelkin.Va dir .
355b2e8bf35SAlexey Zelkin.Pp
356b2e8bf35SAlexey Zelkin.Fn VGLClear
357b2e8bf35SAlexey Zelkinclears the entire bitmap to color
358fd6995f7SAlexey Zelkin.Va color .
359b2e8bf35SAlexey Zelkin.Pp
360b2e8bf35SAlexey Zelkin.Fn VGLSetPalette
361b2e8bf35SAlexey Zelkinthis function sets the palette used, the arguments
362fd6995f7SAlexey Zelkin.Va red , green , blue
3639a57b7d2SSøren Schmidtshould point to byte arrays of 256 positions each.
364b2e8bf35SAlexey Zelkin.Pp
365b2e8bf35SAlexey Zelkin.Fn VGLSetPaletteIndex
366b2e8bf35SAlexey Zelkinset the palette index
367fd6995f7SAlexey Zelkin.Va color
3689a57b7d2SSøren Schmidtto the specified RGB value.
369b2e8bf35SAlexey Zelkin.Pp
370b2e8bf35SAlexey Zelkin.Fn VGLSetBorder
371b2e8bf35SAlexey Zelkinset the border color to color
372fd6995f7SAlexey Zelkin.Va color .
373b2e8bf35SAlexey Zelkin.Pp
3745acf51eaSKazutaka YOKOTA.Fn VGLSetVScreenSize
3751a0a9345SRuslan Ermilovchange the virtual screen size of the display.
3761a0a9345SRuslan ErmilovNote that this
3775acf51eaSKazutaka YOKOTAfunction must be called when our vty is in the foreground.
3785acf51eaSKazutaka YOKOTAAnd
379fd6995f7SAlexey Zelkin.Va object
3805acf51eaSKazutaka YOKOTAmust be
381fd6995f7SAlexey Zelkin.Va VGLDisplay .
3829d5abbddSJens SchweikhardtPassing an in-memory bitmap to this function results in error.
3835acf51eaSKazutaka YOKOTA.Pp
3845acf51eaSKazutaka YOKOTAThe desired virtual screen width may not be achievable because
3851a0a9345SRuslan Ermilovof the video card hardware.
3861a0a9345SRuslan ErmilovIn such case the video driver (and
3873102cfe2SGlen Barberunderlying video BIOS) may choose the next largest values.
3885acf51eaSKazutaka YOKOTAAlways examine
389fd6995f7SAlexey Zelkin.Va object->VXsize
3905acf51eaSKazutaka YOKOTAand
391fd6995f7SAlexey Zelkin.Va VYsize
3925acf51eaSKazutaka YOKOTAafter calling this function, in order to see how the virtual screen
3935acf51eaSKazutaka YOKOTAis actually set up.
3945acf51eaSKazutaka YOKOTA.Pp
3955acf51eaSKazutaka YOKOTAIn order to set up the largest possible virtual screen, you may
3965acf51eaSKazutaka YOKOTAcall this function with arbitrary large values.
3975acf51eaSKazutaka YOKOTA.Pp
3985acf51eaSKazutaka YOKOTA.Dl VGLSetVScreenSize(10000, 10000);
3995acf51eaSKazutaka YOKOTA.Pp
400e82b1777SMaxim Konovalov.Fn VGLPanScreen
4015acf51eaSKazutaka YOKOTAchange the origin of the displayed screen in the virtual screen.
4025acf51eaSKazutaka YOKOTANote that this function must be called when our vty is in the
4035acf51eaSKazutaka YOKOTAforeground.
404fd6995f7SAlexey Zelkin.Va object
4055acf51eaSKazutaka YOKOTAmust be
406fd6995f7SAlexey Zelkin.Va VGLDisplay .
4079d5abbddSJens SchweikhardtPassing an in-memory bitmap to this function results in error.
4085acf51eaSKazutaka YOKOTA.Pp
409b2e8bf35SAlexey Zelkin.Fn VGLBlankDisplay
410d0097656SRuslan Ermilovblank the display if the argument
411fd6995f7SAlexey Zelkin.Va blank
41294ba280cSRuslan Ermilov\*(Ne 0.
41394ba280cSRuslan ErmilovThis can be done to shut off the screen during display updates that
41436a142c4SRuslan Ermilovthe user should first see when it is done.
41571a9e563SKazutaka YOKOTA.Ss Program termination and signal processing
41671a9e563SKazutaka YOKOTAIt is important to call
41771a9e563SKazutaka YOKOTA.Fn VGLEnd
41871a9e563SKazutaka YOKOTAbefore terminating the program.
41971a9e563SKazutaka YOKOTACare must be taken if you install signal handlers and try to call
42071a9e563SKazutaka YOKOTA.Fn VGLEnd
42171a9e563SKazutaka YOKOTAand
42271a9e563SKazutaka YOKOTA.Xr exit 3
42371a9e563SKazutaka YOKOTAto end the program.
42471a9e563SKazutaka YOKOTAIf a signal is caught while the program is inside
42571a9e563SKazutaka YOKOTA.Nm libvgl
42671a9e563SKazutaka YOKOTAfunctions,
42771a9e563SKazutaka YOKOTA.Fn VGLEnd
42871a9e563SKazutaka YOKOTAmay not be able to properly restore the graphics hardware.
42971a9e563SKazutaka YOKOTA.Pp
43071a9e563SKazutaka YOKOTAThe recommended way to handle signals and program termination is to
4318155f5e2SKazutaka YOKOTAhave a flag to indicate signal's delivery.
4328155f5e2SKazutaka YOKOTAYour signal handlers set this flag but do not terminate
43371a9e563SKazutaka YOKOTAthe program immediately.
43471a9e563SKazutaka YOKOTAThe main part of the program checks the flag to see if it is
435d0097656SRuslan Ermilovsupposed to terminate, and calls
43671a9e563SKazutaka YOKOTA.Fn VGLEnd
43771a9e563SKazutaka YOKOTAand
43871a9e563SKazutaka YOKOTA.Xr exit 3
43971a9e563SKazutaka YOKOTAif the flag is set.
44071a9e563SKazutaka YOKOTA.Pp
44171a9e563SKazutaka YOKOTANote that
44271a9e563SKazutaka YOKOTA.Fn VGLInit
44371a9e563SKazutaka YOKOTAinstalls its internal signal handlers for
44471a9e563SKazutaka YOKOTA.Dv SIGINT , SIGTERM , SIGSEGV ,
44571a9e563SKazutaka YOKOTAand
44671a9e563SKazutaka YOKOTA.Dv SIGBUS ,
44771a9e563SKazutaka YOKOTAand terminates the program at appropriate time,
44871a9e563SKazutaka YOKOTAafter one of these signals is caught.
44971a9e563SKazutaka YOKOTAIf you want to have your own signal handlers for these signals,
4508155f5e2SKazutaka YOKOTAinstall handlers
45171a9e563SKazutaka YOKOTA.Em after
45271a9e563SKazutaka YOKOTA.Fn VGLInit .
45371a9e563SKazutaka YOKOTA.Pp
45471a9e563SKazutaka YOKOTA.Dv SIGUSR1
45571a9e563SKazutaka YOKOTAand
45671a9e563SKazutaka YOKOTA.Dv SIGUSR2
45771a9e563SKazutaka YOKOTAare internally used by
45871a9e563SKazutaka YOKOTA.Nm libvgl
45971a9e563SKazutaka YOKOTAto control screen switching and the mouse pointer,
46071a9e563SKazutaka YOKOTAand are not available to
46171a9e563SKazutaka YOKOTA.Nm libvgl
46271a9e563SKazutaka YOKOTAclient programs.
4639a57b7d2SSøren Schmidt.Sh HISTORY
4649a57b7d2SSøren SchmidtThe
465b2e8bf35SAlexey Zelkin.Nm vgl
466b2e8bf35SAlexey Zelkinlibrary appeared in
46781bddaa0SMike Pritchard.Fx 3.0 .
46824a0682cSRuslan Ermilov.Sh AUTHORS
4692b7af31cSBaptiste Daroussin.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org
470