exposing cairo context from gnuplot

View: New views
17 Messages — Rating Filter:   Alert me  

exposing cairo context from gnuplot

by Richard Henwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I've been using Cairo (cairographics.org) a fair bit recently. I have
not found a plotting library which is as mature as gnuplot.

I understand that the wxWidgets terminal uses cairo.

Has anyone considered the possibility of exposing the cairo context from
within gnuplot/wxWidgets to the outside world?

best regards,
Richard
--
Scanned by iCritical.

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 07 September 2009, Richard Henwood wrote:
> Hi All,
>
> I've been using Cairo (cairographics.org) a fair bit recently. I have
> not found a plotting library which is as mature as gnuplot.
>
> I understand that the wxWidgets terminal uses cairo.
>
> Has anyone considered the possibility of exposing the cairo context from
> within gnuplot/wxWidgets to the outside world?

The development version has two new drivers - pngcairo and pdfcairo,
the use the cairo library.  Not sure if that's what you meant.
Both drivers will be in the version 4.4 release candidate, which I
hope we can put out soonish.

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Mon, 7 Sep 2009, Ethan Merritt wrote:

> On Monday 07 September 2009, Richard Henwood wrote:
> > Hi All,
> >
> > I've been using Cairo (cairographics.org) a fair bit recently. I have
> > not found a plotting library which is as mature as gnuplot.
> >
> > I understand that the wxWidgets terminal uses cairo.
> >
> > Has anyone considered the possibility of exposing the cairo context from
> > within gnuplot/wxWidgets to the outside world?
>
> The development version has two new drivers - pngcairo and pdfcairo,
> the use the cairo library.  Not sure if that's what you meant.
> Both drivers will be in the version 4.4 release candidate, which I
> hope we can put out soonish.

I think what Richard was asking is whether the "cairo drawing
context" struct, or "cairo_t", that is used internally by gnuplot
could somehow be exposed programmatically.  But I don't see how
this could be done -- seems to me it would require building
gnuplot as a library, not a stand-alone executable.

Allin Cottrell

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Richard Henwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:

> On Mon, 7 Sep 2009, Ethan Merritt wrote:
>
> > On Monday 07 September 2009, Richard Henwood wrote:
> > > Hi All,
> > >
> > > I've been using Cairo (cairographics.org) a fair bit recently. I have
> > > not found a plotting library which is as mature as gnuplot.
> > >
> > > I understand that the wxWidgets terminal uses cairo.
> > >
> > > Has anyone considered the possibility of exposing the cairo context from
> > > within gnuplot/wxWidgets to the outside world?
> >
> > The development version has two new drivers - pngcairo and pdfcairo,
> > the use the cairo library.  Not sure if that's what you meant.
> > Both drivers will be in the version 4.4 release candidate, which I
> > hope we can put out soonish.
>
> I think what Richard was asking is whether the "cairo drawing
> context" struct, or "cairo_t", that is used internally by gnuplot
> could somehow be exposed programmatically.  But I don't see how
> this could be done -- seems to me it would require building
> gnuplot as a library, not a stand-alone executable.
>

This is indeed what I am curious about. As you comment: if the 'cairo
drawing context' was exposed, it would then allow gnuplot to behave as a
library. i.e. if one was writing a cairo widget for a (typically GTK)
application, one may create a context (cairo_t), pass it to gnuplot
(along with some commands to plot a graph on it), and then return it to
the application for display.

In the first instance I thought I would raise this idea for discussion.
If it is technically feasible - and within the gnuplot mission - I think
there is an excellent opportunity to both have a extensive, publication
quality plotting library available to gtk/cairo application developers -
and increase usage of gnuplot.

>From a technical standpoint - I would imagine starting with the
wxWidgets terminal code would be a 'hacky' way to get something
working.

Any thoughts greatly appreciated.
Richard

--
Scanned by iCritical.

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, 8 Sep 2009, Richard Henwood wrote:

> On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:
> > On Mon, 7 Sep 2009, Ethan Merritt wrote:
> >
> > > On Monday 07 September 2009, Richard Henwood wrote:
> > > > Hi All,
> > > >
> > > > I've been using Cairo (cairographics.org) a fair bit recently. I have
> > > > not found a plotting library which is as mature as gnuplot.
> > > >
> > > > I understand that the wxWidgets terminal uses cairo.
> > > >
> > > > Has anyone considered the possibility of exposing the cairo context from
> > > > within gnuplot/wxWidgets to the outside world?
> > >
> > > The development version has two new drivers - pngcairo and pdfcairo,
> > > the use the cairo library.  Not sure if that's what you meant.
> > > Both drivers will be in the version 4.4 release candidate, which I
> > > hope we can put out soonish.
> >
> > I think what Richard was asking is whether the "cairo drawing
> > context" struct, or "cairo_t", that is used internally by gnuplot
> > could somehow be exposed programmatically.  But I don't see how
> > this could be done -- seems to me it would require building
> > gnuplot as a library, not a stand-alone executable.
> >
>
> This is indeed what I am curious about. As you comment: if the
> 'cairo drawing context' was exposed, it would then allow gnuplot
> to behave as a library. i.e. if one was writing a cairo widget
> for a (typically GTK) application, one may create a context
> (cairo_t), pass it to gnuplot (along with some commands to plot
> a graph on it), and then return it to the application for
> display.

I agree this would be very nice, but I'd put the conditionality
the other way round: if it were possible to build gnuplot as a
library, then it would be feasible to expose the relevant cairo_t
via a suitable API.

There are many programs that use gnuplot in "slave" mode and
having a "libgnuplot" would be very useful in that context.  But
so far as I know (Ethan can correct me if I'm wrong) this is not
on an active TODO list.

However, gnuplot's GPVAL* variables, which provide a means of
accessing internal data in text form, can be quite helpful if your
program functions as a "driver" of gnuplot.

Allin Cottrell


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 08 September 2009 01:44:25 Richard Henwood wrote:

> On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:
> >
> > I think what Richard was asking is whether the "cairo drawing
> > context" struct, or "cairo_t", that is used internally by gnuplot
> > could somehow be exposed programmatically.  But I don't see how
> > this could be done -- seems to me it would require building
> > gnuplot as a library, not a stand-alone executable.
> >
>
> This is indeed what I am curious about. As you comment: if the 'cairo
> drawing context' was exposed, it would then allow gnuplot to behave as a
> library. i.e. if one was writing a cairo widget for a (typically GTK)
> application, one may create a context (cairo_t), pass it to gnuplot
> (along with some commands to plot a graph on it), and then return it to
> the application for display.

The two halves of your statement do not quite match up.
While I understand wanting to pass gnuplot a context, e.g. a widget in
an external application, I don't see what that has to do with making
gnuplot into a library.  This mode of operation is already supported by the
qt, tkcanvas, and x11 terminal drivers.  You initialize the context,
invoke gnuplot, and tell it to draw into your existing context rather
than creating a new one.  Of course the details are different in each case.

> In the first instance I thought I would raise this idea for discussion.
> If it is technically feasible - and within the gnuplot mission - I think
> there is an excellent opportunity to both have a extensive, publication
> quality plotting library available to gtk/cairo application developers -
> and increase usage of gnuplot.

I personally think that plotting libraries, as opposed to plotting programs,
are not the way to go.  That's just my personal opinion, but it is based
on years of programming experience using both approaches.
 
> Any thoughts greatly appreciated.
> Richard

        Ethan

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Richard Henwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-09-08 at 09:27 -0700, Ethan Merritt wrote:

> On Tuesday 08 September 2009 01:44:25 Richard Henwood wrote:
> > On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:
> > >
> > > I think what Richard was asking is whether the "cairo drawing
> > > context" struct, or "cairo_t", that is used internally by gnuplot
> > > could somehow be exposed programmatically.  But I don't see how
> > > this could be done -- seems to me it would require building
> > > gnuplot as a library, not a stand-alone executable.
> > >
> >
> > This is indeed what I am curious about. As you comment: if the 'cairo
> > drawing context' was exposed, it would then allow gnuplot to behave as a
> > library. i.e. if one was writing a cairo widget for a (typically GTK)
> > application, one may create a context (cairo_t), pass it to gnuplot
> > (along with some commands to plot a graph on it), and then return it to
> > the application for display.
>
> The two halves of your statement do not quite match up.
> While I understand wanting to pass gnuplot a context, e.g. a widget in
> an external application, I don't see what that has to do with making
> gnuplot into a library.  This mode of operation is already supported by the
> qt, tkcanvas, and x11 terminal drivers.  You initialize the context,
> invoke gnuplot, and tell it to draw into your existing context rather
> than creating a new one.  Of course the details are different in each case.
>

Ah! This is good news. So presumably if a 'cairo' terminal driver
existed, this would provide me a way to get nice gnuplot plots into my
GTK/cairo application?

> > In the first instance I thought I would raise this idea for discussion.
> > If it is technically feasible - and within the gnuplot mission - I think
> > there is an excellent opportunity to both have a extensive, publication
> > quality plotting library available to gtk/cairo application developers -
> > and increase usage of gnuplot.
>
> I personally think that plotting libraries, as opposed to plotting programs,
> are not the way to go.  That's just my personal opinion, but it is based
> on years of programming experience using both approaches.
>  

I don't think I have sufficient experience to comment - and defer to
your judgement on this. I will have a poke around with the existing
qt/tkcanvas/x11 terminals and see how I get on with them.

cheers,
Richard
--
Scanned by iCritical.

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Wed, 9 Sep 2009, Richard Henwood wrote:

> On Tue, 2009-09-08 at 09:27 -0700, Ethan Merritt wrote:
> > On Tuesday 08 September 2009 01:44:25 Richard Henwood wrote:
> > > On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:
> > > >
> > > > I think what Richard was asking is whether the "cairo drawing
> > > > context" struct, or "cairo_t", that is used internally by gnuplot
> > > > could somehow be exposed programmatically...
> > >
> > > This is indeed what I am curious about...

> > [...] This mode of operation is already supported by the qt,
> > tkcanvas, and x11 terminal drivers.  You initialize the
> > context, invoke gnuplot, and tell it to draw into your
> > existing context rather than creating a new one.  Of course
> > the details are different in each case.
>
> Ah! This is good news. So presumably if a 'cairo' terminal driver
> existed, this would provide me a way to get nice gnuplot plots into my
> GTK/cairo application?

In the meantime a good option, I find, is to get gnuplot to create
a PNG file (e.g. using the pngcairo terminal), then load that file
into your GTK window using gdk_pixbuf_new_from_file() or perhaps
cairo_image_surface_create_from_png().  Of course, you don't
get a vector graphic that way.

I'm not quite sure how a "cairo term" would work.  You couldn't
actually pass a cairo drawing context to gnuplot, could you? With
the x11 term, for example, you can say "window <XID>", passing the
X11 ID of the window you want to draw into, in string form. I
don't offhand see what a cairo counterpart would look like.

Here's something I haven't tried, but that might be nice. Since
gnuplot already does SVG, one could get gnuplot to write an SVG
file, create a cairo context using gdk, then call librsvg to read
the SVG file into your cairo context.  This would not require any
modifications to gnuplot.

Allin Cottrell

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 09 September 2009, Allin Cottrell wrote:

>
> On Wed, 9 Sep 2009, Richard Henwood wrote:
>
> > On Tue, 2009-09-08 at 09:27 -0700, Ethan Merritt wrote:
> > > On Tuesday 08 September 2009 01:44:25 Richard Henwood wrote:
> > > > On Mon, 2009-09-07 at 17:49 -0400, Allin Cottrell wrote:
> > > > >
> > > > > I think what Richard was asking is whether the "cairo drawing
> > > > > context" struct, or "cairo_t", that is used internally by gnuplot
> > > > > could somehow be exposed programmatically...
> > > >
> > > > This is indeed what I am curious about...
>
> > > [...] This mode of operation is already supported by the qt,
> > > tkcanvas, and x11 terminal drivers.  You initialize the
> > > context, invoke gnuplot, and tell it to draw into your
> > > existing context rather than creating a new one.  Of course
> > > the details are different in each case.
> >
> > Ah! This is good news. So presumably if a 'cairo' terminal driver
> > existed, this would provide me a way to get nice gnuplot plots into my
> > GTK/cairo application?
>
> In the meantime a good option, I find, is to get gnuplot to create
> a PNG file (e.g. using the pngcairo terminal), then load that file
> into your GTK window using gdk_pixbuf_new_from_file() or perhaps
> cairo_image_surface_create_from_png().  Of course, you don't
> get a vector graphic that way.
>
> I'm not quite sure how a "cairo term" would work.  You couldn't
> actually pass a cairo drawing context to gnuplot, could you?

I'm not a gtk programmer, but there's always Google...
which leads me to the plplot project on SourceForge. It seems that
plplot is somewhat similar to gnuplot in intent, but the relevant point
is that they recently added an external cairo terminal driver "extcairo"
that so far as I can tell from the description does exactly what you want.
If it works for them, I don't see why it wouldn't work for us.
Anyonw have time to check out the code and report back on how the
information to open the context is passed?

        Ethan

> With the x11 term, for example, you can say "window <XID>", passing the
> X11 ID of the window you want to draw into, in string form. I
> don't offhand see what a cairo counterpart would look like.
 
> Here's something I haven't tried, but that might be nice. Since
> gnuplot already does SVG, one could get gnuplot to write an SVG
> file, create a cairo context using gdk, then call librsvg to read
> the SVG file into your cairo context.  This would not require any
> modifications to gnuplot.
>
> Allin Cottrell
>


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Richard Henwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2009-09-09 at 08:42 -0700, Ethan Merritt wrote:
<snip>
>
> I'm not a gtk programmer, but there's always Google...
> which leads me to the plplot project on SourceForge. It seems that
> plplot is somewhat similar to gnuplot in intent, but the relevant point
> is that they recently added an external cairo terminal driver "extcairo"
> that so far as I can tell from the description does exactly what you want.
> If it works for them, I don't see why it wouldn't work for us.
> Anyonw have time to check out the code and report back on how the
> information to open the context is passed?

I've had a quick look at what I think the relevant bits of PLplot are.

1. The extcairo driver within PLplot requires an existing cairo context
to be provided to it.
2. PLplot then draws over the context and returns.

there is a useful post provided by the author of the extcairo driver:
http://www.mail-archive.com/plplot-devel@.../msg01273.html
and example usage:
http://plplot.sourcearchive.com/documentation/5.9.2/ext-cairo-test_8c-source.html

r,

--
Scanned by iCritical.

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 10 September 2009 02:34:07 Richard Henwood wrote:

> On Wed, 2009-09-09 at 08:42 -0700, Ethan Merritt wrote:
> <snip>
> >
> > I'm not a gtk programmer, but there's always Google...
> > which leads me to the plplot project on SourceForge. It seems that
> > plplot is somewhat similar to gnuplot in intent, but the relevant point
> > is that they recently added an external cairo terminal driver "extcairo"
> > that so far as I can tell from the description does exactly what you want.
> > If it works for them, I don't see why it wouldn't work for us.
> > Anyonw have time to check out the code and report back on how the
> > information to open the context is passed?
>
> I've had a quick look at what I think the relevant bits of PLplot are.
>
> 1. The extcairo driver within PLplot requires an existing cairo context
> to be provided to it.
> 2. PLplot then draws over the context and returns.
>
> there is a useful post provided by the author of the extcairo driver:
> http://www.mail-archive.com/plplot-devel@.../msg01273.html
> and example usage:
> http://plplot.sourcearchive.com/documentation/5.9.2/ext-cairo-test_8c-source.html

Hmm.
Their use of the word "external" doesn't match mine, if that's an example of it.
In the URL you point to, it's just that a routine in plplot itself initializes
cairo and then passes it to the driver.  What we would be looking for is an
example of one process initializing a cairo context and then passing a handle
to another process entirely.  Which may or may not be possible - I just dont know.


--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, 10 Sep 2009, Ethan Merritt wrote:

> On Thursday 10 September 2009 02:34:07 Richard Henwood wrote:
> > there is a useful post provided by the author of the extcairo driver:
> > http://www.mail-archive.com/plplot-devel@.../msg01273.html
> > and example usage:
> > http://plplot.sourcearchive.com/documentation/5.9.2/ext-cairo-test_8c-source.html
>
> Hmm.
> Their use of the word "external" doesn't match mine, if that's
> an example of it. In the URL you point to, it's just that a
> routine in plplot itself initializes cairo and then passes it to
> the driver.  What we would be looking for is an example of one
> process initializing a cairo context and then passing a handle
> to another process entirely.  Which may or may not be possible -
> I just dont know.

"Back to basics".  The only sort of thing you can literally "pass
to" gnuplot (as an executable program) is a string, as in the argv
array or as part of a "set foo ..." statement.

However, strings can be interpreted in various ways.  If we're
really talking about passing a pre-allocated cairo context to
gnuplot, the only way I can envisage of doing this would be saying
something like

set cairo_t "0x818a400"

(to a hypothetical gnuplot "raw_cairo" terminal).

It seems this would offer (depending on one's black-hat skill
level) a good way of crashing gnuplot or turning it into a
rootkit; but I suppose that in the right hands it could do what
Richard is (I think) talking about -- i.e. get gnuplot to write
into an area of memory rather than a file.

Allin Cottrell


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 10 September 2009, Allin Cottrell wrote:
>
> "Back to basics".  The only sort of thing you can literally "pass
> to" gnuplot (as an executable program) is a string, as in the argv
> array or as part of a "set foo ..." statement.

That's not really true.  It is certainly the most portable thing,
but far from the only thing.  You can pass shared memory objects,
or loadable shared libraries/plugins, for example.  There is even an
existing patchset on the SourceForge tracker that implements
loadable shared objects so that you can have pluggable math functions.

> However, strings can be interpreted in various ways.  If we're
> really talking about passing a pre-allocated cairo context to
> gnuplot, the only way I can envisage of doing this would be saying
> something like
>
> set cairo_t "0x818a400"
>
> (to a hypothetical gnuplot "raw_cairo" terminal).
>
> It seems this would offer (depending on one's black-hat skill
> level) a good way of crashing gnuplot or turning it into a
> rootkit;

It's no different than plugins in Firefox or Gimp or xmms or
MSWord or name your favorite application.  If the plugin is malicious
then, yeah, it can cause problems.  But only at the level gnuplot itself
can already cause problems.  It doesn't magically gain additional
capabilities or privilege levels.

> but I suppose that in the right hands it could do what
> Richard is (I think) talking about -- i.e. get gnuplot to write
> into an area of memory rather than a file.

Maybe I mis-understand the intended use. I thought the proposed application
was to draw into an existing widget that was being displayed on the screen,
much like the x11 terminal can draw into an existing x-window.  If it's on
the screen, then it has a publically visible identifier already that the
display/window manager can use.  You would in principle only have to pass that
identifier, just like passing the ID of an X window (and in fact it might even
_be_ the identifier of an X window; I don't know how gtk widgets work exactly).

Be that as it may, at least on linux "writing into an area of memory rather
than a file" is a false dichotomy.  You can map a file into memory and
access it by either mechanism.  Or at least that is my understanding.
I admit that I've never programmed using memory-mapped files. See, e.g.
http://www.ecst.csuchico.edu/~beej/guide/ipc/mmap.html
So that might indeed be one way to implement this.


        Ethan


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by Allin Cottrell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, 10 Sep 2009, Ethan Merritt wrote:

> On Thursday 10 September 2009, Allin Cottrell wrote:
> >
> > "Back to basics".  The only sort of thing you can literally "pass
> > to" gnuplot (as an executable program) is a string, as in the argv
> > array or as part of a "set foo ..." statement.
>
> That's not really true.  It is certainly the most portable thing,
> but far from the only thing.  You can pass shared memory objects,
> or loadable shared libraries/plugins, for example...

OK, then I'm missing something.  Could you give an example of how
you can pass such things at run time other than via strings in
argv or "set..."?  I understand that you can ask gnuplot to read
binary data, but I thought the only way to do that was by passing
the program a string, namely the name of a file to open.

Allin Cottrell

------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by johan47 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I did not try it but it seems to be easy:
http://old.nabble.com/embedding-gnuplot-x-window-into-gtk-app-ts11670440.html#a11670440

cheers
--
View this message in context: http://old.nabble.com/exposing-cairo-context-from-gnuplot-tp25331048p26157813.html
Sent from the Gnuplot - Dev mailing list archive at Nabble.com.


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by johan47 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I did not try it but it seems to be easy:
http://old.nabble.com/embedding-gnuplot-x-window-into-gtk-app-ts11670440.html#a11670440

cheers
--
View this message in context: http://old.nabble.com/exposing-cairo-context-from-gnuplot-tp25331048p26157815.html
Sent from the Gnuplot - Dev mailing list archive at Nabble.com.


------------------------------------------------------------------------------
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
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: exposing cairo context from gnuplot

by johan47 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I did not try it but it seems to be easy: http://old.nabble.com/embedding-gnuplot-x-window-into-gtk-app-ts11670440.html#a11670440 cheers