Please help with scaled sprite put
Michael Grunditz (467) 531 posts |
I have a rgba buffer I need to put to screen and have the correct colours on my ARMX6. I wonder if a:) WIll it work with scaled put? and b) how do I use it.? All atempts so far have failed. |
Matthew Phillips (473) 721 posts |
Are you trying OS_SpriteOp 52 (Paint sprite scaled)? Do you only have the array of pixels? If so, you would need to put a sprite header on the front to use that call. |
Michael Grunditz (467) 531 posts |
I have a sprite with rgb data in it. It is Colour trans I have problems with. |
Michael Grunditz (467) 531 posts |
I have tried to to read the docs … I can’t find info how to translate from rgb to bgr.. I am using cairo to render to the spritedata , and cairo doesnt have bgr modes on surfaces (afaik). |
Michael Grunditz (467) 531 posts |
OK. I implemented byte switching , and that works , takes some time . |
Rick Murray (539) 13840 posts |
I don’t know what Cairo is, but have you checked that the sprite type information is correctly identifying the sprite as RGB rather than the usual BGR? It should have a RISC OS 5 style mode sprite word: Where the mode flag bits 12-15 describe its colour format: Rummaging around SpriteExtend (which is really weird!) it does look like it ought to “just work”. |
Michael Grunditz (467) 531 posts |
I have been tracing the wiki , but I havent found a clear path! |
André Timmermans (100) 655 posts |
From my own WimpLib:
|
Jeffrey Lee (213) 6048 posts |
Another example: https://gitlab.riscosopen.org/RiscOS/Sources/Video/Render/SprExtend/blob/master/Test/c/bigtest#L807 This is for a single-tasking test app, so it doesn’t use Wimp_ReadPixTrans (which I think is only needed in André’s code because the Wimp uses a different default palette for low-colour sprites/modes than the rest of the OS uses) Also, both of the examples are naughty and don’t read the required size of the translation table (by making an initial call to ColourTrans_SelectTable / ColourTrans_GenerateTable with R4=0).
You need to set bit 5 of the OS_SpriteOp 52 flags. Basically bit 5 of the OS_SpriteOp flags must match bit 4 of the ColourTrans flags. |
Michael Grunditz (467) 531 posts |
Thanks for all help. I haven’t implemented this yet, but I need to do it soon. |
André Timmermans (100) 655 posts |
Unfortunately bit 5 of OS_SpriteOp 52 was not documented in the PRM Volume5, which left me puzzled as to the purpose of the ColourTrans flag if OS_SpriteOp could not make use of the output. |