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

Font Background Blending (Rev #4)

FontManager
» Technical Details
» Font Background Blending

Standard Blending

Font background blending works by blending the font foreground colour with the colour of the screen, on a per-pixel basis.

To use background blending you must ensure the following:

  1. You have checked with Font_CacheAddr that FontManager supports this bit (bit 11), as versions earlier than 3.35 will complain if this bit is set;
  2. Font colours specify one or more anti-aliasing colours, else the Font Manager will use 1bpp (non-aliased) painting.

As blending is slow, it should be avoided on known uniform backgrounds.

Alpha/Supremacy Blending

An extension to the regular background blending functionality is alpha/supremacy blending. This blending mode takes into account the alpha/supremacy value of the screen pixels, allowing text to be overlaid on top of images that are to be displayed in an alpha-blended manner. The opacity of the text can also be adjusted by specifying a supremacy value when setting the font foreground colour (e.g. by ColourTrans_SetFontColours or Font_SetFontColours).

Before attempting to use alpha/supremacy blending you must:

  1. Check with Font_CacheAddr that FontManager supports this bit (bit 14), as versions earlier than 3.60 will complain if this bit is set;
  2. Both bits 11 and bit 14 of the Font_Paint flags must be set (the requirements for background blending must also be met);
  3. You are rendering to a 16M colour (32bpp) or 4K colour (16bpp) screen mode (i.e. each screen pixel has 8 or 4 bits of alpha/supremacy available). Attempting to use alpha/supremacy blending in other modes will result in an error.

For screen modes with an alpha channel (bit 15 of Mode Flags set), the top byte (in 16M colour, 32bpp modes) or nibble (in 4K colour, 16bpp modes) is used to store the alpha, with 0 treated as fully transparent and 255 (or 15) as fully opaque.

For screen modes without an alpha channel, the top byte/nibble is treated as supremacy, with 0 treated as fully opaque and 255 (or 15) as fully transparent. Note that only a handful of RISC OS APIs deal with supremacy correctly, so using an alpha format screen mode is recommended where possible.

Note that alpha/supremacy font blending is significantly slower than standard background blending, and so should be avoided where possible (i.e. background is known to be fully opaque, and font foreground colour doesn’t specify any transparency).

See also

  • Font_Paint
  • Control Characters
  • Font_Paint Block
  • Font_Paint Flags
  • Font_Paint String Forms?
  • Font Background Blending
  • Font Transformation Matrix
Revision from December 8, 2013 13:03:55 by Chris (121)?
Forward in time (to current) | Back in time (3 more) | See current | See changes | History | Rollback | Linked from: Font Background Blending, Font String Forms, Font_Paint Special Characters, Font_Paint Flags, Font_Paint Special Characters Parameters, FontManager Technical Details

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 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