MathGroup Archive 2000

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

Search the Archive

Re: Mathlink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25546] Re: Mathlink
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 7 Oct 2000 03:35:50 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8rjk6u$ohq@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

MLPutByteArray[] ??

Here is a code snipped the MathGL3d use to transfer RGB bit maps
to Mathematica

{
  long int dims[3];
  char *heads[]={"List","List","List"};
  char colorFun[]="RGBColor";

  dims[0]=(long) h; @+ dims[1]=(long) w; @+ dims[2]=channels;

  MLPutFunction(stdlink,"Raster",4);
    MLPutByteArray(stdlink,fbuff,dims,heads,3L);
    MLPutFunction(stdlink,"List",2);
      MLPutFunction(stdlink,"List",2);
        MLPutInteger(stdlink,0);
        MLPutInteger(stdlink,0);
      MLPutFunction(stdlink,"List",2);
        MLPutInteger(stdlink,w);
        MLPutInteger(stdlink,h);
    MLPutFunction(stdlink,"List",2);
      MLPutInteger(stdlink,0);
      MLPutInteger(stdlink,255);
    MLPutFunction(stdlink,"Rule",2);
      MLPutSymbol(stdlink,"ColorFunction");
      MLPutSymbol(stdlink,colorFun);
}

and create the full Mathematica repesentation of a bitmap.

Regards
  Jens

qing.cheng at icos.be wrote:
> 
> Dear Mathgroup,
> 
> I am a new member of Mathematica. I am trying to make communication between
> Mathematica and one external image processing broad.   I have a
> communcation program which can transfer data between the broad and windows
> environment and   I 've made a  test program to link  the C  program with
> Mathematica through MathLink. The main problem I encounter now is about
> data type conversion when I try to send an image from external program to
> Mathlematica..
> The data type I received from  broad is BYTE and I only found three data
> type which MathLink accepts. They are Integer, Real and String(char*).  I
> tried to use MLPutString, since it accept a char*,but I got something else.
> Then I tried to convert a BYTE* to int* before I send to MathLink and it's
> OK. However   It consumes memory and time.  Can I have a better solution?
> 
> Thanks for any help.
> 
> Qing Cheng


  • Prev by Date: Re: Exporting multiple page graphics
  • Next by Date: Re: Marcum Q function
  • Previous by thread: Re: Mathlink
  • Next by thread: "Evaluate to Here" (solved)