vgl.3 (7f3dea244c40159a41ab22da77a434d7c5b5e85a) vgl.3 (b2e8bf35bd1760d0ddec12b6d84088d2682e3e2b)
1.\" Copyright (c) 1997 S�ren Schmidt
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer,

--- 11 unchanged lines hidden (view full) ---

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.
26.\"
27.\" $FreeBSD$
1.\" Copyright (c) 1997 S�ren Schmidt
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer,

--- 11 unchanged lines hidden (view full) ---

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.
26.\"
27.\" $FreeBSD$
28
29.Dd August 13, 1997
28.Dd October 28, 1999
30.Dt VGL 3
29.Dt VGL 3
31.Os FreeBSD 3
30.Os FreeBSD 3.0
32.Sh NAME
31.Sh NAME
33.Nm vgl
34.Nd Video Graphics Library functions
32.Nm VGLBitmapCopy ,
33.Nm VGLBitmapPutChar ,
34.Nm VGLBitmapString ,
35.Nm VGLBlankDisplay ,
36.Nm VGLBox ,
37.Nm VGLCheckSwitch ,
38.Nm VGLClear ,
39.Nm VGLEllipse ,
40.Nm VGLEnd ,
41.Nm VGLFilledBox ,
42.Nm VGLFilledEllipse ,
43.Nm VGLInit ,
44.Nm VGLLine ,
45.Nm VGLMouseInit ,
46.Nm VGLMouseMode ,
47.Nm VGLMouseSetImage ,
48.Nm VGLMouseSetStdImage ,
49.Nm VGLMouseStatus ,
50.Nm VGLSetBorder ,
51.Nm VGLSetPalette ,
52.Nm VGLSetPaletteIndex ,
53.Nm VGLTextSetFontFile
54.Nd Video Graphics Library functions (libvgl)
35.Sh SYNOPSIS
36.Fd #include <vgl.h>
55.Sh SYNOPSIS
56.Fd #include <vgl.h>
37
57.Ft int
58.Fn VGLInit "int mode"
59.Ft void
60.Fn VGLEnd "void"
61.Ft void
62.Fn VGLCheckSwitch "void"
63.Ft int
64.Fn VGLTextSetFontFile "char *filename"
65.Ft int
66.Fn VGLMouseInit "int mode"
67.Ft void
68.Fn VGLMouseMode "int mode"
69.Ft int
70.Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
71.Ft void
72.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
73.Ft void
74.Fn VGLMouseSetStdImage "void"
75.Ft void
76.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
77.Ft void
78.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
79.Ft void
80.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
81.Ft void
82.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
83.Ft void
84.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
85.Ft int
86.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
87.Ft void
88.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
89.Ft void
90.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
91.Ft void
92.Fn VGLClear "VGLBitmap *object" "byte color"
93.Ft void
94.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
95.Ft void
96.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
97.Ft void
98.Fn VGLSetBorder "byte color"
99.Ft void
100.Fn VGLBlankDisplay "int blank"
38.Sh DESCRIPTION
101.Sh DESCRIPTION
39Libvgl is a library that enables the programmer access to the graphics
102.Nm Libvgl
103is a library that enables the programmer access to the graphics
40modes supported by the console driver (syscons). The library takes care of
41programming the actual video hardware, and provides a number of simple
42functions to do various graphic operations. There is also support for a
104modes supported by the console driver (syscons). The library takes care of
105programming the actual video hardware, and provides a number of simple
106functions to do various graphic operations. There is also support for a
43mouse via the standard mouse system in FreeBSD, see
44.Fn moused
45, including the ability to transparently have a mouse pointer superimposed on
107mouse via the standard mouse system in
108.Fx ,
109see
110.Xr mouse 4 ,
111including the ability to transparently have a mouse pointer superimposed on
46the graphic image currently being worked on.
47The library takes care of screen switching by storing the current image in
48memory before switching to another virtual console, and restoring when the
49user switches back. This allows several graphic applications at once, but
50on different virtual consoles.
51
52Below is a short description of the various functions:
112the graphic image currently being worked on.
113The library takes care of screen switching by storing the current image in
114memory before switching to another virtual console, and restoring when the
115user switches back. This allows several graphic applications at once, but
116on different virtual consoles.
117
118Below is a short description of the various functions:
53
54.Sh AUTHORS
55.An S�ren Schmidt Aq sos@FreeBSD.org
56
57.Sh FUNCTIONS
58
59.Ft int
60.Fn VGLInit "int mode"
61
62Initialize the library and set up the graphic mode
119.Pp
120.Fn VGLInit
121initialize the library and set up the graphic mode
63.Em mode .
122.Em mode .
64
65
66.Ft void
67.Fn VGLEnd "void"
68
69Terminate graphic mode, and restore the screenmode that was active before
123.Pp
124.Fn VGLEnd
125terminate graphic mode, and restore the screenmode that was active before
70.Fn VGLInit
71was called.
126.Fn VGLInit
127was called.
72
73
74.Ft void
75.Fn VGLCheckSwitch "void"
76
77If the program goes into longer periods of processing without doing
128.Pp
129.Fn VGLCheckSwitch
130if the program goes into longer periods of processing without doing
78any graphics output, calling this function occasionally will allow
79the system to switch screens.
131any graphics output, calling this function occasionally will allow
132the system to switch screens.
80
81
82.Ft int
83.Fn VGLTextSetFontFile "char *filename"
84
85Instruct the char/string functions to use the font in file
133.Pp
134.Fn VGLTextSetFontFile
135instruct the char/string functions to use the font in file
86.Em filename
87instead of the builtin font.
136.Em filename
137instead of the builtin font.
88
89
90.Ft int
91.Fn VGLMouseInit "int mode"
92
93Initialize the mouse. The optional on-screen mouse pointer is shown if the
138.Pp
139.Fn VGLMouseInit
140initialize the mouse. The optional on-screen mouse pointer is shown if the
94argument is
95.Em VGL_MOUSESHOW .
141argument is
142.Em VGL_MOUSESHOW .
96
97
98.Ft void
99.Fn VGLMouseMode "int mode"
100
101Either shows the mouse pointer if the argument is
102.Em VGL_MOUSESHOW
103, or hides the mouse pointer if the argument is
143.Pp
144.Fn VGLMouseMode
145either shows the mouse pointer if the argument is
146.Em VGL_MOUSESHOW ,
147or hides the mouse pointer if the argument is
104.Em VGL_MOUSEHIDE .
148.Em VGL_MOUSEHIDE .
105
106
107.Ft int
108.Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
109
110Returns the current mouse pointer coordinates and button state in
111.Em x, y
112, buttons. The return value reflects if the mouse pointer
149.Pp
150.Fn VGLMouseStatus
151returns the current mouse pointer coordinates and button state in
152.Em x , y ,
153buttons. The return value reflects if the mouse pointer
113is currently shown on screen or not.
154is currently shown on screen or not.
114
115
116.Ft void
117.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
118
119With this function it is possible to change the image of the mouse pointer
155.Pp
156.Fn VGLMouseSetImage
157with this function it is possible to change the image of the mouse pointer
120on screen.
158on screen.
121
122
123.Ft void
124.Fn VGLMouseSetStdImage "void"
125
126This function restores the mouse pointer to the standard arrow.
127
128
129.Ft void
130.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
131
132Draw a line from
133.Em x1, y1
159.Pp
160.Fn VGLMouseSetStdImage
161this function restores the mouse pointer to the standard arrow.
162.Pp
163.Fn VGLLine
164draw a line from
165.Em x1 , y1
134to
166to
135.Em x2, y2
167.Em x2 , y2
136in color
137.Em color .
168in color
169.Em color .
138
139
140.Ft void
141.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
142
143Draw a box with upper left hand corner at
144.Em x1, y1
170.Pp
171.Fn VGLBox
172draw a box with upper left hand corner at
173.Em x1 , y1
145and lower right hand corner at
174and lower right hand corner at
146.Em x2, y2
175.Em x2 , y2
147in color
148.Em color .
176in color
177.Em color .
149
150
151.Ft void
152.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
153
154Draw a filled (solid) box with upper left hand corner at
155.Em x1, y1
178.Pp
179.Fn VGLFilledBox
180draw a filled (solid) box with upper left hand corner at
181.Em x1 , y1
156and lower right hand corner at
182and lower right hand corner at
157.Em x2, y2
183.Em x2 , y2
158in color
159.Em color .
184in color
185.Em color .
160
161
162.Ft void
163.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
164
165Draw an ellipse centered at
166.Em xc, yc
186.Pp
187.Fn VGLEllipse
188draw an ellipse centered at
189.Em xc , yc
167make it
168.Em a
169pixels wide, and
170.Em b
171pixels high in color
172.Em color .
190make it
191.Em a
192pixels wide, and
193.Em b
194pixels high in color
195.Em color .
173
174
175.Ft void
176.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
177
178Draw a filled (solid) ellipse centered at
179.Em xc, yc
196.Pp
197.Fn VGLFilledEllipse
198draw a filled (solid) ellipse centered at
199.Em xc , yc
180make it
181.Em a
182pixels wide, and
183.Em b
184pixels high in color
185.Em color .
200make it
201.Em a
202pixels wide, and
203.Em b
204pixels high in color
205.Em color .
186
187
188.Ft int
189.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
190
191Copy a rectangle of pixels from bitmap
206.Pp
207.Fn VGLBitmapCopy
208copy a rectangle of pixels from bitmap
192.Em src
193upper left hand corner at
209.Em src
210upper left hand corner at
194.Em srcx, srcy
211.Em srcx , srcy
195to bitmap
196.Em dst
197at
212to bitmap
213.Em dst
214at
198.Em dstx, dsty
215.Em dstx , dsty
199of the size
216of the size
200.Em width, height .
201
202
203.Ft void
204.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
205
206Write the character
217.Em width , height .
218.Pp
219.Fn VGLBitmapPutChar
220write the character
207.Em ch
208at position
221.Em ch
222at position
209.Em x, y
223.Em x , y
210in foreground color
224in foreground color
211.Em fgcol.
225.Em fgcol .
212If
213.Em fill
214is != 0, use the color
215.Em bgcol
216as background otherwise the background is transparent.
217The character is drawn in the direction specified by the argument
218.Em dir .
226If
227.Em fill
228is != 0, use the color
229.Em bgcol
230as background otherwise the background is transparent.
231The character is drawn in the direction specified by the argument
232.Em dir .
219
220
221.Ft void
222.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
223
224Write the string
233.Pp
234.Fn VGLBitmapString
235write the string
225.Em str
226at position
236.Em str
237at position
227.Em x, y
238.Em x , y
228in foreground color
239in foreground color
229.Em fgcol.
240.Em fgcol .
230If
231.Em fill
232is != 0, use the color
233.Em bgcol
234as background otherwise the background is transparent.
235The string is drawn in the direction specified by the argument
236.Em dir .
241If
242.Em fill
243is != 0, use the color
244.Em bgcol
245as background otherwise the background is transparent.
246The string is drawn in the direction specified by the argument
247.Em dir .
237
238.Ft void
239.Fn VGLClear "VGLBitmap *object" "byte color"
240
241Clears the entire bitmap to color
248.Pp
249.Fn VGLClear
250clears the entire bitmap to color
242.Em color .
251.Em color .
243
244
245.Ft void
246.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
247
248This function sets the palette used, the arguments
249.Em red, green, blue
252.Pp
253.Fn VGLSetPalette
254this function sets the palette used, the arguments
255.Em red , green , blue
250should point to byte arrays of 256 positions each.
256should point to byte arrays of 256 positions each.
251
252
253.Ft void
254.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
255
256Set the palette index
257.Pp
258.Fn VGLSetPaletteIndex
259set the palette index
257.Em color
258to the specified RGB value.
260.Em color
261to the specified RGB value.
259
260
261.Ft void
262.Fn VGLSetBorder "byte color"
263
264Set the border color to color
262.Pp
263.Fn VGLSetBorder
264set the border color to color
265.Em color .
265.Em color .
266
267
268.Ft void
269.Fn VGLBlankDisplay "int blank"
270
271Blank the display if the argment
266.Pp
267.Fn VGLBlankDisplay
268blank the display if the argment
272.Em blank
273!= 0. This can be done to shut off the screen during display updates that
274the user should first see when it's done.
269.Em blank
270!= 0. This can be done to shut off the screen during display updates that
271the user should first see when it's done.
275
276
272.Sh AUTHORS
273.An S�ren Schmidt Aq sos@FreeBSD.org
277.Sh HISTORY
278The
274.Sh HISTORY
275The
279.Nm
280library appeared in FreeBSD 3.0
276.Nm vgl
277library appeared in
278.Fx 3.0