Werner,
I attached a diff with my changes for plotcapi.i, starting with plplot-5.9.4
I included a number of constants for completeness, although of these I
have only needed PLESC_DEVINIT.
It compiles and runs with cmake options -DDEFAULT_NO_BINDINGS=ON
-DENABLE_python=ON, so I only tested the python bindings.
> PLplot is quite fast, I'm sure. Mind though, that the wxWidgets driver has 3
> different backends: the wxDC backend which just uses the basic drawing
> functions of wxwidgets - the fastest, but not antialized. wxAGG backend,
> which needs the AGG library, fast (but slower as wxDC) and nice, but bad
> font handling. wxGC backend which uses the wxGraphicsContext class, it may
> be the slowest but nice antializing and best font drawing.
I've been using the wxDC backend, which works fine. I'm a little
confused about the AGG backend - I expect it to require a wxImage for
drawing (based on the wx binding) but it seems to want a wxDC - or
might it just not be working and instead defaulting to the wxDC
backend? Probably I should check with pl_cmd(PLESC_GETBACKEND, ...)
For the wxpython interface, I am considering a few conventions, and I
welcome your comments:
A) The use of the window could look like:
plot_window = PLplotPanel(...) # create the panel to hold plots
plot_window.AcquireStream() # this sets the plplot stream number to
the right one
plot_window.plcol0(1)
plot_window.plenv(0, 10, 0, 1, 0, 0)
plot_window.plline(xs, ys)
...
plot_window.Redraw() # force a redraw to show the plot at the end
So the methods look just like the plplot commands. (Or the 'pl' in
each method name could be dropped, since there is no real possibility
of a name conflict.) This also requires a light wrapper for each
function to write it as a method, which is also an opportunity to do
some sanity checks if needed.
B) Alternatively, it could look like:
plot_window = PLplotPanel(...) # create the panel to hold plots
plot_window.AcquireStream() # this sets the plplot stream number to
the right one
plplot.plcol0(1) # use plplot commands
straight from imported plplot module
plplot.plenv(0, 10, 0, 1, 0, 0)
plplot.plline(xs, ys)
plot_window.Redraw() # force a redraw to show the plot at the end
where the plot_window.AcquireStream() and plot_window.Redraw()
basically frame the plplot calls - not very object oriented, but the
binding code is very lightweight.
C) Or, I could rename and recombine the methods to be more pythonic at
the expense of requiring more documentation, etc.
Do you have a standard approach in mind for this kind of interface, or
is there some other binding you think I should mimic?
Thanks,
Brian
--- plplotcapi.i 2009-05-10 15:37:17.000000000 -0400
+++ ../../../../plplot-5.9.4/bindings/swig-support/plplotcapi.i 2009-08-28 14:54:53.000000000 -0400
@@ -59,6 +59,15 @@
#define PLESC_HAS_TEXT 20 /* driver draws text */
#define PLESC_IMAGE 21 /* handle image */
#define PLESC_IMAGEOPS 22 /* plimage related operations */
+#define PLESC_PL2DEVCOL 23 /* convert PLColor to device color */
+#define PLESC_DEV2PLCOL 24 /* convert device color to PLColor */
+#define PLESC_SETBGFG 25 /* set BG, FG colors */
+#define PLESC_DEVINIT 26 /* alternate device initialization */
+#define PLESC_GETBACKEND 27 /* get used backend of (wxWidgets) driver */
+#define PLESC_BEGIN_TEXT 28 /* get ready to draw a line of text */
+#define PLESC_TEXT_CHAR 29 /* render a character of text */
+#define PLESC_CONTROL_CHAR 30 /* handle a text control character (super/subscript, etc.) */
+#define PLESC_END_TEXT 31 /* finish a drawing a line of text */
/* image operations */
#if 0
@@ -1132,12 +1141,14 @@
void
plgesc(char *p_esc);
+#endif
/* Front-end to driver escape function. */
void
pl_cmd(PLINT op, void *ptr);
+#if 0
/* Return full pathname for given file if executable */
PLINT
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general