vgagl - a fast framebuffer-level graphics library based on svgalib
TABLE OF CONTENTS
1. How to use vgagl
2. Description of vgagl functions
3. Macros defined in vgagl.h
This is a fast framebuffer-level graphics library for linear 1, 2, 3 and 4
byte-per-pixel modes (256-color, hicolor, truecolor). It uses a limited
number of functions from svgalib (libvga) for low-level hardware
communication (the library is included in the svgalib shared image).
maps the 64K VGA frame buffer window, and this library
directly addresses the buffer. For SVGA modes that use more than 64K of
screen memory, SVGA paging is required when writing to the physical screen;
this is done automatically for most functions (at a certain cost).
Alternatively, any number of virtual screens of any type in system memory can
be used, which can then be copied to the physical screen. There is also
support for 4 bytes per pixel framebuffers (and copying them to a 3 bytes per
pixel context), and limited planar 256 color mode support (copyscreen,
The planar 256 color modes (available on all VGA cards) can now be used
with a virtual screen, which is copied to the physical screen (with optional
Bitmaps are raw, with one (or more) bytes per pixel (like pixmaps in X),
stored in row-major order. They are usually manipulated with the getbox
and putbox functions.
does also make use of the graphic cards accelerator
(if it is supported)
in some situations.
A graphics context is just a structure that holds the size of the associated
graphics screen, how it is organized, clipping status etc. You can define a
custom virtual (system memory) graphics context of any size with the
setcontextvirtual function. All operations work on the current context.
Any questions, bug-reports, additions, suggestions etc. are welcome.
1. HOW TO USE VGAGL
Programs that use
Linking must be done with
Functions in the
library have the prefix
the graphics context must be set. Example:
The width in pixels of the current graphics context.
Height in pixels.
Number of bytes per pixel (1, 2, 3 or 4).
Width of a scanline in bytes.
Number of colors.
Number of significant color bits.
Address of the framebuffer.
Top-left corner of clipping window.
Bottom-right corner of clipping window.
For three bytes per pixel (true color) modes, it is possible that
pixels cross a SVGA segment boundary. This should be correctly
handledby most functions, but you never know. It can be avoided by using a logical
scanline length that is a divisor of 65536 (a power of 2), like 1024
(as opposed to 960) for 320x200 and 2048 (1920) for 640x480. For
800x600, this is impractical (4096 as opposed to 2400 doesn't fit in
2MB). Alternatively, avoid those functions by using a virtual screen.