RE: Questions about Overlay and multiple key-strokes
- From: "Freddie Unpenstein" <fredderic excite com>
- To: gtk-app-devel-list gnome org
- Subject: RE: Questions about Overlay and multiple key-strokes
- Date: Sat, 28 May 2005 08:29:21 -0400 (EDT)
Question 1. Is it possible to have an image (Jpeg) displayed and
have a drawing area overlayed on top but still be able to view the
image below it. If a drawing area is not allowed, is it possible to
put something that resembles a drawing area over an image where the
x/y coordinates from the mouse can be acquired and marks be left
overtop of the orignal image without altering it.
Ever considered just drawing the image onto the drawing area? ;)
There aren't any real options for transparent overlays. Maybe once RGBA becomes standard in X servers, but
for the time being you'll have to settle for keeping the original image, and copying it onto the drawing area
before drawing your marks. However since drawing areas don't retain the image if they get covered, there may
be a better option...
If you create a GtkImage from a GdkPixbuf, the pixbuf still resides at the heart of the image, and you can
access its pixel data to do your own drawing. Sooo..... Load your image into a GdkPixbuf, clone it (so the
original doesn't get messed up), and turn the second one into a GtkImage to put in your window. You can then
draw on the shown image to your hearts content, and just copy the pixels back from the pristine original
anytime you need to.
I've found the drawing area aproach is good for anything that needs to be rebuilt often, or only has a few
distinct parts, while images are good where the image is mostly static, or where the changes are more
persistant, and you don't mind having another copy of the image kicking around. In an image viewer widget I
put together a while back, I already had up to five potentially large images, and their thumbnails, to keep
in memory (a background image, plus a thumbnail of another image in each corner). The thumbnails needed to
stay fixed when you zoomed or scrolled the main image, so I used a GtkDrawingArea, and just copied regions of
the source images as needed.
On the other hand, I have a small application I rolled together which presents a ripped version of my ISP's
bandwidth usage graph (don't tell the copyright police ;) ) in a neat little window that I just pop to the
top when I want to look at it. All I did was use wget -- turns out it's a https page so wget was easiest
(you may recall that thread right here on this group) -- to fetch the current usage data every 10 minutes,
erase the bar area (which is just three solid colour regions anyhow), and redraw the bar. The result is
almost identical to theirs, except theirs was limited to 5% increments, mine shows an extra colour band
(starting at my average monthly usage), and I don't have to waste a page in my browser (which doesn't survive
the 17 days my applet's been happily running, either).
So it all depends on what it is you're doing. But generally from what I've seen, you'll have a hard time
placing widgets ontop of an image, and an even harder time getting the widgets to be transparent.
Fredderic
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]