13.07.2015 Views

REFERENCE GUIDE

REFERENCE GUIDE

REFERENCE GUIDE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Color-palette functionsMany color graphic displays are capable of displaying a widerange of colors. In most cases, however, the actual number ofcolors which the display can render at any given time is morelimited. For example, a display that is potentially able to produceover 262,000 different colors may be able to show only 256 ofthose colors at a time because of hardware limitations. In suchcases, the display device often maintains a palette of colors; whenan application requests a color that is not currently displayed, thedisplay device adds the requested color to the palette. However,when the number of requested colors exceeds the maximumnumber for the device, it must replace an existing color with therequested color. As a result, if the total number of colorsrequested by one or more windows exceeds the number availableon the display, many of the actual colors displayed will beincorrect.Windows color palettes act as a buffer between color-intensiveapplications and the system, allowing an application to use asmany colors as needed without interfering with its own colordisplay or colors displayed by other windows. When a windowhas input focus, Windows ensures that the window will displayall the colors it requests, up to the maximum numbersimultaneously available on the display, and displays additionalcolors by matching them to available colors. In addition,Windows matches the colors requested by inactive windows asclosely as possible to the available colors. This significantlyreduces undesirable changes in the colors displayed in inactivewindows.The following list briefly describes the functions an applicationcalls to use color palettes:FunctionAnimatePaletteCreate PaletteGetNearestPalettelndexGetPaletteEntriesGetSystemPaletteEntriesDescriptionReplaces entries in a logical palette;Windows maps the new entries into thesystem palette immediately.Creates a logical palette.Retrieves the index of a logical paletteentry most nearly matching a specifiedRGB value.Retrieves entries from a logical palette.Retrieves a range of palette entries from thesystem palette.Chapter 2, Graphics device interface functions 95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!