1997-08-17 21:09:35 +00:00
|
|
|
|
.\" Copyright (c) 1997 S<>ren Schmidt
|
|
|
|
|
.\" All rights reserved.
|
|
|
|
|
.\"
|
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
|
.\" are met:
|
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer,
|
|
|
|
|
.\" in this position and unchanged.
|
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
.\" derived from this software withough specific prior written permission.
|
|
|
|
|
.\"
|
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
|
.\" $FreeBSD$
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Dd October 28, 1999
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Dt VGL 3
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Os FreeBSD 3.0
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Sh NAME
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Nm VGLBitmapCopy ,
|
|
|
|
|
.Nm VGLBitmapPutChar ,
|
|
|
|
|
.Nm VGLBitmapString ,
|
|
|
|
|
.Nm VGLBlankDisplay ,
|
|
|
|
|
.Nm VGLBox ,
|
|
|
|
|
.Nm VGLCheckSwitch ,
|
|
|
|
|
.Nm VGLClear ,
|
|
|
|
|
.Nm VGLEllipse ,
|
|
|
|
|
.Nm VGLEnd ,
|
|
|
|
|
.Nm VGLFilledBox ,
|
|
|
|
|
.Nm VGLFilledEllipse ,
|
|
|
|
|
.Nm VGLInit ,
|
|
|
|
|
.Nm VGLLine ,
|
|
|
|
|
.Nm VGLMouseInit ,
|
|
|
|
|
.Nm VGLMouseMode ,
|
|
|
|
|
.Nm VGLMouseSetImage ,
|
|
|
|
|
.Nm VGLMouseSetStdImage ,
|
|
|
|
|
.Nm VGLMouseStatus ,
|
|
|
|
|
.Nm VGLSetBorder ,
|
|
|
|
|
.Nm VGLSetPalette ,
|
|
|
|
|
.Nm VGLSetPaletteIndex ,
|
|
|
|
|
.Nm VGLTextSetFontFile
|
|
|
|
|
.Nd Video Graphics Library functions (libvgl)
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
|
.Fd #include <vgl.h>
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Ft int
|
|
|
|
|
.Fn VGLInit "int mode"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLEnd "void"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLCheckSwitch "void"
|
|
|
|
|
.Ft int
|
|
|
|
|
.Fn VGLTextSetFontFile "char *filename"
|
|
|
|
|
.Ft int
|
|
|
|
|
.Fn VGLMouseInit "int mode"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLMouseMode "int mode"
|
|
|
|
|
.Ft int
|
|
|
|
|
.Fn VGLMouseStatus "int *x" "int *y" "char *buttons"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLMouseSetImage "VGLBitmap *AndMask" "VGLBitmap *OrMask"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLMouseSetStdImage "void"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLLine "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLFilledBox "VGLBitmap *object" "int x1" "int y1" "int x2" "int y2" "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLFilledEllipse "VGLBitmap *object" "int xc" "int yc" "int a" "int b" "byte color"
|
|
|
|
|
.Ft int
|
|
|
|
|
.Fn VGLBitmapCopy "VGLBitmap *src" "int srcx" "int srcy" "VGLBitmap *dst" "int dstx" "int dsty" "int width" "int hight"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLBitmapPutChar "VGLBitmap *Object" "int x" "int y" "byte ch" "byte fgcol" "byte bgcol" "int fill" "int dir"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLBitmapString "VGLBitmap *Object" "int x" "int y" "char *str" "byte fgcol" "byte bgcol" "int fill" "int dir"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLClear "VGLBitmap *object" "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLSetPalette "byte *red" "byte *green" "byte *blue"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLSetPaletteIndex "byte color" "byte red" "byte green" "byte blue"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLSetBorder "byte color"
|
|
|
|
|
.Ft void
|
|
|
|
|
.Fn VGLBlankDisplay "int blank"
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Sh DESCRIPTION
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Nm Libvgl
|
|
|
|
|
is a library that enables the programmer access to the graphics
|
1997-08-17 21:09:35 +00:00
|
|
|
|
modes supported by the console driver (syscons). The library takes care of
|
|
|
|
|
programming the actual video hardware, and provides a number of simple
|
|
|
|
|
functions to do various graphic operations. There is also support for a
|
1999-10-28 15:51:50 +00:00
|
|
|
|
mouse via the standard mouse system in
|
|
|
|
|
.Fx ,
|
|
|
|
|
see
|
|
|
|
|
.Xr mouse 4 ,
|
|
|
|
|
including the ability to transparently have a mouse pointer superimposed on
|
1997-08-17 21:09:35 +00:00
|
|
|
|
the graphic image currently being worked on.
|
1997-10-22 23:12:27 +00:00
|
|
|
|
The library takes care of screen switching by storing the current image in
|
|
|
|
|
memory before switching to another virtual console, and restoring when the
|
1997-08-17 21:09:35 +00:00
|
|
|
|
user switches back. This allows several graphic applications at once, but
|
|
|
|
|
on different virtual consoles.
|
|
|
|
|
|
|
|
|
|
Below is a short description of the various functions:
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLInit
|
|
|
|
|
initialize the library and set up the graphic mode
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em mode .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLEnd
|
|
|
|
|
terminate graphic mode, and restore the screenmode that was active before
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Fn VGLInit
|
|
|
|
|
was called.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLCheckSwitch
|
|
|
|
|
if the program goes into longer periods of processing without doing
|
1997-08-17 21:09:35 +00:00
|
|
|
|
any graphics output, calling this function occasionally will allow
|
|
|
|
|
the system to switch screens.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLTextSetFontFile
|
|
|
|
|
instruct the char/string functions to use the font in file
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em filename
|
1997-10-22 23:12:27 +00:00
|
|
|
|
instead of the builtin font.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLMouseInit
|
|
|
|
|
initialize the mouse. The optional on-screen mouse pointer is shown if the
|
1997-08-17 21:09:35 +00:00
|
|
|
|
argument is
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em VGL_MOUSESHOW .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLMouseMode
|
|
|
|
|
either shows the mouse pointer if the argument is
|
|
|
|
|
.Em VGL_MOUSESHOW ,
|
|
|
|
|
or hides the mouse pointer if the argument is
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em VGL_MOUSEHIDE .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLMouseStatus
|
|
|
|
|
returns the current mouse pointer coordinates and button state in
|
|
|
|
|
.Em x , y ,
|
|
|
|
|
buttons. The return value reflects if the mouse pointer
|
1997-08-17 21:09:35 +00:00
|
|
|
|
is currently shown on screen or not.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLMouseSetImage
|
|
|
|
|
with this function it is possible to change the image of the mouse pointer
|
1997-08-17 21:09:35 +00:00
|
|
|
|
on screen.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLMouseSetStdImage
|
|
|
|
|
this function restores the mouse pointer to the standard arrow.
|
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLLine
|
|
|
|
|
draw a line from
|
|
|
|
|
.Em x1 , y1
|
1997-08-17 21:09:35 +00:00
|
|
|
|
to
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em x2 , y2
|
1997-08-17 21:09:35 +00:00
|
|
|
|
in color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLBox
|
|
|
|
|
draw a box with upper left hand corner at
|
|
|
|
|
.Em x1 , y1
|
1997-08-17 21:09:35 +00:00
|
|
|
|
and lower right hand corner at
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em x2 , y2
|
1997-08-17 21:09:35 +00:00
|
|
|
|
in color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLFilledBox
|
|
|
|
|
draw a filled (solid) box with upper left hand corner at
|
|
|
|
|
.Em x1 , y1
|
1997-08-17 21:09:35 +00:00
|
|
|
|
and lower right hand corner at
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em x2 , y2
|
1997-08-17 21:09:35 +00:00
|
|
|
|
in color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLEllipse
|
|
|
|
|
draw an ellipse centered at
|
|
|
|
|
.Em xc , yc
|
1997-08-17 21:09:35 +00:00
|
|
|
|
make it
|
|
|
|
|
.Em a
|
|
|
|
|
pixels wide, and
|
|
|
|
|
.Em b
|
|
|
|
|
pixels high in color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLFilledEllipse
|
|
|
|
|
draw a filled (solid) ellipse centered at
|
|
|
|
|
.Em xc , yc
|
1997-08-17 21:09:35 +00:00
|
|
|
|
make it
|
|
|
|
|
.Em a
|
|
|
|
|
pixels wide, and
|
|
|
|
|
.Em b
|
|
|
|
|
pixels high in color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLBitmapCopy
|
|
|
|
|
copy a rectangle of pixels from bitmap
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em src
|
1997-10-22 23:12:27 +00:00
|
|
|
|
upper left hand corner at
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em srcx , srcy
|
1997-08-17 21:09:35 +00:00
|
|
|
|
to bitmap
|
|
|
|
|
.Em dst
|
|
|
|
|
at
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em dstx , dsty
|
1997-08-17 21:09:35 +00:00
|
|
|
|
of the size
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em width , height .
|
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLBitmapPutChar
|
|
|
|
|
write the character
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em ch
|
|
|
|
|
at position
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em x , y
|
1997-10-22 23:12:27 +00:00
|
|
|
|
in foreground color
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em fgcol .
|
1997-08-17 21:09:35 +00:00
|
|
|
|
If
|
|
|
|
|
.Em fill
|
|
|
|
|
is != 0, use the color
|
|
|
|
|
.Em bgcol
|
1997-10-16 09:12:31 +00:00
|
|
|
|
as background otherwise the background is transparent.
|
1997-08-17 21:09:35 +00:00
|
|
|
|
The character is drawn in the direction specified by the argument
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em dir .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLBitmapString
|
|
|
|
|
write the string
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em str
|
|
|
|
|
at position
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em x , y
|
1997-10-22 23:12:27 +00:00
|
|
|
|
in foreground color
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Em fgcol .
|
1997-08-17 21:09:35 +00:00
|
|
|
|
If
|
|
|
|
|
.Em fill
|
|
|
|
|
is != 0, use the color
|
|
|
|
|
.Em bgcol
|
1997-10-22 23:12:27 +00:00
|
|
|
|
as background otherwise the background is transparent.
|
1997-08-17 21:09:35 +00:00
|
|
|
|
The string is drawn in the direction specified by the argument
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em dir .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLClear
|
|
|
|
|
clears the entire bitmap to color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLSetPalette
|
|
|
|
|
this function sets the palette used, the arguments
|
|
|
|
|
.Em red , green , blue
|
1997-08-17 21:09:35 +00:00
|
|
|
|
should point to byte arrays of 256 positions each.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLSetPaletteIndex
|
|
|
|
|
set the palette index
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em color
|
|
|
|
|
to the specified RGB value.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLSetBorder
|
|
|
|
|
set the border color to color
|
1997-10-22 23:12:27 +00:00
|
|
|
|
.Em color .
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Pp
|
|
|
|
|
.Fn VGLBlankDisplay
|
|
|
|
|
blank the display if the argment
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Em blank
|
1997-10-22 23:12:27 +00:00
|
|
|
|
!= 0. This can be done to shut off the screen during display updates that
|
|
|
|
|
the user should first see when it's done.
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Sh AUTHORS
|
|
|
|
|
.An S<EFBFBD>ren Schmidt Aq sos@FreeBSD.org
|
1997-08-17 21:09:35 +00:00
|
|
|
|
.Sh HISTORY
|
|
|
|
|
The
|
1999-10-28 15:51:50 +00:00
|
|
|
|
.Nm vgl
|
|
|
|
|
library appeared in
|
1999-10-30 19:29:45 +00:00
|
|
|
|
.Fx 3.0 .
|