[prev] [prev-tail] [tail] [up]

## Chapter 24
The VIDEO unit

The Video unit implements a screen access layer which is system independent. It can be used to write on the screen in a system-independent way, which should be optimal on all platforms for which the unit is implemented.

The working of the Video is simple: After calling InitVideo (891), the array VideoBuf contains a representation of the video screen of size ScreenWidth*ScreenHeight, going from left to right and top to bottom when walking the array elements: VideoBuf[0] contains the character and color code of the top-left character on the screen. VideoBuf[ScreenWidth] contains the data for the character in the first column of the second row on the screen, and so on.

To write to the ’screen’, the text to be written should be written to the VideoBuf array. Calling UpdateScreen (895) will then cp the text to the screen in the most optimal way. (an example can be found further on).

The color attribute is a combination of the foreground and background color, plus the blink bit. The bits describe the various color combinations:

bits 0-3
  The foreground color. Can be set using all color constants.
bits 4-6
  The background color. Can be set using a subset of the color constants.
bit 7
  The blinking bit. If this bit is set, the character will appear blinking.

Each possible color has a constant associated with it, see page 865 for a list of constants.

The contents of the VideoBuf array may be modified: This is ’writing’ to the screen. As soon as everything that needs to be written in the array is in the VideoBuf array, calling UpdateScreen will copy the contents of the array screen to the screen, in a manner that is as efficient as possible.

The updating of the screen can be prohibited to optimize performance; To this end, the LockScreenUpdate (891) function can be used: This will increment an internal counter. As long as the counter differs from zero, calling UpdateScreen (895) will not do anything. The counter can be lowered with UnlockScreenUpdate (895). When it reaches zero, the next call to UpdateScreen (895) will actually update the screen. This is useful when having nested procedures that do a lot of screen writing.

The video unit also presents an interface for custom screen drivers, thus it is possible to override the default screen driver with a custom screen driver, see the SetVideoDriver (894) call. The current video driver can be retrieved using the GetVideoDriver (888) call.

Remark: The video unit should not be used together with the crt unit. Doing so will result in very strange behaviour, possibly program crashes.

24.1 Constants, Type and variables
Constants
Types
Variables
24.2 Functions and Procedures
ClearScreen
DefaultErrorHandler
DoneVideo
GetCapabilities
GetCursorType
GetLockScreenCount
GetVideoDriver
GetVideoMode
GetVideoModeCount
GetVideoModeData
InitVideo
LockScreenUpdate
SetCursorPos
SetCursorType
SetVideoDriver
SetVideoMode
UnlockScreenUpdate
UpdateScreen
24.3 Writing a custom video driver

[prev] [prev-tail] [front] [up]