How to Detect If a Color Is a Dithered ColorID: Q139201
|
When you use a COLORREF (color) to draw into a display context (DC), sometimes you need to ensure that the color is a solid color rather than a dithered color.
If you need to test to see if a particular COLORREF is a solid color, you
can compare the COLORREF against the return value of GetNearestColor() to
see if they are equivalent.
For example, the following function returns TRUE if the COLORREF value that
is passed in exists as a solid color in the specified display context:
BOOL IsSolidColor(HDC hDC, COLORREF crColor)
{
if (crColor == GetNearestColor(hDC, crColor)) {
// Color is solid
return TRUE;
} else {
// Color is dithered
return FALSE;
}
}
Additional query words: 1.20 3.10 4.00 3.50 dither colorref
Keywords :
Version : 1.20 1.25a 1.30 3.10 4.00 | 3.50
Platform : NT WINDOWS
Issue type :
Last Reviewed: March 5, 1999