Palette (computing) - System and logical Palettes Under Microsoft Windows

System and logical Palettes Under Microsoft Windows

Microsoft Windows applications manage the palette of 4-bit or 8-bit indexed color display devices through specialized functions of the Win32 API (for Highcolor and Truecolor display modes, such functions lacks any interesting functionality). These APIs deals with the so-called system palette and with many logical palettes.

The system palette is a copy in RAM of the color display's hardware registers, primarily a physical palette, and it is a unique, shared common resource of the system. At boot, it is loaded with the default system palette (mainly a master palette which works well enough with most programs).

When a given application intends to output colorized graphics and/or images, it can set their own logical palette, that is, its own private selection of colors (up to 256). It is supposed that every graphic element that the application tries to show on screen employs the colors of its logical palette. Every program can manage freely one or more logical palettes without further expected interference (in advance).

Before the output is effectively made, the program must to realize its logical palette: the system tries to match then the logical colors with physical ones. If an intended color is already present into the system palette, the system internally maps both the logical and the system palette indexes (due to they rarely coincide). If the intended color is not present yet, the system applies an internal algorithm to discard the least used color in the system palette (generally, some used by another window in the background) and substitutes it with the new color. Due to there are limited room for colors in the system palette, the algorithm tries also to remap similar colors together, and always by avoiding redundant colors.

The final result depends on how many applications are working with on screen colors. The foreground window is always favoured, so windows at background may behave in different ways: from become corrupted to quickly redraw themselves. When the system palette changes, the system triggers a specific event to inform every application. When received, a window can quickly redraw itself using a single Win32 API function. But this must be doing explicitly in the program code; hence the fact that many programs lack in manage this event, and their windows become corrupt in this situation.

An application can force the system palette to be loaded with specific colors and even in a specific order, tricking the system by telling they are color entries intended for animation (quick color changes of the colors in the physical palette at specific entries). The system cannot assume then that every hardware palette entry is free for their palette color managements, and those entries are excluded from its algorithm. The final result depend on the skills of the color forcing program and the behaviour of the other programs (the lasts exactly as in the regular case), and that of the operating system in itself.

Read more about this topic:  Palette (computing)

Famous quotes containing the word windows:

    Among a hundred windows shining
    dully in the vast side
    of greater-than-palace number such-and-such
    one burns
    these several years, each night
    as if the room within were aflame.
    Denise Levertov (b. 1923)