[gl2ps] FW: gl2psBeginPage FILE type (*stream)
Jerry
jerry at Jacsoft.nl
Fri Aug 6 00:03:00 CEST 2010
Update
I would suggest to change some functionality to make the library
compatible with Pascal. With these 2 functions I was able to
successfully connect with Pascal (Delphi) to the library and let it
export my OpenGL drawings. The proposed functions are (together with 1
global var):
FILE *globalstream; //global stream parameter to make the DLL compatible
with other programming languages
GL2PSDLL_API void gl2psCreateStream(const char *filename)
{
globalstream = fopen(filename, "wb");
}
GL2PSDLL_API void gl2psDestroyStream(void)
{
fclose(globalstream);
}
--------------------
The function gl2psBeginPage then doesn't need the stream parameter
anymore, so it would become:
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char
*producer,
GLint viewport[4], GLint format, GLint
sort,
GLint options, GLint colormode,
GLint colorsize, GL2PSrgba *colormap,
GLint nr, GLint ng, GLint nb, GLint
buffersize,
const char *filename)
gl2ps->stream = globalstream;
--------------------
The only thing that has to be done with the example is to call both
functions. The gl2psCreateStream prior to the example and the
gl2psDestroyStream after the example.
I hope those changes will be incorporated in the next release so a lot
more users are able to use the library in their projects.
Kind regards,
Jerry
From: Jarry Claessen
Sent: Thursday, August 05, 2010 12:14
To: 'gl2ps at geuz.org'
Subject: gl2psBeginPage FILE type (*stream)
Hello,
With help from people from some forums I was able to compile the dll.
This is all working now and I have made sure that the functions are
being exported. I am now creating a pascal wrapper to make the dll work
with all pascal based programming languages. This is almost completed,
except for one problem.
The "FILE *stream" is a specific C type, so I have been told. This makes
it impossible to write a wrapper since there is no identical type in
Pascal. Using a TStream from pascal and sending the pointer for that
TStream will probably not work.
So my question is. Is it possible to adjust the code so only the
filename should be provided (like with the LaTeX version I assume,
reading) and the functions creates the stream itself:
"filename
(for LATEX output only) Specifies a name for the stream to which data is
printed."
Or is there a way that the dll could provide some sort of option to
create a stream based on a filename and that stream could be passed as a
parameter.
For instance just having a simple function:
gl2psCreateFileStream(const char *filename);
Kind regards,
Jerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gl2ps/attachments/20100806/3c3fcd53/attachment.html>