[Gimp-developer] again: burn function - how does it work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.
After checking the i18n files i now know that "nachbelichten" is supposed to 
be burn.
However, the appropriate function in app/coposite-generic.c does not seem to 
behave as expected.
afaik the burn function should do nothing if the the upper (the burning) color 
is white.
also a black pixel of the lower layer should remain black - whatever the upper 
layer is colored.
However, this function:

  while (length--)
    {
      for (b = 0; b < alpha; b++)
        {
          tmp = (255 - src1[b]) << 8;
          tmp /= src2[b] + 1;
          dest[b] = (guchar) CLAMP(255 - tmp, 0, 255);
        }
      if (has_alpha1 && has_alpha2)
        dest[alpha] = MIN(src1[alpha], src2[alpha]);
      else if (has_alpha2)
        dest[alpha] = src2[alpha];

      src1 += bytes1;
      src2 += bytes2;
      dest += bytes2;
    }

cannot provide this.
(e.g. upper (src1) is white (255) -> tmp = 0 << 8 = 0; => 0 / ? + 1 = 0; 
CLAMP(255 - 0, 0, 255) = 255 = white - so white will flatten anything instead 
of leaving it as it is.
as a consequence, black won't remain, as soon as one of the components r,g,b = 
255.
i tried to weight the effect (255-0)/255*burn + (1-(255-0)/255)*original... 
but the result wasn't like what i expected.

so - does anyone know which step i missed, or where i can get more information 
about the theory behind?

Thanks,
Thomas
-- 
Think, think different. But essentially: Think!

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux