Plotting Sprites
Bill Antonia (2466) 130 posts |
I’m plotting a sprite in a window in a 16 million colour mode using OS_SpriteOp 34 with plot action of 0. If the sprite is a 16 million colour sprite all is ok, wheras if the sprite is of a 256 colour mode such as 28 and also has a mask and palette it’s showing up in a grey scale. Any ideas why it’s not using the palette? !Paint displays the sprite with no problem. Thanks in advance |
Rick Murray (539) 13806 posts |
Are you doing all the ColourTrans lookup table mojo, or just trying to dump a 256 colour sprite into a 16M colour mode? |
Stuart Swales (8827) 1348 posts |
It’s often easiest to use Wimp_PlotIcon to sort out all the ColourTrans stuff and scaling. |
Bill Antonia (2466) 130 posts |
Just had a look at the ColourTrans calls, I couldn’t see how they would affect plotting of a sprite with an existing palette table. ColourTrans appears to enable you to select colours from one mode and get the nearest in another. I cannot find a OS_SpriteOp which plots forcing it to use its palette table along with ColourTrans directly. Had a quick look at Wimp_PlotIcon, I’ll have to look at it in more detail. |
Bill Antonia (2466) 130 posts |
Do I have to build another palette table using ColourTrans calls for the current mode then use OS_SpriteOp to plot? That is to translate the colours into the new palette |
Rick Murray (539) 13806 posts |
It’s not a palette so much as a translation take to get the system to know how to map the colours in your 256 colour sprite (which could well be the VIDC1 funky weirdness) to the actual colour values to put into screen memory. So, you have a sprite. The sprite has a palette. It now needs to be “translated” into whatever the current screen mode is. Technically you’d need to do this anyway, because your sprite has a palette, which means that “colour 7” could be just about anything. You may not have changed the palette from the default; or you may have black, white, and two hundred and fifty four shades of green… This isn’t that hard. I’m in bed (slept poorly last night, as usual, so I’m shattered) but from memory you just give ColourTrans your sprite and tell it what mode you’re using (or cheat and say -1 for the current mode) and it’ll hand back a translation table which you then give to the SpriteOp call to get the correct colours on screen. https://www.riscosopen.org/wiki/documentation/show/ColourTrans_SelectTable |
André Timmermans (100) 655 posts |
OS_SpriteOp 34 is just for fast plotting when screen and sprite are compatible as it says: “This call does not attempt to translate between different palettes, pixel formats or colour depths.”. |
Bill Antonia (2466) 130 posts |
Just tried OS_SpriteOp 52, looks promising, hadn’t noticed the translation table part, will continue tomorrow. It did give an error when I passed 0 for the translation table when trying to plot my mode 28 sprite to indicate no table, but reading the PRM’s it will do this when the bits per pixel are incorrect. Thank you, I will create a translation table and test again. |
Bill Antonia (2466) 130 posts |
Yes, OS_SpriteOp 52 with a translation table worked, different colours as I’ve initially filled it in with a linear 0..255, and it plotted in the correct aspect ratio even though I passed no scaling. Now to sort out the correct values for the table. |
Bill Antonia (2466) 130 posts |
ColourTrans_GenerateTable &40763 worked a treat. Thank you |