Added another Photoshop tyle blend mode: Exclusion

Performs a sort of color XOR with source and destination.
Very useful for UI highlighting but is a bizarre (and
potentially useful) effect in 3D.
This commit is contained in:
pspeed42 2014-09-10 14:00:27 -04:00
parent a18c568579
commit 5a482e2b98
4 changed files with 18 additions and 1 deletions

View File

@ -559,6 +559,9 @@ public class OGLESShaderRenderer implements Renderer {
case Screen:
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_COLOR);
break;
case Exclusion:
GLES20.glBlendFunc(GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());

View File

@ -183,7 +183,15 @@ public class RenderState implements Cloneable, Savable {
* <p>
* Result = 1 - (1 - Source Color) * (1 - Dest Color) -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)
*/
Screen
Screen,
/**
* Mixes the destination and source colors similar to a color-based XOR
* operation. This is directly equivalent to Photoshop's "Exclusion" blend.
* <p>
* Result = (Source Color * (1 - Dest Color)) + (Dest Color * (1 - Source Color))
* -> (GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR)
*/
Exclusion
}
/**

View File

@ -701,6 +701,9 @@ public class JoglRenderer implements Renderer {
case Screen:
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_COLOR);
break;
case Exclusion:
gl.glBlendFunc(GL.GL_ONE_MINUS_DST_COLOR, GL.GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());

View File

@ -650,6 +650,9 @@ public class LwjglRenderer implements Renderer {
case Screen:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
break;
case Exclusion:
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());