|
Color Approximations and Dithering
Although an application can use color without regard to the color capabilities
of the device, the resulting output may not be as informative and pleasing as
output for which color is carefully chosen. Few, if any, devices guarantee an
exact match for every possible color value; therefore, if an application
requests a color that the device cannot generate, Windows approximates that color by
using a color that the device can generate. For example, if an application
attempts to create a red pen for a black and white printer, it will receive a black
pen instead Windows uses black as the approximation for red.
An application can discover whether Windows will approximate a given color by
using the GetNearestColor function. The function takes a color value and returns the color value of the
closest matching color the device can generate. The method Windows uses to
determine this approximation depends on the device driver and its color
capabilities. In most cases, the approximated color's overall intensity is closest to
that of the requested color.
When an application creates a pen or sets the color for text, Windows always
approximates a color if no exact match exists. When an application creates a
solid brush, Windows may attempt to simulate the requested color by dithering. Dithering simulates a color by alternating two or more colors in a pattern. For
example, different shades of pink can be simulated by alternating different
combinations of red and white. Depending on the colors and the pattern, dithering can
produce reasonable simulations. It is most useful for monochrome devices, because
it expands the number of available "colors" well beyond simple black and white.
The method used to create dithered colors depends on the device driver. Most
device drivers use a standard dithering algorithm, which generates a pattern
based on the intensity values of the requested red, green, and blue colors. In
general, any requested color that cannot be generated by the device is subject to
simulation, but an application is not notified when Windows simulates a color.
Furthermore, an application cannot modify or change the dithering algorithm of
the device driver. An application, however, can bypass the algorithm by
creating and using pattern brushes. In this way, the application creates its own
dithered colors by combining solid colors in the bitmap that it uses to create the
brush.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|