John, I will study the application you sent me the link to. My program is not raster; it lets the user draw with a brush or use a line tool in the window. Since the user has drawn with a brush already, the underlying layer is in a pixmap. First I will look at your application's code, and if I cannot figure it out, I will post again. Many thanks Stewart > -----Original Message----- > From: jcupitt@xxxxxxxxx [mailto:jcupitt@xxxxxxxxx] > Sent: Thursday, November 29, 2007 4:48 PM > To: stewart.weiss@xxxxxxx > Cc: gtk-list > Subject: Re: GDK_POINTER_MOTION_HINT_MASK has no effect > > > On 11/29/07, Stewart Weiss <stewart.weiss@xxxxxxx> wrote: > > 1. I am assuming that when I queue a draw for the old position of > > the rubberbanded line, I am using XOR to draw it, so that it is in > > effect, an erasing, right? > > Actually, I'd suggest using a plain draw rather than an XOR. > > XOR rubberbanding works if you can treat your display as something you > can draw incrementally, that is, you know what is on the screen and > therefore you know whether this XOR draw will set or unset a line. > > This is often not the case, especially in a complex application. > Instead, you should think of your window as being composed from a > number of separate layers (like photoshop layers), and that on an > expose you should completely repaint that section of the window by > drawing all layers from the back forwards. > > > Right now, my function to draw a line uses gdk_draw_line into the pixmap > > and then calls gdk_window_invalidate_rect to send the expose > event later. > > If I actually call the gdk_draw_line in the expose event > handler, directly > > into the pixmap, would I then use gdk_draw_drawable to copy the > pixmap into > > the window? I know I can't queue a drawing event in the > handler or else > > I have an infinite indirect recursive loop. Is this how? > > Is this a raster drawing program, or a vector one? > > Assuming it's raster, you should have two separate data structures. > Keep a large image around which has the current state of your user's > image. Only drawing operations go into this, no rubberbanding. This is > your background layer. Rubberband operations are in another layer > which floats on top of this. > > On an expose, use your background image to paint the exposed pixels. > Then, if there's a rubber band active at the moment and if the > bounding box of the rubber band intersects the expose, draw that as > well on top of the image. > > If you're curious, my app is here: > > http://www.vips.ecs.soton.ac.uk > > To see the rubberbanding, load an image, doubleclick the thumbnail to > get a view window, then hold down CTRL and click and drag up and left > to get a vector, down and right to get a region, just click to get a > point, or drag from a ruler to get a guide. > > If you try resizing outside the edge of the window, the window will > scroll in the background. You can move objects around by dragging on > their names. Hopefully you'll see all the objects, including the > animated ones, float over each other smoothly. There's a simple > paintbox on the View menu which also does some rubberbanding with some > of the tools. > > John _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list