enum
org.flixelgdx.util.FlixelBlendMode
public final enum FlixelBlendMode
Enum for different FlixelSprite blend modes.
Using any blend mode other than FlixelBlendMode.NORMAL will send an extra flush to the GPU, so it's a good idea to be mindful of what sprites to apply blending to.
Layering also matters. Some blend types are usually affected when something is above or below it, so keep that in mind when using this.
Fields
NORMAL
public static final FlixelBlendMode NORMAL
Normal drawing, no special blending. The default for every sprite.
ADD
public static final FlixelBlendMode ADD
Adds a sprite's color to whatever is already drawn underneath, brightening it. Good for glows, fire, and light effects.
MULTIPLY
public static final FlixelBlendMode MULTIPLY
Multiplies a sprite's color with what's underneath, darkening it. Good for shadows and tinting.
SCREEN
public static final FlixelBlendMode SCREEN
Lightens what's underneath based on a sprite's color, the opposite of FlixelBlendMode.MULTIPLY. Good for lighting without fully blowing out to white like FlixelBlendMode.ADD can.
SUBTRACT
public static final FlixelBlendMode SUBTRACT
Subtracts a sprite's color from whatever is underneath, darkening it. Good for smoke or ink effects.
LIGHTEN
public static final FlixelBlendMode LIGHTEN
Keeps whichever is brighter: a sprite's color or what's underneath, pixel by pixel. Good for particles and highlights that shouldn't over-brighten upon overlap.
DARKEN
public static final FlixelBlendMode DARKEN
Keeps whichever is darker: a sprite's color or what's underneath, pixel by pixel. The opposite of LIGHTEN. Good for shading and vignette-style overlays.
main() {\n v_color = a_color;\n v_color.a = v_color.a *)
public static final String BLEND_VERTEX_SHADER = "attribute vec4 a_position;\nattribute vec4 a_color;\nattribute vec2 a_texCoord0;\nuniform mat4 u_projTrans;\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nvoid main() {\n v_color = a_color;\n v_color.a = v_color.a * (255.0/254.0)
main() {\n vec4 c = v_color *, v_texCoords);\n gl_FragColor = vec4(c.rgb *, c.a)
public static final String PREMULTIPLIED_FRAGMENT_SHADER = "#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nuniform sampler2D u_texture;\nvoid main() {\n vec4 c = v_color * texture2D(u_texture, v_texCoords);\n gl_FragColor = vec4(c.rgb * c.a, c.a)
main() {\n vec4 c = v_color *, v_texCoords);\n vec3 result =, c.rgb, c.a);\n gl_FragColor =, c.a)
public static final String WHITE_MIX_FRAGMENT_SHADER = "#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nuniform sampler2D u_texture;\nvoid main() {\n vec4 c = v_color * texture2D(u_texture, v_texCoords);\n vec3 result = mix(vec3(1.0), c.rgb, c.a);\n gl_FragColor = vec4(result, c.a)
Methods
values()
public static FlixelBlendMode[] values()
valueOf(String)
public static FlixelBlendMode valueOf(String name)