MetaSprite
© Cerilica 2022-2023
MetaSprite allows MetaData to be embedded within individual Sprites or (from v0.20) within the whole sprite file, extends the types of Palette that can be created, and fixes several problems with ColourTrans’ handling of 256 colour Sprites.
MetaSprite 0.23 (31 Mar 2023) [32bit]
NEW! I’ve extended MetaSprite’s API to manipulate File MetaData in the sprite file’s Extension Area as well as the existing Sprite MetaData functionality.
Note that despite !Paint being the de facto RISC OS Sprite editor, it dates to RISC OS 2.0 and hence predates some of the APIs that MetaSprite modifies – !Paint is therefore very bad at coping with modified Sprites, and ought to be updated to use the APIs provided by RISC OS 3.0. I don’t think that would be rushing things, under the circumstances. Pleasingly, !Draw seems to manage perfectly.
Most interchange bitimage formats support MetaData in some form, so it’s about time that RISC OS Sprites did too. However, this is not limited to mere Title, Author and Creation Date strings. Instead, MetaSprite turns the Sprite into a chunky image format more akin to TIFF or JPEG, and as such the Sprite can be augmented with arbitrary amounts of binary information, such as an ICC Profile or Exif Camera Settings.
MetaSprite provides the new SpriteOp,39 to deal with Sprite MetaData.
NEW for v0.20 is SpriteOp,23 for dealing with File MetaData in the Extension Area, instead of inside a Sprite.
The module increases the number of Palette types that can be created by SpriteOp,37.
It augments SpriteOp,36 “Set Pointer” with the ability to embed the coordinates of the pointer hot-spot in a MetaData chunk that automatically overrides the provided coordinates when present.
MetaSprite provides support for Truncated Palettes, which make “optimal” and converted Sprites much more memory efficient, especially when 8bpp.
And finally it fixes a number of bugs in ColourTrans regarding 8bpp Sprites.
As this is a complicated subject and this is a programmer’s API, I’m not going to provide any technical details on this page. Download the zip file above. It contains an API document, a lengthy technical explanation, example Sprite and DrawFile exhibits, and a couple of demo programs in legible Basic.
I am currently using MetaData in sprites to implement:
Chroma-keyed transparency
Integral transparency in standard sprite types and palettes
High-precision resolution
Gamma correction and colour management
Pointer hostspots
Image and mask compression (and proxy embedded formats)
Editable data in sprite renderings (e.g. Teletext)
There’s so many other possible applications – a very exciting and powerful module.
Bonus:
Also includes the NoSpriteImage module at no additional charge!
NoSpriteImage formalises and enables a Sprite construction containing no Image pixels, for those Sprites intended to be plotted as a Mask only.
Again, there is a technical document, and a couple of example files.
This is an experiment. I’m not sure how I feel about the results.
Releases
0.10 (21 Feb 2022) Initial candidate
0.11 (04 Apr 2022) Removal of last MetaData chunk removes Data Area
0.12 (22 Apr 2022) Small bugfix to SpriteOp,36 so “HOT” works correctly
0.20 (12 Mar 2023) NEW SpriteOp,23 for File MetaData
0.21 (26 Mar 2023) Bugfix for obscure combination of SpriteOps 37 and 23.