How to Detect the Number of Colors Available in a DCLast reviewed: November 14, 1995Article ID: Q139202 |
The information in this article applies to:
SUMMARYWhen writing an application that uses the GDI, you may sometimes need to detect how many colors are available in the current video mode.
MORE INFORMATIONIf you need to detect the total number of bits that are used to form a pixel in a given display context, you can use the following algorithm:
int dBitsInAPixel = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);To determine how many colors are available, you can raise 2 to the power of dBitsInAPixel and this will return the maximum number of colors that are displayable at a given time in the specified display context (DC).
|
Additional reference words: 1.20 1.30 3.10 4.00 3.50 colorref rgb bpp
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |