Noone else has answered this, and it’s something I was interested
in hearing the answer to, so I’ll try to, based on what I’m seeing
in the header files (e.g., SDL_video.h)
I am trying to integrate the RLE encoding into my program. But I have a
few questions about the RLE encoding.
Does it have to do anything with the colorkey?
Yes. RLE is used for colorkey and alpha blits.
Is every color encoded, or just the color key?
That I’m not sure of. I’d assume so, otherwise it’d be kind of
difficult to RLE any of it. I believe RLE’ing is generally useful
for low-color surfaces (things you’d use for sprites). When you
start getting into more color variation across pixels, your encoding
will likely come out as: “one pixel of a,b,c. one pixel of x,y,z.” etc.
It’s still probably useful when you’ve got large transpareny zones.
Note, though, that if a surface is RLE’d, it must be locked.
(SDL_MUSTLOCK() is a macro that checks whether the surface is RLE accel’d,
among other things… such as it being a hardware surface).
Will the surface get reencoded, when changing the color key?
I think that would depend on the above. If all pixels are RLE’d,
then there’d be no reason to re-encode if the colorkey changed.
It’d simply just skip a different batch of pixels when blitting
(the once which match the transparency color key).
Can the RLE encoding be used without a color key on the surface?
It see that SDL_SetAlpha() and SDL_ConvertSurface() also accept
the SDL_RLEACCEL flag, so it doesn’t specifically need to be
color-key.
When i call SDL_SetColorkey(), SDL_SetAlpha etc., does it reset the RLE
flag, if it is not passed? So, when using a RLE encoded surface, do I
have to pass the RLE flag, to all functions, that accept surface flags?
The header file seems to suggest so:
SDL_SetColorKey()…
“SDL_RLEACCEL requests RLE acceleration for the surface if present,
and removes RLE acceleration if absent.”
SDL_SetAlpha()…
“OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.”
SDL_ConvertSurface()
“The ‘flags’ parameter is passed to SDL_CreateRGBSurface() and has those
semantics. You can also pass SDL_RLEACCEL in the flags parameter and
SDL will try to RLE accelerate colorkey and alpha blits in the resulting
surface.”
Also… SDL_DisplayFormat() uses SDL_ConvertSurface() internally.
Thanks for your answers
I hope that shed some light… and that if I got anything wrong, someone
else will finally respond. Heheh.On Mon, Apr 06, 2009 at 05:36:06PM +0200, Christian Meyer wrote:
–
-bill!
Sent from my computer