[Glade-users] Highlighting images.
John Coppens
john@jcoppens.com
Tue, 3 May 2005 22:06:50 -0300
On Tue, 03 May 2005 23:30:21 +0200
kappa <kappka@tlen.pl> wrote:
>
> Hello Glade-Users!
>
>
> I'm writing an educational game for learning geography.
> I need to display some map from file(for example Europe) and after
> moving mouse cursor
> over some country, I need that country to highlight and after moving
> the cursor out of the country
> area, the country region should be darker again.
>
> 1) I don't know the tehniques for doing such things. Should I use some
> black-and-white masks
> for each country to know which area to highlight?
I'd suggest using gnome_canvas. You can then add another layer (image)
which can be even half-transparent to mask the other countries - or even
a lot of layers at the beginning and hide/show the layers one by one.
> 2) I have problems with drawing on the GtkImage area when I read-in
> some image (with 'gtk_image_set_from_file')
> I used the description from:
> http://www.klaban.torun.pl/help/GtkTutor/gtk_tut-23.html
> but I can draw only on the area, where 'gtk_image_set_from_file' didn't
> put any pixel. It seems like the
> data from file were put at the screen after my drawing(??)
Again, I'd suggest using the canvas, which will give you the possibility
to draw on another layer, which makes it easier to clear if necessary.
Check the GTK+ / Gnome Application Development, chapter on GnomeCanvas.
John