Dear all, I use gtkImageFromFile to display an image. Then I want to do some gsignal to handle mouse event. I click the mouse and move a another position and release. I can get the position of the firs click and the release position, then I would to draw a rectangle to display the region I have selected. I need some hints on what functions should I look for. I tried to google but don't know how. Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html
Michael Lawrence
2009-May-23 13:21 UTC
[R] Draw a rectangle on top of an image using RGtk2?
On Fri, May 22, 2009 at 11:27 PM, Ronggui Huang <ronggui.huang@gmail.com>wrote:> Dear all, > > I use gtkImageFromFile to display an image. Then I want to do some > gsignal to handle mouse event. I click the mouse and move a another > position and release. I can get the position of the firs click and the > release position, then I would to draw a rectangle to display the > region I have selected. I need some hints on what functions should I > look for. I tried to google but don't know how. >The GtkImage widget is just for showing images. If you want to start doing interactive graphics, I'd suggest moving to the more general GtkDrawingArea widget and connecting to the expose-event signal. You can then use GdkPixbuf for loading and drawing the image onto the drawing area. And then draw a rectangle on top with gdkDrawRectangle(). See demos drawingArea and images. Michael> > Thanks. > > -- > HUANG Ronggui, Wincent > PhD Candidate > Dept of Public and Social Administration > City University of Hong Kong > Home page: http://asrr.r-forge.r-project.org/rghuang.html > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]