Re: scaling pixbufs



Tim F <fenn agora dhs org> writes:
> I'm writing a gtk (2.0.2) application that renders a pixbuf in a
> drawingarea, and I'd like the user to be able to "zoom" in and out of the
> pixbuf.  I've gotten this to work quite well using
> gdk_pixbuf_scale_simple, but the pixbuf is large (3000x3000 pixels), and
> zooming in by much more than 2x, as you might guess, causes all kinds of
> memory and swapping troubles.  Is there a way to leave the pixbuf as is,
> and simply alter the pixel ratio of the drawing_area (i.e. a 5x5 pixel on
> the drawing_area corresponds to a 1x1 pixel from the pixbuf)?

Have a look at the EOG source code (it comes with GNOME), it does
this. Basically just scale the area of the pixbuf that's going to be
visible, I think it what it comes down to.

>  One thing that may help is the original image loaded in the pixbuf
> is grayscale, but my understanding is that pixbufs can only be in
> RGB colorspace (so my image takes three times the amount of required
> memory) - is there any support for grayscale pixbufs in a
> development release of gtk+?

Grayscale isn't implemented yet. It shouldn't be that hard to do, if
you want to give it a shot.

Havoc



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