Maurice Lombardi escribió:
Mariano Alvarez Fernandez wrote:
I have uploaded a pre-release of GRX 2.4.4. Download it from:
Testing and comments will be welcome.
For me (djgpp) everything is OK, except that the change of name SaveContextToJpeg -> GrSaveContextToJpeg has not been translated to grx.pas. The following diff do:
--- pascal/grx.pas.orig Mon Oct 8 12:26:56 2001 +++ pascal/grx.pas Mon Nov 26 17:23:34 2001 @@ -1450,8 +1450,8 @@ ** requires jpeg-6a by IJG (Independent JPEG Group) ** available at ftp.uu.net as graphics/jpeg/jpegsrc.v6a.tar.gz *) -Function SaveContextToJpeg(cxt: GrContextPtr; jpegn: CString; accuracy: Integer) : Integer;
- AsmName 'SaveContextToJpeg';
+Function GrSaveContextToJpeg(cxt: GrContextPtr; jpegn: CString; accuracy: Integer) : Integer;
AsmName 'GrSaveContextToJpeg';
Implementation end.
Thanks.
Only SaveContextToTiff has not been prefixed by Gr now. Any reason ?
GrSaveContextToJpeg is a new function, the old SaveContextToJpeg lived in the addon subdir, and I didn't know if we can change it, so I had write a new one and his pair: GrLoadContextToJpeg. Can you add it to grx.pas?
SaveContextToTiff live in the addon subdir too, so I need the author permission to rename it, place it in the src/gformat subdir and apply the GRX license.
Hartmut, can I do it?
Mariano Alvarez Fernandez wrote:
GrSaveContextToJpeg is a new function, the old SaveContextToJpeg lived in the addon subdir, and I didn't know if we can change it, so I had write a new one and his pair: GrLoadContextToJpeg. Can you add it to grx.pas?
OK. To check I have also written a demo program which is the exact translation to pascal of jpgtest.c In doing this I have noticed a problem in the translation of passing GrContext parameters to procedures/functions. In C they are passed as pointers. In Pascal the best solution is usually to pass them as "var" parametrers, and this had been done previously. However there is a trick in grx that when passing a NULL pointer instead of a GrContext pointer, an internal GrContext is created and/or used. This trick is very frequently used for the current context, and is done several times in the demo program. But I know no way in Pascal to pass a nil pointer as a var parameter. So either one discards this possibility or pass the parameters as pointers GrContextPtr like in C. This is not a natural way of doing in pascal but it works. I have thus corrected grx.pas this way, corrected makefiles and readme to include the new demo program, and also corrected vir_test.pas for the new syntax. I have checked that everything works on djgpp. All is contained in the attached grxdiff.zip
Maurice
Maurice Lombardi wrote:
Mariano Alvarez Fernandez wrote:
GrSaveContextToJpeg is a new function, the old SaveContextToJpeg lived in the addon subdir, and I didn't know if we can change it, so I had write a new one and his pair: GrLoadContextToJpeg. Can
Shouldn't this be `From' rather than `To'?
you add it to grx.pas?
OK. To check I have also written a demo program which is the exact translation to pascal of jpgtest.c In doing this I have noticed a problem in the translation of passing GrContext parameters to procedures/functions. In C they are passed as pointers. In Pascal the best solution is usually to pass them as "var" parametrers, and this had been done previously. However there is a trick in grx that when passing a NULL pointer instead of a GrContext pointer, an internal GrContext is created and/or used. This trick is very frequently used for the current context, and is done several times in the demo program. But I know no way in Pascal to pass a nil pointer as a var parameter.
Null. :-) (This was introduced for exactly this purpose.)
So either one discards this possibility or pass the parameters as pointers GrContextPtr like in C. This is not a natural way of doing in pascal but it works.
So we can do it with var parameters. However, I'm wondering if we should do it. I'm not very familiar with using contexts in GRX, but if the usual way to create them is via functions like GrCreateContext that return pointers, then there is no disadvantage in using pointers (in fact, it saves a `^'). But if there a regularly situations where you have a real GrContext variable, then it's better to use var parameters than have to use `@'.
Frank
Frank Heckenbach escribió:
GrSaveContextToJpeg is a new function, the old SaveContextToJpeg lived in the addon subdir, and I didn't know if we can change it, so I had write a new one and his pair: GrLoadContextToJpeg. Can
Shouldn't this be `From' rather than `To'?
Yes, of course, it was a typo, the function name is GrLoadContextFromJpeg