On Sat, 2007-11-10 at 19:25 +0100, Giacomo Mazzocato wrote:
> I've tried to reimplement it in another language
I very much hope for you that you are respecting the license that this
code has been published under. Your code is GPL, right?
> and in the function
> cdisplay_colorblind_convert with certain colors (for instance #000000) I get
> warning of division by zero in the section that corresponds to this in the
> original code:
> switch (colorblind->deficiency)
> case COLORBLIND_DEFICIENCY_DEUTERANOPIA:
> tmp = blue / red;
> (that's line 435) and in the sections where it computes tmp for other types
> case COLORBLIND_DEFICIENCY_PROTANOPIA:
> tmp = blue / green;
> case COLORBLIND_DEFICIENCY_TRITANOPIA:
> tmp = green / red;
> Perhaps those errors are ignored in C, but shouldn't they be handled
> or prevented ?
Division by zero is handled correctly here. The result will be NaN.
> The most important problem is however that when I try to convert white
> (#ffffff) with the filter,I get #dadada for all 3 deficit simulations.
> #dadada is a shade of grey, but if I apply in gimp the filter to an area
> contains white regions, white remains white.
> I don't understand deeply the gimp sourcecode,is any postprocessing applied
> after the filter has returned the new color values ?
If you have other display filters active, then the colors may be passed
through them befor they are displayed. Otherwise, no, there is no
further post-processing being done.
Perhaps you should just link with libcolorblind (see
http://colorblind.alioth.debian.org/) instead of reimplementing the
Gimp-developer mailing list