[SDL] how to draw an image mirrored?

Ken Rogoway Ken at HomebrewSoftware.com
Mon Jul 12 10:34:41 PDT 2010


Arguing about whether or not SDL should have that functionality isn't going
to change the fact that it doesn't.  Sam told you that if you want to
provide a patch he would gladly consider integrating it into SDL.

If you want a simple and quick solution at a higher level, just write a
trivial routine to do the following:

1) Create a new image the same size as the one you want to mirrored
2) Read the pixel data from the source image, and write it in reverse on the
dest image.

This approach has two drawbacks:

1) It doubles the memory for any textures you want to have mirrored.
2) It incurs a one-time time hit to create each mirrored image.

However, the big advantage is that blits using the mirrored texture will be
as fast as blits using the original image, regardless if the platform
supports hardware accelerated blitting.

Ken Rogoway

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Mason Wheeler
Sent: Monday, July 12, 2010 12:28 PM
To: SDL Development List
Subject: Re: [SDL] how to draw an image mirrored?

>From: Alex Barry <alex.barry at gmail.com>
>Subject: Re: [SDL] how to draw an image mirrored?
>
>Mason, you seem to be ignoring one fact - that's all new devices.  The
average 
>joe usually doesn't have the most up-to-date system, and may or may not
have a 
>hardware accelerated system available to them.  I would say it's a safe bet
that 
>
>if they don't have a computer that's hardware accelerated, they likely
don't 
>have a hand-held device that is either.

I'm not ignoring that.  I'm taking it into account.  Like I said, all
computers 
that
were new since before the turn of the century have 3D acceleration.  Sure,
not
everyone has a brand new system, but how many people are still using systems
from the 90s.  And how many of those who are actually expect to be able to
play
games created today on them?  If the answer's not "zero" it's close enough
as to
make no difference.

Bottom line, in 2010 "the average joe" is running Windows XP, and has
Direct3D
and OpenGL both installed out of the box whether he knows it or not.

_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




More information about the SDL mailing list