On Tuesday, May 11, 2010 at 15:34:23 (+0100) Andrew Ross writes:
 > 
 > I've been trying to tidy up some of the inconsistencies between different 
 > interactive drivers on plplot. The xwin, tk, qtwidget and xcairo drivers 
 > now all more or less have consistent handling of plGetCursor as far as is
 > possible.
 > 
 > The big outstanding issue in terms of the interactive examples in plplot
 > is the xor mode which is used by xwin and tk to draw then remove lines
 > while interactively selecting region in example 20 (also tested in 
 > example 1). Now these days it seems that this is not the preferred way
 > of doing such things. Qt for example dropped support for xor mode. It
 > does provide alternative ways of doing things like selection using
 > QRubberBand. One problem is that using xor does not guarantee you a line 
 > that is clearly visible, depending on the background image or graph.
 > 
 > As a stop-gap measure we could just not draw the lines for devices which
 > don't support xor mode but do support plGetCursor. I've done this for 
 > the octave examples and it works, but it isn't ideal.
 > 
 > I wonder if it would be better to have a plplot function to select a
 > rectangle (something like the octave plrb) which could delegate the
 > drawing of the rectangle to the driver via an escape function? The 
 > drivers could then handle it in the most appropriate way. For the low
 > level xwin driver this would be via xor, for higher level drivers
 > such as qtwidget it might use library specific functions. I guess we
 > would leave xor mode for those drivers which support it, but 
 > depreciate it over time.
 > 
 > Of course, if anyone has any bright ideas how to implement something
 > like xor mode for some of the other drivers that would be good.

I agree, xor mode sucks big time (due to the line occasionally becoming
invisible).

On a recent project, I implemented a plot overlay capability for drawing a
ruler between two interactively selected points, with coordinates plotted in
world coordinates.  The basic flow was as follows:

- set up all the event bindings to have the facility act as desired
- every time the mouse moves:
 o force an expose event.. this blits the backing pixmap to the screen
 o turn off plot buffer & backing pixmap writing
 o draw your desired overlay & register it with your redraw facility (you must
   commandeer redraw for this to work)
 o turn back on plot buffer & backing pixmap writing
- restore original bindings when custom drawing mode is terminated

The turning off of the plot buffer & backing pixmap writing requires some
rather evil direct manipulation of the contents of the PLStream and XwDev
structs.. an API for this would be hugely better.  As well as a demo.  One can
dream.. anyway maybe some food for thought.

-- 
Maurice LeBrun

------------------------------------------------------------------------------

_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to