|
From: Daniel J S. <dan...@ie...> - 2006-10-12 06:32:40
|
Daniel J Sebald wrote:
> OK. I'll have to consult the book to see images can use PostScript's
> gamma feature. In the mean time, I've put a patch on SourceForge
> with the pow(gray,1.0/gamma) which seems to work.
Petr,
The Adobe book indicates that gamma correction can be implemented with what is called a transfer function (the second level of color mapping). So, as an alternative, I simply added a line before the image definition (and a little extra cleanup):
if (sm_palette.colorMode == SMPAL_COLOR_MODE_GRAY)
fprintf(gppsfile, "%s{1.0 %g div exp} settransfer\n", space, sm_palette.gamma);
What this does is create the line below:
gsave
{1.0 0.2 div exp} settransfer
875 4740 translate
4959 -4240 scale
100 10 8
[ 100 0 0 10 0 0 ]
currentfile /ASCII85Decode filter
image
I'll send you the patch separately so that you may place it on SourceForge. [Would it be possible to change SF to allow attaching to someone else's bug report?] Let me know if that works.
I'm guessing that transfer functions could be widened in scope. So if you'd like to use a transfer function somehow rather than /pm3dGamma, let me know.
Dan
|