As well as the location of an object you want drawn you also have to specify a Color for it. There are many ways of describing a color. You can use a Color Name and this works well for many common colors. However for more precise control over colors you should use Color Components.
Colors under .NET

ImageGlue uses a dedicated class for colors: Color.

The Color class allows you to specify colors using component intensities as well as standard color names.

RGB Colors

An RGB color specifies the intensity of the Red, Green and Blue components of a color. Imagine it as a set of three overlapping colored lights. Any color can be created using a combination of these lights.

We specify the intensity as a number from 0 to 255. 0 indicates that the light is off, 255 that it is fully on. So:

  • If you want a bright red you should have the red light on and the green and blue off (color = 255,0,0).
  • If you want a blue you should have the blue on and the others off (color = 0,0,255).
  • If you want black you should have all off (color = 0,0,0)
  • If you want white you should have all on (color=255,255,255).
RGBA Color Strings

An RGBA color is exactly the same as an RGB color but includes a fourth component Alpha, which is a measure of opacity.

The alpha value is optional and defaults to 255 opaque (i.e. not transparent). You cannot generally draw with an RGBA Color but you may wish to determine the color and opacity of a point on a bitmap.

Other Color Spaces

Most people will want to specify colors in the RGB color space. However the Color class supports multiple color spaces.

If you want to use other color spaces like CMYK or grayscale you can do so using the Color.ColorSpace property.

Color Components

The traditional RGB values lying between 0 and 255 are just that - tradition.

The traditional CMYK values are specified as percentages - between 0 and 100 - again tradition.

Ultimately these translate into floating point values between zero and one, indicating the intensity of the component.

The Color class allows you access to the floating point component values if you need to represent 16 bit or high dynamic range colors.