[AD] interpolating rotation routines

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hallo!

I already send a mail similar to this to the list last friday, but since
I didn't get any reply and there were some problems with my email account
I suppose it got lost. But if you received it, I appologize. Note that I'm
not subscribed to the list.

Some days ago I created a set of sprite rotation routines that use
bilinear
interpolation for smoothing the pictures. After 4 days of optimizing
they're
now so fast that my game can actually use them. According to what my test
program says they have about 40% the speed of the original routines. That
test
program (`exrot_i.c') and the rotation routines are included in the
attached
archive. The makefile should compile them in dos and Unix.  If you like to
add
these routines to the Allegro library, just add the few `AL_FUNC' lines
from
`rotate_i.h' to `allegro.h' and concatenate the contents of `rotate_i.c'
to
Allegro's `src/rotate.c'. Please note that the interpolation is performed
on
RGB values rather than HSV. This is many times faster but it's not
perfect.
Very high contrast pictures may be displayed a little incorrectly. Another
point to mention is, that edges between transparent pixels and
non-transparent
pixels are smoothed by interpolating with the background pixels. This kind
of
smoothing is not done at the sprite's borders. That's why sprites which
need
smooth edges should be surrounded by a border of transparent pixels. This
method is necessary to make it possible to use rotated sprites for tiling.

During development I noticed that `makecol' sometimes returns strange
colors
in 8bit mode. Try the program `maybebug.c', included in the attached
archive
and you'll see what I mean. That program tries to generate gradients from
red,
green and blue to white. For some reason the blue->white gradient contains
some very dark colors. This occured with version 3.9.30 and 3.9.31.

There also seems to be a bug in the `text_printf' routine. When I do the
following:

   textprintf (b, f, x, y, c, "%03i", ammu);

the output should be a 3 digit integer, as long as `ammu' is in the range
0...999. But for some reason all numbers greater than or equal to `950' 
are displayed by 4 digits `0950' etc., which messes up my display. I found
that problem when working with version 3.9.31.

Bye,	
							David Kühling


-- 
Sent through Global Message Exchange - http://www.gmx.net

Attachment: rotate_ip.tar.gz
Description: Unix tar archive



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/