Poster of Linux kernelThe best gift for a Linux geek
vga_ext_set

vga_ext_set

Section: Svgalib User Manual (3) Updated: 27 July 1997
Local index Up
 

NAME

vga_ext_set - set and query several extended features  

SYNOPSIS

#include <vga.h>

int vga_ext_set(unsigned what, ...);

 

DESCRIPTION

sets and several extended features. Before trying to call vga_ext_set() you should check if it is available in vga_getmodeinfo(3) for compatibility with old svgalib versions. In addition, the availability of certain features will depend on the current graphics mode.

However, the VGA_EXT_PAGE_OFFSET and VGA_EXT_FONT_SIZE features are features of the base module of svgalib and are always available if your version of svgalib supports them. Actually the result of vga_getmodeinfo(3) shows the availability of enhancements of vga_ext_set() in the given SVGA graphics mode. Hence, these base features may be supported even if svgalib does not admit it. Since version 1.2.13 you can check vga_getmodeinfo(TEXT) to see if basic vga_ext_set() functionality is available. The VGA_EXT_PAGE_OFFSET and VGA_EXT_FONT_SIZE calls are then available in any mode even if vga_getmodeinfo(3) states that you should not call vga_ext_set() at all.

As of now, the following calls are defined:  

Query availability of features

vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_SET)
returns an int with the i-th bit set if i is a valid what parameter for vga_ext_set().
vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ACCEL)
returns an integer with the i-th bit set if i is a valid what parameter for vga_accel(3). For nicer code, the following integers are predefined to have a bit set in the right position:

ACCELFLAG_FILLBOX, ACCELFLAG_SCREENCOPY, ACCELFLAG_PUTIMAGE, ACCELFLAG_DRAWLINE, ACCELFLAG_SETFGCOLOR, ACCELFLAG_SETBGCOLOR, ACCELFLAG_SETTRANSPARENCY, ACCELFLAG_SETRASTEROP, ACCELFLAG_PUTBITMAP, ACCELFLAG_SCREENCOPYBITMAP, ACCELFLAG_DRAWHLINELIST, ACCELFLAG_SETMODE, and ACCELFLAG_SYNC.

vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ROP)
returns an integer as VGA_AVAIL_ACCEL does, but this time listing the vga_accel(3) operations which obey a vga_accel(ACCEL_SETRASTEROP, ...) setting.
vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_TRANSPARENCY)
returns an integer as VGA_AVAIL_ACCEL does, but this time listing the vga_accel(3) operations which obey a vga_accel(ACCEL_SETTRANSPARENCY, ...) setting.
vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ROPMODES)
returns an integer with the i-th bit set if i is a valid mode parameter for a vga_accel(ACCEL_SETRASTEROP, mode) call. For example:

if (vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ROPMODES) & (1 << ROP_XOR))
vga_accel(ACCEL_SETRASTEROP, ROP_XOR);
else
/* do something else */

vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_TRANSMODES)
returns an integer with the i-th bit set if i is a valid mode parameter for a vga_accel(ACCEL_SETTRANSPARENCY, mode, ...) call. The function lists only the supported enable functions (currently ENABLE_TRANSPARENCY_COLOR and ENABLE_BITMAP_TRANSPARENCY). It is assumed the corresponding disable functions will then exist as well.
vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_FLAGS)
returns an int with one bit on/off flags. Bits that are set are supported refer to special features which can be enabled in the current mode.

 

Operations with one bit flags

A certain mode might have a special feature which can be turned on or off by the applications. These functions allow to handle such features.

You can always set flags, and their settings are remembered if not supported in the current mode. This is to avoid problems when switching VC's.

vga_ext_set(VGA_EXT_SET, int bitflags)
set all flags that are set in bitflags, do not touch any other flags. Returns previous setting of all flags.
vga_ext_set(VGA_EXT_CLEAR, int bitflags)
clear all flags that are set in bitflags, do not touch any other flags. Returns previous setting of all flags.
vga_ext_set(VGA_EXT_RESET, int bitflags)
set all flags to the corresponding bits of bitflags. Returns previous setting of all flags.

 

One bit flags for special features

As of now, we only support
VGA_CLUT8
which is set by calling vga_ext_set(VGA_EXT_SET, VGA_CLUT8). This makes the color lookup table for 16 and 256 color lookup table modes work with 8 bit per red, green, blue part instead of the ordinary 6 bits.

As of now this feature is only availabl for Mach32 cards with type 2 DAC's. 8 bit per red, green, blue wide in all (even VGA) 256 color modes. This mean, however, that all calls to vga_setpalette(3) and vga_setpalvec(3) need to be adjuste accordingly as well as that the interpretation of the return values of vga_getpalette(3) and vga_getpalvec(3) changes.

The testaccel(6) demos makes use of this to show a smooth 256 blue shades scale.

 

Miscanellous features

vga_ext_set(VGA_EXT_PAGE_OFFSET, int offset)
for all following vga_set*page(n) calls (even those implicitly done by svgalib drawing functions) do vga_set*page(n + offset) instead. This is very nice for drawing in an offscreen area. However, it requires the mode being able to use more than one page at all as well as not having called vga_setlinearaddressing(3).

A better approach would be to just use higher y values for all draw operations to have them end up in offscreen regions that may be displayed later (cf. vga_setdisplaystart(3)).

The previously set value for VGA_EXT_PAGE_OFFSET (which defaults to 0 at startup) is returned.

vga_ext_set(VGA_EXT_FONT_SIZE, int size)
sets the size of the buffer which the application passes to vga_gettextfont(3) and vga_puttextfont(3). Old versions of svgalib used a fixed size of 8192 which is still the default. Newer versions of svgalib use a larger size internally to properly support the extended font capabilities of newer kernels.

Calling vga_ext_set(VGA_EXT_FONT_SIZE, 0) returns the size of the internal buffers of svgalib. It is recommended to use this (or a larger size) for any font (re)storing application. If this differs from the size of the applications buffers set vga_gettextfont(3) and vga_puttextfont(3) truncate and zero-pad all buffers accordingly.

Otherwise the previously set buffer size is returned.

 

SEE ALSO

svgalib(7), vgagl(7), libvga.config(5), accel(6), testaccel(6), vga_setpalette(3), vga_setpalvec(3), vga_getpalette(3), vga_getpalvec(3), vga_setlinearaddressing(3), vga_setdisplaystart(3), vga_setpage(3), vga_setreadpage(3), vga_setwritepage(3), vga_gettextfont(3), vga_puttextfont(3).

 

AUTHOR

This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The exact source of the referenced function as well as of the original documentation is unknown.

It is very likely that both are at least to some extent are due to Harm Hanemaayer <H.Hanemaayer@inter.nl.net>.

Occasionally this might be wrong. I hereby asked to be excused by the original author and will happily accept any additions or corrections to this first version of the svgalib manual.


 

Index

NAME
SYNOPSIS
DESCRIPTION
Query availability of features
Operations with one bit flags
One bit flags for special features
Miscanellous features
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:58:05 GMT, April 16, 2011