Slicing and Dicing Images

Hi all,
What is the preferred way to slice and dice images.

If I have an animation seqence in one BMP file.

I would like to use it at run-time. Do most of you just store the one
bitmap and cut the image you need when the frame is required of do you
chop each animation up and store it in it’s own PSDL_Surface for each
frame of the animation?

Which method is handled quickest by SDL, keeping in mind there may be a
need for certain levels of surface transparency ( not pixel level ).

Thanks,

Dominique
http://www.DelphiGamer.com := go on, write a game instead;

Hi Dominique,

You should calculate rectangles for each frame and then
simply SDL_BlitSurface(all_frames_surface, SDL_Rect from, …)
So, you need to use proper SDL_Rect from.

–Evgeny

Dominique Louis wrote:

Hi all,
What is the preferred way to slice and dice images.

If I have an animation seqence in one BMP file.

I would like to use it at run-time. Do most of you just store the one
bitmap and cut the image you need when the frame is required of do you
chop each animation up and store it in it’s own PSDL_Surface for each
frame of the animation?

Which method is handled quickest by SDL, keeping in mind there may be
a> need for certain levels of surface transparency ( not pixel level ).

Thanks,

Dominique
http://www.DelphiGamer.com := go on, write a game instead;

If I have an animation seqence in one BMP file.

I would like to use it at run-time. Do most of you just store the one
bitmap and cut the image you need when the frame is required of do you
chop each animation up and store it in it’s own PSDL_Surface for each
frame of the animation?

It’s much easier than that. Simply store the animation in a single
surface the way you normally would. When blitting, use the second
parameter “srcrect.”

Which method is handled quickest by SDL, keeping in mind there may be
a need for certain levels of surface transparency ( not pixel level ).

I dont’ honestly know. I’d bet there’s not a huge difference between
slicing up the image before hand, and just blitting select areas using
a source rectangle.On Sep 12, 2004, at 5:42 PM, Dominique Louis wrote:

Thanks,

Dominique
http://www.DelphiGamer.com := go on, write a game instead;


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I dont’ honestly know. I’d bet there’s not a huge difference between
slicing up the image before hand, and just blitting select areas
using a source rectangle.

Well, that’s not necessarily a safe bet. It depends on the details of
the individual application, of course, but I managed to get a small
performance improvement in my program by slicing up the source data so
that each image was being blit from a separate surface.

b

I think also that images stored RLE might cause a performance hit if you’re
trying to grab arbitrary parts of them (rather than blitting the whole thing).

At least, I vaguely remember a comment like that, and it seems believable. :wink:

-bill!
bill at newbreedsoftware.com Man, some trip this turned out to be.
http://www.newbreedsoftware.com/ All we caught is a tire, a boot,
New Breed Software a tin can and this book of cliches.On Mon, Sep 13, 2004 at 11:17:15PM -0700, Brian Raiter wrote:

Well, that’s not necessarily a safe bet. It depends on the details of
the individual application, of course, but I managed to get a small
performance improvement in my program by slicing up the source data so
that each image was being blit from a separate surface.