Re: scaling a GdkImage



David Cooke <d j cooke lineone net> writes: 
1  Why was this facility never provided in gdk 1.2 ?

The same reason any of the thousands of features that could be there
but aren't were not provided - no special reason, just didn't happen.

2  Would it still be worth providing it in gdk 2 ?


The way we'd do this in GTK 2 is to get the pixmap pixels as a
GdkPixbuf (gdk_pixbuf_get_from_drawable()), scale the pixbuf with
gdk_pixbuf_scale(), then draw the pixbuf back to a drawable.  We
encourage using pixbufs instead of GdkImage because GdkImage's variety
of pixel formats makes it quite difficult to deal with.
 
For example here you are having to use the "nearest" scaling algorithm
and I think you'd find implementing any of the other scaling
algorithms quite challenging for all 20 or so image formats.
And "nearest" pretty much sucks quality-wise.

I doubt using images is even much faster than using pixbufs,
especially since you have two function calls in your inner loop.
Pixbufs are not appreciably slow in GTK 2.

I'd sort of like to see a routine that combined scaling and
get_from_drawable() (avoiding the temporary pixbuf and just creating
the scaled one to begin with), but it sure would be a world of pain to
implement and debug.

Havoc



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