MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I tranfer graphics file via Mathlink

> Dear;
> 	I want to write my own mathlink program to transfer graphics from 
> Mathematica3.0 to produce something. What is Argument type in template 
> file that i must write for transfer this.
> 	foe example :
> 		I want to transfer graph Sin[x] to my mathlink program, I  want 
to use
> my own program getgraph[Plot[Sin[x],{x,0,2}]
> How do I write template file "" and what type of graphics
> file  that Mathematica send to Mathlink(How do I received graphics file
> from  Mathematica) or it had other way to do this job(please not answer
> that  manual save graphics file because my job that want to do
> something to  that graphics file before and return to Mathematica to
> plot it)
> Best Regards
> R.Inorn


the templates allow only simple data types like Integer, Real, .. in all
other cases You must transfer the data manual. The template entry is

:Function: c_function_to_getgraph
:Pattern: getgraph[gr_Graphics]
:Arguments: {gr}
:ArgumentTypes: {Manual}
:ReturnType: Manual

You C-function must transfer the data with MLGetFunction(), 
MLGetInteger(),... and is responsible for all type/error checking. The
most complicated task is still storing the the verry general data
structure of Mathematica's expressions in Your C-programm.

Sending the graphics data to Mathematica You must use the MLPut*()

It is not clear what You want to do but in the most cases You can manage
the manipulation of Graphics data by Mathematica's programming

In every case it is wise to make a Mathematica function that transform
the data in a structure that can be better implemented in C. At least I
recomment the splitting of the pure graphics primitives Line[],
Point[],... and the options of the Graphics-object. Keep in mind that
with out preprocessing the object


has 3 data types (Integer,Rational,Real) in it's coordinates and that
N[0] evaluates to 0 (Integer) and not to 0.0 (Real).

Hope that helps

  • Prev by Date: 1998 Mathematica Visiting Scholar Grant Applications
  • Next by Date: Re: List Manipulation (2)
  • Prev by thread: How do I tranfer graphics file via Mathlink
  • Next by thread: 3D problem