RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Page "Message_Notify/versions/1" does not exist. Please create it now, or hit the "back" button in your browser.

ColourTrans Miscellaneous

Programmer's Reference Manuals
» Part 8 - Non-kernel input/output
» ColourTrans
» Technical Details
» Miscellaneous

Module Version Check

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

Setting a Colour

ColourTrans provides multiple SWIs that returns a colour based on a desired input colour. The return value can either be the closest match or the most unclose match.

In monochrome mode, the ECF patterns are not used to reflect shades of grey. This is in contrast to Wimp_SetColour that does.

Conversion

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.

Sprites and Fonts

The following SWIs are useful when dealing with sprite and fonts.

  1. ColourTrans_SelectTable sets up a translation table in the buffer
  2. ColourTrans_SelectGCOLTable sets up a list of GCOLs in the buffer
  3. ColourTrans_ReturnFontColours finds the best set of logical colours for an anti-aliased colour range
  4. ColourTrans_SetFontColours find the best set of logical colours for an anti-aliased colour range, and sets the Font Manager plotting colours.

A detailed description on pixel translation tables can be found within the Sprites section.

Palette Changes

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 by calling ColourTrans_InvalidateCache. 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.

Printing

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.

See also

  • ColourTrans_InvalidateCache
  • ColourTrans_ReturnFontColours
  • ColourTrans_SelectGCOLTable
  • ColourTrans_SelectTable
  • ColourTrans_SetFontColours
  • Sprites
  • The Font Manager
  • Wimp_SetColour
Revised on January 31, 2010 15:45:45 by Alan Robertson (52)? (127.0.0.1)
Edit | Back in time (1 revision) | See changes | History | Views: Print | Source | Linked from: ColourTrans Technical Details

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys