@Override public void blend(Color source, Color dest, Color output) { output.r = (dest.r == 1) ? 1 : source.r / (1 - dest.r); output.g = (dest.g == 1) ? 1 : source.g / (1 - dest.g); output.b = (dest.b == 1) ? 1 : source.b / (1 - dest.b); output.a = dest.a; output.clamp(); }
@Override public void blend(Color source, Color dest, Color output) { output.r = min(source.r, dest.r); output.g = min(source.g, dest.g); output.b = min(source.b, dest.b); output.a = dest.a; output.clamp(); }
@Override public void blend(Color source, Color dest, Color output) { output.r = (1 - ((1 - dest.r) * (1 - source.r))); output.g = (1 - ((1 - dest.g) * (1 - source.g))); output.b = (1 - ((1 - dest.b) * (1 - source.b))); output.a = dest.a; output.clamp(); }
// TCOD_BKGND_OVERLAY @Override public void blend(Color source, Color dest, Color output) { output.r = source.r <= 0.5 ? 2 * (source.r) * dest.r : 1 - 2 * (1 - source.r) * (1 - dest.r); output.g = source.g <= 0.5 ? 2 * (source.g) * dest.g : 1 - 2 * (1 - source.g) * (1 - dest.g); output.b = source.b <= 0.5 ? 2 * (source.b) * dest.b : 1 - 2 * (1 - source.b) * (1 - dest.b); output.a = dest.a; output.clamp(); }
// JCOD Extension @Override public void blend(Color source, Color dest, Color output) { output.r = source.r * source.a + dest.r * (1 - source.a); output.g = source.g * source.a + dest.g * (1 - source.a); output.b = source.b * source.a + dest.b * (1 - source.a); output.a = dest.a; output.clamp(); }
@Override public void blend(Color source, Color dest, Color output) { output.r = (source.r == 0) ? 0 : 1 - (1 - dest.r) / source.r; output.g = (source.g == 0) ? 0 : 1 - (1 - dest.g) / source.g; output.b = (source.b == 0) ? 0 : 1 - (1 - dest.b) / source.b; output.a = dest.a; output.clamp(); }
@Override public void blend(Color source, Color dest, Color output) { // can't use set/add/sub methods, they clamp too soon output.r = source.r + dest.r - 1; output.g = source.g + dest.g - 1; output.b = source.b + dest.b - 1; output.a = dest.a; output.clamp(); }
// *back = TCOD_color_lerp(*back,col,(float)(alpha/255.0f)); @Override public void blend(Color source, Color dest, Color output) { lerp(dest, source, source.a, output); output.a = dest.a; output.clamp(); }