[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Fast simple transposition (90-degree rotation)?



It's special-casing multiples of 90 since at least 1.7.1, from what I
read in the source.

In fact, there looks to be a subtle bug in how it detects them, but
I'll make a separate post for that.

-FM

On 6/10/08, Terry Hancock <hancock@xxxxxxxxxxxxxxxxxxxx> wrote:
> What's the best way to do (exact) 90-degree rotations in PyGame?
>
> There doesn't seem to be a separate "transpose" operation in the
> "transform" module (I.e. an operation that swaps x & y coordinates).
>
> Does the "rotate" function special-case 90-degree interval rotations?
>
> Or is it more efficient to convert a PyGame Surface to a Python Imaging
> Library image and then transpose that? (PIL does have a separate
> "transpose" method).
>
> How efficient can this be? If I need to get a mirror image or a
> transposition of an existing surface (say a full-screen 1024x768 image),
> is it worth caching the result to disk? Or would it be faster to just
> flip it in memory whenever I need it? (IOW, how does a 90-degree
> rotation or a "flip" compare to a disk I/O on most computers?)
>
> BTW, I tried to look this up, but I can't find a discussion of it in the
> documentation, and wasn't sure how to look it up in the ML archives.
>
> Thanks,
> Terry
>
> --
> Terry Hancock (hancock@xxxxxxxxxxxxxxxxxxxx)
> Anansi Spaceworks http://www.AnansiSpaceworks.com
>
>