[Select]

Graphics


Index

 

PNG module

The PNG module supplies a shared interface to the PNG library. Due to the work of many developers, including Acorn, the PNG library is quite generic and can produce its output or read its input in a number of ways.

In general the SWI interface is exactly the same as that of the PNG library. When there is time this will be documented more formally, but the general principles are :

  • Functions are split into categories which will are accessed via SWIs
  • Each SWI has as R0 giving the sub-code for the function being accessed.
    [Reason: There's not enough SWIs in a chunk for all of the functions to have one each]
  • Input values are in the registers going into the SWI.
    Values are returned in R0.
    Output values are in the registers coming out of the SWI at the next free register (R0 if there is a return parameter, or R1 if not)
  • Floating point values are returned (or passed) scaled by &10000 (i.e. converted to fixed point values with the point at bit 16.
Example
   png_uint_32  png_get_gAMA  (png_structp png_ptr, png_infop info_ptr, double *file_gamma)  ;

Becomes:

SWI

PNG_GetChunkInfo
On entry
   R0 = 2 (reason code for get_gAMA)
   R1 = pointer to png structure returned from create_read_struct
   R2 = pointer to png information structure returned from png_create_info_struct
On exit
   R0 = returned value (0 if no gAMA chunk, non-0 if gAMA chunk present)
   R1 = gamma value * &10000
Caveats

The cHRM (chromaticity) chunk is not currently supported. The implementation is such that this cannot work the way that the SWI interface is currently designed.

More information

Firstly, you should read the documentation supplied with PNGLib. This will provide you with most of the necessary information. More information, together with a development kit, is available on request.


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holders permission. RISC OS is subject to continuous development and improvement as such all information is reproduced by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version 1.03 3rd November 2015