[Gimp-developer] color deficit simulation filter

Giacomo Mazzocato gmazzocato at gmail.com
Sat Nov 10 10:25:47 PST 2007


Hi,
I'd like to ask a question about the algorithm that filter uses.
The file that handles the simulation is cdisplay_colorblind.c.

I've tried to reimplement it in another language and in the function
cdisplay_colorblind_convert with certain colors (for instance #000000) I get a 
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 of 
deficit:
	case COLORBLIND_DEFICIENCY_PROTANOPIA:
            tmp = blue / green;
and
	case COLORBLIND_DEFICIENCY_TRITANOPIA:
            tmp = green / red;

Perhaps those errors are ignored in C, but shouldn't they be handled correctly 
or prevented ?

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 which 
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 ?

Thank you in advance,
Giacomo


More information about the Gimp-developer mailing list