Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » set_difference_blender

This thread is locked; no one can reply to it. rss feed Print
set_difference_blender
kazzmir
Member #1,786
December 2001
avatar

set_difference_blender (in 4.2 and 4.4) uses the absolute differences between pixel components instead of clamping, does anyone know why?

/* _blender_difference16:
 *  16 bit difference blender function.
 */
unsigned long _blender_difference16(unsigned long x, unsigned long y, unsigned long n)
{
   return BLEND(16, ABS(getr16(y) - getr16(x)),
                    ABS(getg16(y) - getg16(x)),
                    ABS(getb16(y) - getb16(x)));
}

Instead of something like

return BLEND(16, MAX(getr16(y) - getr16(x), 0) ...)

I tested both ways and clamping to 0 seems to produce the desired effect.

Go to: