[Select]

Graphics


Index

 

ConvertSprite

The ConvertSprite module provides a proxy conversion for the ImageFileRender routines to the ImageFileConvert module. This means that the renderers provided by ImageFileRender can be be used as sources for a conversion to sprite. For example, the Artworks ImageFileRender is proxied by the ConvertSprite module so that an Artworks to Sprite conversion is possible.

In addition, the ConvertSprite module provides a means by which sprites can be created from an arbitrary rendering routine, in a similar manner to that used by the DragAnObject module.

SWIs

SWI ConvertSprite_CreateSprite
On entry
   R0 = flags :
         bit 0 = use mask
         Others reserved
   R1 = image width in OS units
   R2 = image height in OS units
   R3 = mode to use, or -1 for current
   R4 = pointer to palette, or -1 for none, or unused for deep modes
   R5 = pointer to sprite buffer, or 0 to read buffer size
   R6 = size of sprite buffer
   R7 = SWI number to call
   R8 = pointer to 10 register block to pass to SWI
   R9 = background colour
On exit
   R6 =  size of sprite buffer needed (if R5=0 on entry), 
         size of sprite buffer used (if R5<>0 on entry

This SWI is used to create a sprite of a given type using any arbitrary rendering routine. This allows clients to convert images which would usually be rendered to the screen to sprites.

Introduction

The ImageFileFileConvert module provides an interface for converting between different image formats through a simple defined interface. Whilst this interface may not be perfectly suited to all image formats, it can be extended through flagged operations to provide greater flexibility and to allow more functional conversions to be made.

Because ImageFileConvert and ImageFileRender complement one another it is recommended that users of either familiarise themselves with the other.

ImageFileConvert_Convert (&56840)
On entry
   R0 = flags for operation :
         bit 0-7 = Reserved for options common to output filetype
         bits 8-15 = Reserved for options common to input filetype
         bits 16-23 = Reserved for options specific to the input/output pair
         bits 24-31 = Reserved
   R1 = conversion requested :
         bits 0-11 = Destination filetype
         bits 12-15 = Reserved, must be 0
         bits 16-25 = Source filetype
         bits 26-31 = Reserved, must be 0
   R2 = pointer to input image data
   R3 = length of input image data
   R4 = pointer to output image buffer, or 0 to read size
   R5 = size of output image buffer, or 0 to read size
   R6 = background colour, or -1 for default (may be ignored by some converters)
   R7-R9 = passed to conversion process
On exit
   R5 = size of output image buffer required, or -1 if not known (if R4 = 0 on entry),
        size of output image buffer used (if R4 not 0 on entry)

This SWI is used to convert an image from one format to another.

Flags common to output type 'Sprite'

Because Sprite is a common type to convert to a number of flags are defined as being used for all conversions.

  bit 0: Create a sprite, rather than a sprite file (this option is provided
         by the ImageFileConvert module)

bit 1-7: Reserved

Flags common to output type 'JPEG'

Because JPEG is a common type to convert to a number of flags are defined as being used for all conversions.

   bit 0: Output JPEG will be monochrome (otherwise it will be colour)
   bit 1-3: Quality control :
               0 = 75% (the default level)
               1 = 12%
               2 = 25%
               3 = 37%
               4 = 50%
               5 = 62%
               6 = 75%
               7 = 88%

The duplication of 75% in both 0 and 6 is to allow users to leave the flags unset and get a sensible default conversion quality.

   bit 4-7: Reserved

Flags common to input type 'Sprite'

Although sprite is a common filetype to convert from none of the flags are reserved for all conversions.

    bit 8-15: Reserved
ImageFileConvert_MiscOp (&56841)
On entry
   R0 = flag bits :
         bits 0-7 =  Reserved for options common to output filetype
         bits 8-15 = Reserved for options common to input filetype
         bits 16-23 = Reserved for options specific to the input/output pair
         bits 24-31 = Reserved
   R1 = conversion requested :
         bits 0-11 = Destination filetype
         bits 12-15 = Reserved, must be 0
         bits 16-25 = Source filetype
         biys 26-31 = Reserved, must be 0
   R2 = pointer to input image data
   R3 = length of input image data
   R4 = operation type :
         &000-&3FF Reserved for generic operations on all conversions
         &400-&7FF Reserved for operations specific to the output type
         &800-&BFF Reserved for operations specific to the input type
         &C00-&FFF Reserved for operations specific to the input/output pair
         Other, Reserved for future expansion
   R5-R9 = misc op parameters
On exit
   R0-R9 updated by conversion module

This SWI is used to provide miscellaneous operations to obtain information about the conversion process.

Operations common to the output type 'Sprite'

On entry
   R4 = &400 (Read information)
   R5-R9 undefined
On exit
   R0 = width in pixels of image
   R1 = height in pixels of image
   R2 = bits per pixel in the image
   R3 = image flags :
         bit 0 = Image has a palette (if On exit 8bpp)
         bit 1 = Image is colour (otherwise image is greyscale)
         bit 2 = Image has alpha channel or mask
         bits 3-5 = Interlace type:
               0 = No interlacing
               1 = Adam7 interlacing
               2 = Vertical interlacing
                 Others Reserved
         bits 6-31 Reserved
   R4 = x DPI
   R5 = y DPI

This operation reads information about the image which is common to most bitmap-type operations.

ImageFileConvert_Register (&56843)
On entry
   R0 = flags (reserved, must be 0)
   R1 = pointer to definition (all will be copied):
         +0 API version (100)
         +4 converter flags
               bits 0-31 = Reserved, must be 0
         +8 converter type :
               bits 0-11 = Destination filetype
               bits 12-15 = Reserved, must be 0
               bits 16-25 = Source filetype
               bits 26-31 = Reserved, must be 0
         +12 pointer to name of converter in form :
               <name><tab><version x.xx><tab><author>
         +16 workspace value for r12
         +20 pointer to conversion routine
         +24 pointer to miscop routine
On exit
   R1 = API version (even if an error occurs)
   All other registers preserved

This SWI is used to register a new converter.

ImageFileConvert_Deregister (&56844)
On entry
   R0 = flags (reserved, must be 0)
   R1 = filetype pair
   R2 = pointer to name to be copied in format :
             <name><tab><version x.xx><tab><author>
On exit
   All registers preserved

This SWI is used to deregister a converter.

ImageFileConvert_EnumerateConverters (&56845)
On entry
   R0 = flags (reserved, must be 0)
   R1 = last filetype pair, or -1 for the first call
On exit
   R0 = pointer to renderer definition (read only)
   R1 = this filetype pair, or -1 if no more

This SWI is used to enumerate the currently registered converters.

ImageFileConvert_ConverterInfo (&56846)
On entry
   R0 = flags (reserved, must be 0)
   R1 = filetype pair
On exit
   R0 = pointer to renderer definition (read only)
   R1 = pointer to renderer name

This SWI is used to read information on a conversion. If no conversion can be performed for the requested types, an error will be returned.


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