> i am using an eventbox in which i have created an image widget > which displays widgets. I want to crop a part of this image now, so > i first need to select a portion of this image using the mouse. > What i need to do is to highlight or in some way show the user what > he/she has selected on the image. Could someone please help me out.
Urgh... Scarry question. How'd you get the image? Take a screen shot of some widgets and save them to a picture? Did you want to highlight the image rubber-band style, or highlight specific widgets as they they were real widgets? I'd probably try to construct the widget set, and capture a snapshot yourself, you may even be able to trick them into highlighting for a second snapshot and walk the list to get their bounding regions, if that's needed -- that kind of thing's been discussed here before too. In any case, load your image into a GdkPixbuf, and then build your GtkImage out of that. You can then fiddle with the GtkImage's personal pixbuf, leaving the original untouched for reference. Check out some basic image processing tutorials, there was a good one posted in this group just recently, I believe. For rubber banding, that's about all you need to do, widget wise. Watch the mousey, draw a box from the mouse down to the mouse up location, and optionally fill it translucently also for that modern feel. There are functions provided by Glib (or is it Gdk?) for playing with regions; to figure out which parts need to be drawn, which parts need to be restored, and which parts can be left alone. To make widgets highlight on your image, you'll probably need two source images, and the bounding region of each widget. But the deal's the same. Copy data from source image to the GtkImage using basic image processing techniques, or the provided image compositing functions (probably the better idea here), and off you go. Either technique on its own should be fairly simple, though for cropping the rubber band would certainly be the more useful. Combining the two approaches would probably turn out pretty cool... Could be a bit fiddly though, especially if you want to avoid rendering the widgets and the rubberband in seperate stages (which would probably mean re-rendering a good deal of the rubber band each time). I wonder if a new GtkBin could be constructed to act as a rendering buffer for applying visual effects to widgets? Hmmm..... Fredderic _______________________________________________ Join Excite! - http://www.excite.com The most personalized portal on the Web! _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list