Re: Invisible GtkImage



Hey Kip,

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.

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.

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.

On ו', 2013-06-21 at 11:33 +0300, Anatoly Krasner wrote:


---------- Forwarded message ----------
From: Kip Warner <kip thevertigo com>
Date: Fri, Jun 21, 2013 at 4:10 AM
Subject: Re: Invisible GtkImage
To: אנטולי קרסנר <tombackton gmail com>
Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>


On Thu, 2013-06-20 at 17:59 -0700, Kip Warner wrote:
On Wed, 2013-06-19 at 14:03 +0300, אנטולי קרסנר wrote:
I have another idea for you: In the Gnome Mines game (which you
can
probably find on git.gnome.org) written in Vala, the game board
has a
fixed ratio and resizes with the window, exactly like your
requirement.

Go there and see how the MinefieldView and Window classes word.

Hey Tom. So I'm looking through his gnome-mines.vala and I see in
his
startup_custom_game_screen () function he is creating the
GtkAspectFrame
as I do. I think the key difference is the child he is using is a
GtkGrid which already knows on how to resize inside of anything,
whereas
the GtkImage does not.

I'll keep looking through his code and fiddling with my own, but any
help appreciated.


Ah hah. So I noticed something. When I set the shadow type to NONE in
the AspectFrame, the recursive resizing stops. I can make the window
larger, but not smaller. Hmm...

--
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com







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