Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>getnearestcolor()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GetNearestColor()
Return the closest colour a device can show
------------------------------------------------------------------------------

Syntax
GetNearestColor( <hDC>, <nColour> )   -->   nBestColour

Arguments
<hDC> specifies the device context for a window.

<nColour> is a colour value (corresponding to colours produced
by the RGB() macro) that may not be representable on the
actual device.

Returns
The return value is a colour value (corresponding to colours
produced by the RGB() macro) that can be drawn on the device
specified by <hDC>.

Description
Drawing functions in Windows are done by GDI (graphics device
interface), which needs to know the device you are drawing on.
Then GDI is able to match your desired colour to the abilities
of the actual device.

Example
nColour = RGB( 101, 102, 103 )     // some colour mixture
nBestColour = GetNearestColor( hDC, nColour )
if  nBestColour != nColour
     ? "Colour needed adjustment"
else
     ? "Colour was ok"
endif


See Also: GetBValue() GetBkColor() GetDC() GetGValue() GetRValue() GetTextColor() RGB() SetBkColor() SetTextColor()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson