virtual modes

 
 The key feature of PTC

PTC is much more than just a mode setting library, surface handler or API wrapper because it provides something that other graphics libraries do not: virtual display modes.

Virtual display modes enable the programmer to work internally in 8 bit indexed color, RGB565 hicolor, or ARGB8888 truecolor independently of the display pixel format. PTC can even emulate truecolor on VGA compatible displays when truecolor is not available.
 
 
 How virtual modes work

When a virtual mode set is requested PTC searches for a mode with the closest display pixel format. For example, a VIRTUAL32 mode set searches for a mode with the closest pixel format to ARGB8888 truecolor. This means that the display format could be ARGB8888, RGB565, ARGB1555 or even a VGA emulated mode, and PTC will automatically convert to that format on each display update. PTC does this so quickly that there is no significant overhead in conversion.
 
 
 Benefits of virtual modes

The benefits of working virtually in a single pixel format are significant. Take the case of a software polygon filling routine. Either one pixel format is supported only, or the filler must be made to support each possible display format. The problem with choosing a single pixel format is obvious, with hicolor and truecolor graphics it can not be assumed that any one pixel format will exist across all video cards. To support all possible display formats requires either writing a version of the polygon filler for each possible format, or to use a slower generic routine that can work in any format. Clearly neither choice is ideal.

The problem then is how to support all video hardware without needing to write excessive amounts of code or fall back to slower routines. This is where PTC provides a tidy solution: with virtual modes you get all the benefits of working in a single internal pixel format and support for all common display formats.