A.10 High-Resolution VBE/AF Graphics Functions

A.10.1 LoadGraphicsDriver()

Usage

bool LoadGraphicsDriver(char *Filename);

Purpose

Loads and initializes the specified VBE/AF graphics driver.

Inputs

Filename, full pathname of the driver to load.

Outputs

Returns 1 on error, 0 on success.

Notes

It is not necessary to call this function except when a custom driver needs to be loaded. InitGraphics() calls this function internally to find a driver if one has not already been loaded.

A.10.2 InitGraphics()

Usage

bool InitGraphics(char *kbINT, char *kbIRQ, unsigned short *kbPort);

Purpose

Initializes VBE/AF graphics system, loading a driver if necessary.

Inputs

None

Outputs

kbINT, keyboard interrupt (e.g. 9).

kbIRQ, keyboard IRQ (e.g. 1).

kbPort, keyboard I/O port (e.g. 60h).

Returns 1 on error, 0 on success.

Notes

If no VBE/AF keyboard extension is provided by the loaded VBE/AF driver, the kbINT, kbIRQ, and kbPort values are set to the "standard" keyboard settings of 9, 1, and 60h respectively.

Some outputs are passed as parameters; pass the address of a variable, and after a successful call, the variable will be filled with the output information.

A.10.3 ExitGraphics()

Usage

void ExitGraphics(void);

Purpose

Shuts down graphics driver.

Inputs

None

Outputs

None

A.10.4 FindGraphicsMode()

Usage

short FindGraphicsMode(short Width, short Height, short Depth, bool Emulated);

Purpose

Tries to find a graphics mode matching the desired settings.

Inputs

Width, width of desired mode resolution, in pixels.

Height, height of desired mode resolution, in pixels.

Depth, bits per pixel of desired mode (8, 16, 24, 32).

Emulated, include driver-emulated modes (only matters for EX291 driver)? (1=Yes, 0=No).

Outputs

Returns the mode number, or -1 if no matching mode was found.

A.10.5 SetGraphicsMode()

Usage

bool SetGraphicsMode(short Mode);

Purpose

Sets a new graphics mode.

Inputs

Mode, mode number returned by FindGraphicsMode().

Outputs

Returns nonzero on error, 0 on success.

A.10.6 UnsetGraphicsMode()

Usage

void UnsetGraphicsMode(void);

Purpose

Gets out the current graphics mode, returning to text mode.

Inputs

None

Outputs

None

A.10.7 CopyToScreen()

Usage

void CopyToScreen(void *Source, int SourcePitch, int SourceLeft, int SourceTop, int Width, int Height, int DestLeft, int DestTop);

Purpose

Copies the specified portion of the source image to the display memory.

Inputs

Source, starting address of source linear bitmap image.

SourcePitch, total width of source image, in bytes.

SourceLeft, X coordinate of the upper left corner of source area to copy.

SourceTop, Y coordinate of the upper left corner of source area to copy.

Width, width of area to copy, in pixels.

Height, height of area to copy, in pixels.

DestLeft, X coordinate of the upper left corner of destination (display) area.

DestTop, Y coordinate of the upper left corner of destination (display) area.

Outputs

None

Notes

Source image must have the same pixel format as the current video mode (e.g. 32 BPP RGBx).