The code looks fine. I think the problem is that scaling images are
rarely used in GUI. Usually, they scale to fixed sizes and not directly
depend on a container scaling to arbitrary size. This is probably why
getting the result you want is not easy.

Try the canvas idea. You can probably use any simple drawing area widget
(I never used one personally) from Gtk or Cairo.

On ו', 2013-06-21 at 21:30 -0700, Kip Warner wrote:
> On Fri, 2013-06-21 at 11:46 +0300, אנטולי קרסנר wrote:
> > Hey Kip,
> 
> Hey Tom.
> 
> > You can try to place your image into a 1x1 GtkGrid and see if it works.
> > If not... hmmm... I'm trying to think of an existing Gnome app which has
> > scaling images. Hmmm... probably none. Scaling images (unless in
> > Gimp/Inkspace) to containing widget size is probably rarely done.
> 
> Ok, I tried it with GtkGrid containing the image widget with the parent
> of the former being the AspectFrame. No love. It behaves the same as
> without it.
> 
> > Anyway, here's another idea: You can try to solve the recursive scaling
> > problem by not using all the available space. Try to make the image fit,
> > say 90% of the aspect frame. Then the image is not big enough to cause
> > the aspect frame to rescale (which probably would cause the recursive
> > scaling). You may get a little bit of screen space wasted, but if you
> > don't mind the 10% (maybe you can reduce it to 5% or less) it's okay.
> 
> I think that's a good idea, but I'll try that as a last resort.
> 
> So I've almost got it working. It resizes properly when I make the
> window larger, but the window's width can never be made smaller
> (including after maximization).
> 
>   <http://pastebin.com/q76RJ4UH>
> 
> Can you see anything broken in that?
> 
> > Another idea: Image editing software usually uses a custom canvas and
> > draws things on it, including scaled SVG images. Maybe you can put such
> > a canvas in the aspect frame, possible also inside a 1x1 GtkGrid, and
> > scale the image within the canvas. Then, the image scaling is just a
> > canvas drawing operation and has no effect on the AspectFrame size, and
> > shouldn't cause recursive scaling.
> 
> I don't know much about the canvas. But I'll try it and get back to you.
> 
> Thank you for your help,
> 


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to