The graphics system

Overview

The graphics system in RISC OS is made up of many different components. Each of these components provides some facilities to the whole. For the most part, graphics operations are abstracted through a system of vectored system calls (SWIs). These are dispatched to claimants, allowing extension of the standard graphical operations.

Technical Details

Major components

The major components in the graphics system are :

Kernel

The Kernel provides core graphics capabilities for output to a raster buffer used by the Video* drivers to display video.

In addition to this, it provides rudimentary support for simple sprite (bitmap) operations.

See PRM 1-527 - 1-834 (chapters VDU drivers and Sprites) for fundamental details.

See the VDU code changes section for changes to the VDU codes.

See the VDU variables document for updated VDU variables.

See the System Sprite Pool section for changes to the system sprite area.

See the Display changes document for the changes made by multiple display drivers.

See the OS_ScreenMode changes document for details of the new reason codes for OS_ScreenMode, allowing mode string processing, display device manipulation and bank selections.

VideoHW*

The VideoHW-prefixed modules provide the hardware support for displaying graphics through the raster buffer. The driver modules may also provide acceleration for their hardware where appropriate. Multiple hardware driver modules may be present, and may provide a variable number of physical displays which graphics output may be displayed on.

Contact your supplier for details of how to communicate with the driver system.

VideoSW

The VideoSW module provides a software implementation of the graphics operations which the graphics system provides. It provides support for simple line and block based graphic operations, and simple bitmap font rendering.

Contact your supplier for details of how to communicate with the driver system.

VideoTTX

The VideoTTX module provides an implementation of the teletext screen modes. It can be used in any depth, at any resolution.

See the Teletext document for more information.

ScreenModes

The ScreenModes module provides a centralised point for defining modes (resolution, DPI and colour depth groups). The module provides enumeration of screen modes, and mode information through a number of system calls.

See PRM 5a-99 to 141 and the ScreenModes document for more information.

ColourTrans

Colour translations for different modes are provided by the ColourTrans module. All colour selection passes (via DrawV) to ColourTrans.

See PRM 3-335 (ColourTrans chapter).

See the ColourMapping of deep sprites document and the Colour Map module document for changes to palette operations.

SpriteExtend

The Sprite Extension module provides more complex sprite operations which are not present in the kernel. Rendering of scaled and transformed sprites is the primary function of the SpriteExtend module.

In addition, SpriteExtend provides facilities for rendering most common JPEGs held within JFIF or Exif format files. Non-baseline JPEGs are supported by using CompressJPEG to provide an intermediate format.

See ColourMapping of deep sprites for details of the deep sprite translation table format.

See CMYK sprites for details of CMYK sprites.

See Alpha-channel sprites for details of alpha-channel sprites.

See Alpha mask promotion and demotion for details of the mask changes on alpha-channel sprites.

See Tiled sprite plotting for details of the sprite tiling operation.

See Translucent sprite operation for details of the sprites plotted at a translucency level.

See Sprite errors for details of the errors returned by SpriteExtend for both sprite and JPEG operations.

See SpriteV claimants for details of the new services for other SpriteV claimants.

See Sprite Plot Actions for an index of the Plot Action for OS_SpriteOps.

Draw

The Draw module provides vector graphic rendering facilities. The Draw module is based on the primitives provided by the PostScript language for path rendering.

See PRM 3-523.

FontManager

The FontManager provides scalable, vector-based, anti-aliased font rendering operations.

See PRM 3-403.

InverseTable

The InverseTable module provides supporting tables for BlendTable and FontManager to make rendering blended objects to 256 colour modes possible. InverseTable generates tables to convert 5 bit colour components to colour indices and vice-versa.

See the InverseTable document for more information.

BlendTable

The BlendTable module provides supporting tables for SpriteExtend to allow it to render translucent objects in shallow colour (<=8 bit per pixel) modes.

See the BlendTable document for more information.

DrawFile

The DrawFile module provides rendering facilities for the filetype used by the Draw application. Extensions to the DrawFile module can be provided through the use of service calls. DrawFile provides an ImageFileConvert interface for the generation of SVG files.

See the ColourMapping in Drawfiles document for the colour mapping interface for drawfile rendering.

CompressJPEG (aka JCompMod)

The CompressJPEG module provides transcoding and creation facilities for JPEGs. Given RGB input data, CompressJPEG can create a JPEG at a given quality. The CompressJPEG module can also be used to transcode (convert to another variant of JPEG) a JPEG. This facility is used by SpriteExtend to allow it to render progressive (multi-pass) JPEGs.

See PRM 5a-609 and the CompressJPEG module document for more information.

PNG

The PNG module provides an interface for converting (but not rendering) PNG graphics to or from raster images. The PNG module can be used to generate sprites from PNGs and vice-versa, and to extract information about the image.

See the PNG module document for more information.

SpriteUtils

The SpriteUtils module provides facilities from earlier versions of the Operating System based around the 'System Sprite Area' - a shared pool of sprites. Since RISC OS 2, use of the system sprite area has been deprecated.

See PRM 1-746 and the System Sprite Pool section for more information.

ImageFileRender

The ImageFileRender module provides an abstracted means of rendering different forms of files. ImageFileRender itself supports rendering of Sprite, DrawFile and JPEG format files. Other components provide additional facilities for non-native filetypes.

See the The Image File Renderer document for more information.

ImageFileConvert

The ImageFileConvert module provides an abstracted means of converting between different forms of files.

See the ImageFileConvert document for more information.

Smaller components

In addition to these major components, a collection of smaller components provide facilities for the ImageFileRender and ImageFileConvert modules :

ConvertPNG

The ConvertPNG module provides SWIs, and an ImageFileConvert interface for converting between Sprite and PNG files. Through ImageFileConvert, this allows rendering of PNG files with ImageFileRender.

See the ConvertPNG document for more information.

ConvertSprite

The ConvertSprite module provides SWIs, and an ImageFileConvert interface for creating Sprite files from arbitrary rendering routines. ConvertSprite will provide ImageFileConvert facilities for any type registered with ImageFileRender, allowing vector formats to be converted to bitmaps.

See the ConvertSprite document for more information.

ConvertGIF

The ConvertGIF module provides an ImageFileConvert interface for converting GIF files to sprites.

FIXME: No specific documentation is available for this module.

ConvertXBM

The ConvertXBM module provides an ImageFileConvert interface for converting XBM files to sprites.

FIXME: No specific documentation is available for this module.

ConvertSun

The ConvertSun module provides an ImageFileConvert interface for converting Sun Raster files to sprites.

FIXME: No specific documentation is available for this module.

ConvertBMP

The ConvertBMP module provides an ImageFileConvert interface for converting Windows bitmap (.bmp) files to sprites.

See the ConvertBMP document for more information.

ConvertPNM

The ConvertPNM module provides an ImageFileConvert interface for converting Portable Net Map (.pnm, .pgm, .pbm) files to sprites.

FIXME: No specific documentation is available for this module.

ConvertPCX

The ConvertPCX module provides an ImageFileConvert interface for converting PCX files to sprites.

FIXME: No specific documentation is available for this module.

ConvertICO

The ConvertICO module provides an ImageFileConvert interface for converting .ico (Windows icon) files to sprites.

FIXME: No specific documentation is available for this module.

ConvertClear

The ConvertClear module provides an ImageFileConvert interface for converting RISC OS Translator's 'Clear' files to sprites.

FIXME: No specific documentation is available for this module.

ImageFileRender_Artworks

The ImageFileRender_Artworks module provides SWIs and an ImageFileRender interface for rendering Artworks files.

FIXME: No specific documentation is available for this module.

ColourMap

The ColourMap module provides a means by which 'standard' colour map descriptors may be constructed using simple SWI calls rather than embedding assembler in each component.

See the Colour Map module document for the module API.

FontMap

The FontMap module provides a means by which font names can be converted to non-native formats. It is used by the DrawFile module as an aid to SVG creation, and by the WMF decoder to translate fonts to native format.

See the FontMap module document for more information.

Entry points

Entry points used by the graphics components :

VideoV

The Video Vector is the entry point through which most primitive graphics operations are passed by the Kernel's graphics system. The vector is claimed by both the VideoHW and VideoSW driver modules in order to allow the operations to be accelerated. The video operations are split into different classes in which apply to different parts of the video system.

Contact your supplier for details of how to communicate with the driver system.

SpriteV

The Sprite Vector is the entry point through which all sprite operations are passed in order to satisfy them. Sprite operations are split between Kernel and SpriteExtend but can be extended by other components through the Sprite vector. When printing, the Sprite vector is usually claimed to ensure that all sprite operations are sent to the output device.

See SpriteV claimants for details of the new services for other SpriteV claimants.

ColourV

The Colour Vector is the entry point through which all colour selection operations are performed. ColourV is claimed by ColourTrans to provide colour matching.

See the ColourTrans documentation in PRM 3-335 for details of the operations provided by this vector.

PaletteV

The Palette Vector provides a mechanism to read and write the current palette in an abstract manner. It is provided by the Kernel. Certain operations are monitored by other modules to ensure that changes to the palette are reflected in their internal state.

See PRM 1-104 for the basic reason codes.

See PRM 5a-122 for the reason codes added in RISC OS 3.5-3.6.

See OS_ScreenMode changes for reason codes added after RISC OS 3.7 (primarily portable-specific).

DrawV

The Draw Vector is the entry point for all Draw operations. All vector operations are passed through this vector by the Draw module. During printing operations, the DrawV is usually redirected to the printer driver for rendering.

See PRM 3-523 (chapter Draw module).

DrawObjectRender service

The DrawObjectRender service is issued when the DrawFile module encounters an object which it does not understand. It is expected that extension components provide the rendering facilities for the object.

See PRM 1-520 for the fundamental definition.

See the ColourMapping in Drawfiles document for the extended calls for plotting DrawFile Objects with colour maps.

ImageFileRender registered functions

Components registered with ImageFileRender will be called through interfaces they have provided when operations on their filetype is required.

See the The Image File Renderer document for details on registering new renderers.

ImageFileConvert registered functions

Components registered with ImageFileConvert will be called through interfaces they have provided when operations on their filetype is required.

See the ImageFileConvert document for details on registering new converters.

Changes to the graphics system

The graphics system as a whole has had a number of changes applied to it which may affect certain applications. Many of the components have been extended to provide greater facilities to others. In order to explain where changes have taken place, the change will be documented, followed by the components that are affected. More information can be found within the Video drivers document, which covers more recent changes.

CMYK sprites

Since RISC OS 3.6, this format has been allocated but unsupported by the operating system. This is now supported within the OS. CMYK sprites are held in 32bits containing the Cyan, Magenta, Yellow and Black components, rather than Red, Green and Blue components.

  • Kernel: The Kernel will now provide information on these sprites through the standard OS_ReadModeVariable (and OS_ReadVduVariables) calls. Refer to the CMYK sprites document for more details about CMYK sprites.
  • ColourTrans: ColourTrans has been updated to generate tables of CMYK-formatted pixel translation tables and to return suitable information for rendering to CMYK format sprites.
  • SpriteExtend: SpriteExtend can render CMYK sprites through its scaled and transformed entry points. SpriteExtend can render to a CMYK output using both RGB and CMYK input sprites.

JPEG rendering

JPEG rendering has been improved in a number of ways to allow a greater range of JPEGs to be rendered.

  • SpriteExtend: The SpriteExtend module provides the core code to render JPEGs and so has undergone extensive changes. A greater number of sampling ratios are now understood by the renderer, and some latent faults in rendering of obscure ratios have been corrected. The renderer is capable of processing JPEGs with Y sampling ratios of 1x1, 1x2, 2x1, 2x2 (earlier versions), and 4x1 and 4x2 (new). The renderer cannot handle U or V sampling ratios other than 1x1. Under previous versions, rendering a small (<17% scaling) JPEG to a greyscale output would result in corrupt output. This has been addressed. Where JPEGs are scaled up in 256 colour modes using the 'dithered' mode, the output is now dithered in a similar manner as that of sprites with the 'dithered' bit set. Where the JPEG cannot be processed by SpriteExtend, a number of more descriptive error messages are now returned.
  • CompressJPEG: The CompressJPEG module has been extended to support transcoding to convert progressive JPEGs to baseline JPEGs.

Colour mapping

Colour mapping allows the colour system to be manipulated for certain operations. ColourTrans has, since RISC OS 3, provided a mechanism for generating pixel translation tables for shallow sprites (<= 8 bit per pixel). However, this mechanism does not scale well to true colour. Colour mapping routines follow the same mechanism as that used by ColourTrans pixel translation table transfer functions to translate a RGB palette entry to a destination entry.

Typically, colour mapping would be used to affect the brightness, contrast, or to fade or highlight an image.

  • SpriteExtend: Sprite and JPEG rendering can use colour mapping to translate the colours in the deep colour sprites.
  • DrawFile: DrawFile rendering can use colour mapping to translate the colours before rendering. Vectors, text areas, text, sprites and JPEGs are rendered through the colour mapping functions.
  • ImageFileRender: ImageFileRender is able to provide colourmapping where the underlying modules are capable of colour mapping. Any type converted through sprite before rendering will be capable of using colour map descriptors, as will any type converted through Drawfile. The Artworks renderer also supports colourmapping through ImageFileRender.
  • ColourMap: The ColourMap module provides a means by which colour map descriptors for any of the above components may be created.

Alpha-channel

A new sprite type has been introduced which allows 8 bits per mask pixel of translucency. This means that for any sprite using this new type, the pixels can blend to the background.

  • SpriteExtend: Can be used to render alpha-channel sprites both scaled and transformed, using colourmapping and translucency if required.
  • ColourTrans: Generates a greyscale palette when output is directed to the mask of an alpha-channel sprite. This allows it to be used like a normal image for rendering to.
  • Kernel: The Kernel understands and returns correct values when output is directed to alpha channel sprites. Graphics operations on redirected alpha-channel sprites work - on the whole - just like binary masked sprites.

Translucent rendering

The standard 8 plot operations (overwrite, OR, AND, EOR, invert, NOP, AND NOT, and OR NOT) are used for rendering sprites. Sprites themselves may contain masks to make parts of the sprite opaque or transparent. Whether the sprite contains binary or alpha-channel data, it is now possible to make the entire sprite translucent when rendered. 256 degrees of translucency are available (subject to colour depth restrictions).

  • SpriteExtend: Sprite and JPEG rendering can use translucent rendering to allow them to be rendered 'over' the background image.
  • BlendTable: The BlendTable module is a new module created to generate translation tables for shallow depth modes where the size of the palette is not prohibitive. For deep modes, the blend must be calculated by clients (SpriteExtend generates code for these cases).
  • InverseTable: The InverseTable module has been extended to provide generation of tables for other modes than the present one.

Multiple display drivers

Multiple display drivers may be active concurrently within RISC OS. The changes necessitated by support for multiple drivers are documented more fully in the Display changes document.