After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 95865 - gdk_pixbuf_rotate_simple
gdk_pixbuf_rotate_simple
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 140830 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-10-15 21:30 UTC by Lars Wirzenius
Modified: 2010-07-10 04:07 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Lars Wirzenius 2002-10-15 21:30:49 UTC
I have written a function to rotate GdkPixbufs in 90 degree angles. The
code is available at http://liw.iki.fi/liw/gdk-pixbuf-rotate/ (sorry, no
patch, but it's one new file, plus a few lines to be inserted into
gdk-pixbuf.h).
Comment 1 Owen Taylor 2002-10-16 18:50:22 UTC
Haven't really looked at the implementation or the API , but a few 
thoughts:

 - A _simple() function without having the normal variant is
   a little odd.

 - It might be better to actually use a double angle parameter
   in degrees and say that only 90 degree increments work
   than to have the enum.    
Comment 2 Lars Wirzenius 2002-10-16 19:40:58 UTC
I discussed the interface on #gtk+ before implementing it. My first
proposal was

GdkPixbuf *gdk_pixbuf_rotate(GdkPixbuf *src, gdouble angle);

However, the interface in the implementation was suggested to me to
make it painfully clear to the caller that the function is not a
general rotation function. The implicit goal is to have the general
function call one of the internal rotate_NN functions for the special
cases and maybe even remove the _simple function after a general one
is written.

I can, of course, live with either interface and would be happy to
change it to whatever is deemed best. (I'll even take a stab at the
general function once I find a clear description of a good algorithm
for it, but that may take a while.)
Comment 3 Manish Singh 2002-10-16 21:00:24 UTC
I like the enum better since it makes things absolutely clear. I'd also
add CLOCKWISE and COUNTERCLOCKWISE aliases.
Comment 4 Matthias Clasen 2003-12-02 00:41:51 UTC
I also prefer the enum interface. Additionally I'd prefer a different
name, since I would expect a general gdk_pixbuf_rotate () function to 
do filtering and it would be strange to have it return an unfiltered
result for 90 degrees and a filtered one for 90.0005. Maybe a
different name, like gdk_pixbuf_turn() or gdk_pixbuf_flip() would help
to clarify the difference.
Comment 5 Owen Taylor 2003-12-10 16:46:39 UTC
I don't have a good name suggestion, though if we are going
to go with the enum approach, we might as well add
FLIP_HORIZONTAL/FLIP_VERTICAL, though that makes the
naming even a bit worse,

I don't like the idea of CW/CCW aliases ... I think having
multiple names confuses things.
Comment 6 Matthias Clasen 2003-12-10 20:06:25 UTC
Might also throw in the two flip-and-rotate combinations. How about
gdk_pixbuf_reorient() ?
Comment 7 Lars Wirzenius 2003-12-10 20:28:03 UTC
I have since written an arbitrary rotation function, which I've now
added to the page, as rotate-new.c. The new function special cases
normalized angles 0.0, 90.0, 180.0, and 270.0 and uses a generic one
for the other cases. Thus, there is only one exported function:

GdkPixbuf *
gdk_pixbuf_rotate(const GdkPixbuf *src,
                  gdouble degrees,
                  guint32 fill_pixel,
                  gint algorithm)

I've been told that the fill_pixel should be done in a better way, but
I have since forgotten how.
Comment 8 Manish Singh 2003-12-10 21:22:09 UTC
I like rotate_simple. It's also easier for people looking at the
header or API reference to find a rotation operation, rather than
strange nonstandard terminology.

If we want to have flip functionality, that should be a separate function.
Comment 9 Owen Taylor 2004-04-23 14:23:22 UTC
*** Bug 140830 has been marked as a duplicate of this bug. ***