next up previous 530
Next: Lookup Tables
Up: KAPPA Kernel Application Package
Previous: Interaction Mode


Graphics Device Colour Table and Palette

The PGPLOT ref graphics package, which is used by KAPPA , draws images and line graphics using a set of `pens'. The number of pens available is limited to 256, even on 16- or 24-bit graphics devices which nominally have `millions' of colours. On 8-bit graphics devices, the number of available pens may be fewer than 256 if any other applications have `grabbed' colours for their own use21.

Each PGPLOT pen draws in a single colour, but you can choose what that colour will be for each pen. This allocation of colours to pens is called the PGPLOT `colour table'. Each pen has a corresponding integer index within the table. On 8-bit graphics devices you can allocate any arbitrary combination of red, green and blue to a pen (each colour is specified as an `intensity' in the range zero to one). On 16- and 24-bit devices you can only allocate one of the `millions' of colours known to the graphics device. For instance, on 16 bit devices it is common to allocate 5 bits each to the red and blue intensity and the remaining 6 bits to the green intensity. This means that red and blue can only be set accurate to 1 part in 32 on these devices, which may result in colours not being exactly as you want them.

On an 8-bit device, any changes thatyou make to the colour table are immediately reflected in the visual appearance of the display. For instance, if you set Pen 1 to red, then draw something using Pen 1, it will appear red on the screen. If you then change Pen 1 to blue, the previously drawn graphics will immediately change colour without you needing to re-draw them. This is not usually true for 16- and 24-bit devices. That is, changing pen colours will usually have no effect on previously drawn graphics. In order to see the effects of the changed pen colour, you will need to re-display the graphics.

In many image procesing and visualisation systems the full colour table is used to draw images. This has the disadvantage that if you want to annotate images with captions or axes, plot coloured borders about images, plot graphs etc, yet simultaneously display images with certain colour tables, there may be conflict of interests. For instance, a linear grey-scale colour table's first few pens will be almost black. By default, these same pens, particularly Pen 1, are used by the graphics system for line graphics, thus any plots will be invisible. If you reset colour Pen 1 to white, the appearance of your image alters. Whenever you alter the colour table to enhance the look of your image, it will affect the line graphics.

To circumvent this dilemma, KAPPA reserves a portion of the colour table, called the palette, that is unaffected by changes to the rest of the colour table. It is shown schematically below. The palette currently contains a fixed 16 pens. n is the total number of pens. In KAPPA the remainder of the pens is called the colour table. It is easy to confuse this use of the term `colour table', with the PGPLOT colour table described above. To sumarize again, in KAPPA the `colour table' is that part of the PGPLOT colour table that has not been reserved for annotation (i.e. the whole colour table minus the first 16 pens which form the annotation palette). The context should usually make it obvious which understanding of the phrase `colour table' is being used.


\begin{picture}(136,28)
% Thick outline.\thicklines
\par
% Draw the palette o...
...e Palette}}}
\put(34,4){\makebox[100mm][c]{{\large Colour Table}}}
\end{picture}


Subsections

next up previous 530
Next: Lookup Tables
Up: KAPPA Kernel Application Package
Previous: Interaction Mode

KAPPA --- Kernel Application Package
Starlink User Note 95
Malcolm J. Currie & David S. Berry
2013 February 14
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council