Any task that intends to use the ColourTrans module should ensure that a suitable version of the module is present on the system. This is achieved by *RMEnsure Command.
The following code is an excerpt from a typical Obey file used within an application to check the presence of a specific version of the ColourTrans module.
RMEnsure ColourTrans 1.78 RMLoad System:Modules.Colours RMEnsure ColourTrans 1.78 Error You need ColourTrans 0.51 or later
Within this section of the Programmer's Reference Manuals the following terms are used, and thus need to be understood.
Finding a colour given a particular palette or screen mode is provided via several different SWIs. The list below details the methods of finding the appropriate colour.
Input | Output |
---|---|
Palette entry | Nearest/furthest GCOL |
Palette entry | Nearest/furthest colour number |
Palette entry, mode & palette pointer | Nearest/furthest GCOL |
Palette entry, mode & palette pointer | Nearest/furthest colour number |
ColourTrans also provides the functionality to set the VDU driver GCOL to the calculated GCOL (after finding it). Either the nearest or furthest colour match can be set in this way.
ColourTrans provides a facility to convert GCOLs to colour numbers and vice versa. This only has meaning for 256 colour screen modes
There are also SWIs that convert between different colour models such as RGB, CIE, HSV and CMYK.
It is also possible to convert GCOLs to and from colour numbers. This only has meaning for 256 colour screen modes. There are also SWIs to convert between different colour models, such as RGB, CIE, HSV, and CMYK.
ColourTrans also provides functionality for setting colours used by sprites and fonts.
ColourTrans maintains a cache containing the mapping of colours to the current palette. If a task changes the output palette, then it must inform ColourTrans. This is ensures that ColourTrans will update its own internal cache.
A task does not need to inform ColourTrans of a change in palette if a change in screen mode has occurred as it automatically updates its own cache. If however, a task changes a palette colour, or switching output to a sprite, then the task should inform ColourTrans. A SWI provides this functionality.
A task that uses the Wimp interface can safely be used as they never modify the palette.
ColourTrans provides functionality to request a RGB colour rather than a logical colour and this makes it ideal for use with printer drivers, where a printer may be able to more accurately represent a colour using RGB.
Colour calibration functionality is provided by ColourTrans.