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 RGB Colors.
1
Colors under .NET

ImageGlue uses a dedicated class for colors: XColor. XColor allows you to specify RGB colors as well as to use the System.Drawing.Color names for creating colors. You can create and XColor from a System.Drawing.Color or viceversa at any time.

2
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).

Some graphics packages specify color intensities as decimal numbers between 0 and 255 or as hexadecimal numbers between 00 and FF. You can use both these methods. For decimal numbers you must precede the number by 0d and for hexadecimal by 0x. So:

  • If you want a bright red you could specify 0d255,0d0,0d0
  • If you want a bright blue you could specify 0x00,0x00,0xFF
  • If you want black you could specify 0x00,0x00,0x00
  • If you want cyan you could specify 0d00,0d255,0d255

When working with HTML you may want to specify a color using an RGB Hex Code as used in HTML. So:

  • If you want a bright red you could specify #FF0000
  • If you want a bright blue you could specify #0000FF
  • If you want black you could specify #000000
  • If you want cyan you could specify #00FFFF
3
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 transparency. 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 canvas.

Alpha is described more fully in the channels section.

4
Relationships between Color Names and RGB Colors

Each of the System.Drawing.Color names corresponds to an RGB color. The particular RGB color is chosen to look correct rather than to fit in with the definitions of RGB color space.

What this means is that if you want precise control over the color components of your colors you must explicitly use RGB colors.