AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry
     R0 = reason code
           0 Display sprite
           1 Get palette
           2 Make pixel translation table
           3 Make scaling table
           4 Display sprite scaled
           5 Copy sprite
           6 Copy sprite area
           7 Remove duplicate names
           8 Copy sprite area sprite by sprite
           9 Check if sprite needs to be transformed
           10 Global replace
           +256 for user sprite area, R2 points to sprite name
           +512 for user sprite area, R2 points to sprite
     unless otherwise specified :
     R1 = sprite control block pointer (or +1 for Wimp sprite pool)
     R2 = sprite pointer
     other registers as appropriate for reason code

This SWI performs various operations on sprites, including displaying them onto the screen (or printer).  Note that these calls need ColourTrans if you are using them with 256-colour sprites.  Sprites in the system sprite area are not supported.

Provided by SpriteOp
Display sprite
Entry
     R0 = 0
     R3 = x coordinate (OS units)
     R4 = y coordinate (OS units)
     R5 = plot action

Plots the specified sprite on the screen. This call is mode-independent, so if necessary the sprite is changed size and/or the colours are chosen appropriately.
Get palette
Entry
     R0 = 1
Exit
     R3 -> sprites palette, or 0 if it doesnt have one
     R4 = number of entries in palette

Locates the specified sprites palette.
Make pixel translation table
Entry
     R0 = 2
     R3 -> block to contain table (1 byte per colour)
Exit
     block contains pixel translation data

Calculates a pixel translation table for displaying the specified sprite in the current mode.  If the sprite has no palette then the desktops colours are used.
Make scaling table
Entry
     R0 = 3
     R3 -> 16-byte block to contain table
Exit
     block contains scaling table

Calculates a scaling table for displaying the specified sprite at normal size in the current mode.
Display sprite scaled
Entry
     R0 = 4
     R3 = x coordinate (OS units)
     R4 = y coordinate (OS units)
     R5 = plot action
     R6 -> sprite scaling table :
           R6 + 00  x multiplier
           R6 + 04  y multiplier
           R6 + 08  x divisor
           R6 + 12  y divisor

Plots the specified sprite on the screen, scaled according to the table.  This call is mode-independent, so if necessary the sprite is changed size and/or the colours are chosen appropriately.  The sprite is first scaled to be the correct size in the current mode, then the specified scaling table is used.
Copy sprite
Entry
     R0 = 5
     R3 -> destination sprite area (or +1 for Wimp sprite pool)

Copies the specified sprite into the destination sprite area. Gives an error if there isnt enough room. Note that sprites with duplicate names will NOT be overwritten; you will end up with two sprites with the same name (use WimpExt_SpriteOp 7 to remove duplicate names).
Copy sprite area
Entry
     R0 = 6
     R1 = source sprite control block pointer (or +1 for Wimp RMA sprite pool, or +2 for Wimp ROM sprite pool)
     R2 = target sprite control block pointer (or +1 for Wimp sprite pool)

Copies ALL the sprites from the source sprite area to the target sprite area.  Gives an error if there isnt enough room.  Note that sprites with duplicate names will NOT be overwritten; you will end up with two sprites with the same name.
Remove duplicate names
Entry
     R0 = 7
     R1 = sprite control block pointer (or +1 for Wimp sprite pool)

Checks for sprites with duplicate names. If any exist, all copies except the LAST one will be deleted.
Copy sprite area sprite by sprite
Entry
     R0 = 8
     R1 = source sprite control block pointer (or +1 for Wimp RMA sprite pool, or +2 for Wimp ROM sprite pool)
     R2 = target sprite control block pointer (or +1 for Wimp sprite pool)

Copies ALL the sprites from the source sprite area to the target sprite area. Gives an error if there isnt enough room. The sprites will be copied one by one, with duplicate sprite names removed before each copy. This means that this call, while being slower than Copy sprite area followed by Remove duplicate names, often requires less free memory in the target sprite area.
Check if sprite needs to be transformed
Entry
     R0 = 9
     R3 = mode to check for, or -1 for current mode
Exit
     R0 =     bit     meaning if set
           0     a pixel translation table would be needed
           1     a scaling table would be needed
           2-31     undefined; will be 0 if the sprite doesnt need transforming

Checks whether the specified sprite needs to be scaled or needs a pixel translation table to be plotted correctly in the specified mode.  If either of these things are required, other WimpExt_SpriteOp calls exist to calculate them for you.
Global replace
Entry
     R0 = 10
     R3 = search colour
     R4 = replace colour

Replaces all pixels of colour R3 with pixels of colour R4. This routine isnt very fast, but it works. Currently it wont work with 256-colour sprites.

[sh-index] Back to list of manuals