gdk_pixbuf_rotate_simple



I have a need to rotate GdkPixbufs in angles that are integer multiples
of 90 degrees (0, 90, 180, 270). My application is in Python, and I
currently do it in Python, using gdk_pixbuf_copy_area (via the PyGTK
binding) for each pixel. This is a tad slow, so I would like to have a C
function doing that. The code itself is fairly simple (I found some in
GQview, which has a similar need), but I've had trouble calling it
properly from Python. My life would be much simpler, if Gtk+ would
contain such a function, so I tried to make something that would drop
easily into the library.

The code is at http://liw.iki.fi/liw/gdk-pixbuf-rotate/ (separate files
and a tarball). Unfortunately, I'm not now able to compile CVS versions
of Gtk+, but the code should drop in easily. It consists of a new file
(gdk-pixbuf-rotate.c) and a few new lines to be inserted into
gdk-pixbuf/gdk-pixbuf.h.

The function is called gdk_pixbuf_rotate_simple, and only rotates in
angles that are integer multiples of 90 degrees. I was advised on #gtk+
that this was a better name than the more general gdk_pixbuf_rotate.

While I used the GQview code as an example, I wrote this code from
scratch, so there should be no license issues (GQview beig GPL, not
LGPL). Anyway, the code is simple enough that it almost doesn't warrant
copyright protection at all.

I am not particularly familiar with the Gtk+ code, or the development
community, and my code may contain stupidities, so hopefully someone
will review and point out defects.

I have also included a simple test program, test-rotate.c, which reads a
file and writes it out rotated in all four different ways.

(I do not subscribe to gtk-devel-list, so I would appreciate Cc's.
Thanks)




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