There are five different ways you can use color in ProXL, in approximate order of increasing difficulty:
black_pixel
and white_pixel
of your screen.
black_pixel
is the default foreground color, so if you don't change
your drawable's foreground graphics attribute, you will be drawing in
black. And the default window background is its screen's white_pixel
,
so if you don't change that, you will be drawing in black on a white
background, which is often good enough.
You can allocate colors. If you want to have color images, this is usually the best approach. Allocating a color never fails, even on a monochrome screen, it just gives you the closest color it can. So if you ask for yellow and navy blue, you will get white and black, respectively. This allows your application to run on monochrome (or grayscale) screens, as well as color.
When you allocate colors, you share these colors with other applications, too. This means that if you ask for blue, and another application is already using blue, you will get the same pixel value. Obviously this is good citizenship on a color screen with a limited number of pixel values available. It also means that you cannot change the color of a pixel value you get this way, because it would confound the other applications using this pixel value.
You can allocate color cells and planes. This gives you private pixel values for you to play with. You can set these pixel values to any colors you like, and change them as often as you like. Allocating color planes also allows you to control the actual bit patterns of the pixels you use, allowing you to do sophisticated tricks with images.
You can use a standard colormap. Standard colormaps provide a number of pre-selected colors, and can be shared with other applications. You must rely on your window manager to create standard colormaps for you, and, unfortunately, not all window managers do this.