Enum Class BlendMode
- All Implemented Interfaces:
Blender
,RefCounted
,Serializable
,Comparable<BlendMode>
,Constable
Non-clamped blend modes ≤ MODULATE
, plus SCREEN
are
Porter-Duff blend modes. They can be directly implemented by GPU hardware.
The others are advanced blend equations, which need to be implemented in
fragment shaders, or require an extension.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionDestination pixels covered by the source are cleared to 0.Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged.Makes destination darker to reflect source.Makes destination brighter to reflect source.Retains the smallest component of the source and destination pixels.Similar toDARKEN
, but darkens on the composite channel, instead of separate RGB color channels.Subtracts darker from lighter with higher contrast.Divides the destination pixels by the source pixels and saturates the result.The source pixels are discarded, leaving the destination intact.Discards the destination pixels that are not covered by source pixels.Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.Keeps the destination pixels that are not covered by source pixels.The source pixels are drawn behind the destination pixels.Subtracts darker from lighter with lower contrast.Makes destination lighter or darker, depending on source.Adds two images together, setting each color channel value to either 0 or 1.Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged.Retains the largest component of the source and destination pixel.Similar toLIGHTEN
, but lightens on the composite channel, instead of separate RGB color channels.Darkens the destination pixels to reflect the source pixels while also increasing contrast.Lightens the destination pixels to reflect the source pixels while also increasing contrast.Burns or dodges colors by changing brightness, depending on the blend color.Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged.Subtracts the source pixels from the destination pixels, without alpha blending.Subtracts the source pixels from the destination pixels and saturates the result, without alpha blending.Multiplies the source and destination pixels, without alpha blending.Multiplies the source and destination pixels.Multiplies or screens the source and destination depending on the destination color.Conditionally replaces destination pixels with source pixels depending on the brightness of the source pixels.Adds the source pixels to the destination pixels, without alpha blending.Adds the source pixels to the destination pixels and saturates the result, without alpha blending.Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged.Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.Makes destination lighter or darker, depending on source.The source pixels replace the destination pixels.Discards the source pixels that do not cover destination pixels.Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.Keeps the source pixels that do not cover destination pixels.The source pixels are drawn over the destination pixels.Subtracts the source pixels from the destination pixels and saturates the result, with alpha blending.Burns or dodges colors by changing contrast, depending on the blend color.Discards the source and destination pixels where source pixels cover destination pixels. -
Field Summary
Modifier and TypeFieldDescriptionstatic final BlendMode
Name alias ofLINEAR_DODGE
.static final int
Number of blend modes, runtime constant. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
apply
(float[] src, float[] dst, float[] out) Applies this blend mode with RGBA colors.Returns the blender's BlendMode in 'mode' if this Blender represents any BlendMode.static void
blend_color
(float[] src, float[] dst, float[] out) Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged.static void
blend_color_burn
(float[] src, float[] dst, float[] out) Makes destination darker to reflect source.static void
blend_color_dodge
(float[] src, float[] dst, float[] out) Makes destination brighter to reflect source.static void
blend_darken
(float[] src, float[] dst, float[] out) Retains the smallest component of the source and destination pixels.static void
blend_darker_color
(float[] src, float[] dst, float[] out) Similar toDARKEN
, but darkens on the composite channel, instead of separate RGB color channels.static void
blend_difference
(float[] src, float[] dst, float[] out) Subtracts darker from lighter with higher contrast.static void
blend_divide
(float[] src, float[] dst, float[] out) Divides the destination pixels by the source pixels and saturates the result.static void
blend_dst_atop
(float[] src, float[] dst, float[] out) static void
blend_dst_in
(float[] src, float[] dst, float[] out) static void
blend_dst_out
(float[] src, float[] dst, float[] out) static void
blend_dst_over
(float[] src, float[] dst, float[] out) static void
blend_exclusion
(float[] src, float[] dst, float[] out) Subtracts darker from lighter with lower contrast.static void
blend_hard_light
(float[] src, float[] dst, float[] out) Makes destination lighter or darker, depending on source.static void
blend_hard_mix
(float[] src, float[] dst, float[] out) Adds two images together, setting each color channel value to either 0 or 1.static void
blend_hue
(float[] src, float[] dst, float[] out) Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged.static void
blend_lighten
(float[] src, float[] dst, float[] out) Retains the largest component of the source and destination pixel.static void
blend_lighter_color
(float[] src, float[] dst, float[] out) Similar toLIGHTEN
, but lightens on the composite channel, instead of separate RGB color channels.static void
blend_linear_burn
(float[] src, float[] dst, float[] out) Darkens the destination pixels to reflect the source pixels while also increasing contrast.static void
blend_linear_dodge
(float[] src, float[] dst, float[] out) Lightens the destination pixels to reflect the source pixels while also increasing contrast.static void
blend_linear_light
(float[] src, float[] dst, float[] out) Burns or dodges colors by changing brightness, depending on the blend color.static void
blend_luminosity
(float[] src, float[] dst, float[] out) Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged.static void
blend_minus
(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels, without alpha blending.static void
blend_minus_clamped
(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels and saturates the result, without alpha blending.static void
blend_modulate
(float[] src, float[] dst, float[] out) Multiplies the source and destination pixels, without alpha blending.static void
blend_multiply
(float[] src, float[] dst, float[] out) Multiplies the source and destination pixels.static void
blend_overlay
(float[] src, float[] dst, float[] out) Multiplies or screens the source and destination depending on the destination color.static void
blend_pin_light
(float[] src, float[] dst, float[] out) Conditionally replaces destination pixels with source pixels depending on the brightness of the source pixels.static void
blend_plus
(float[] src, float[] dst, float[] out) Adds the source pixels to the destination pixels, without alpha blending.static void
blend_plus_clamped
(float[] src, float[] dst, float[] out) Adds the source pixels to the destination pixels and saturates the result, without alpha blending.static void
blend_saturation
(float[] src, float[] dst, float[] out) Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged.static void
blend_screen
(float[] src, float[] dst, float[] out) Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.static void
blend_soft_light
(float[] src, float[] dst, float[] out) Makes destination lighter or darker, depending on source.static void
blend_src_atop
(float[] src, float[] dst, float[] out) static void
blend_src_in
(float[] src, float[] dst, float[] out) static void
blend_src_out
(float[] src, float[] dst, float[] out) static void
blend_src_over
(float[] src, float[] dst, float[] out) static void
blend_subtract
(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels and saturates the result, with alpha blending.static void
blend_vivid_light
(float[] src, float[] dst, float[] out) Burns or dodges colors by changing contrast, depending on the blend color.static void
blend_xor
(float[] src, float[] dst, float[] out) Returns the name of blend function.boolean
25 blend modes afterMULTIPLY
are advanced.static BlendMode
modeAt
(int index) Returns the value at the given index.void
ref()
Increases the reference count by 1.void
unref()
Decreases the reference count by 1.static BlendMode
Returns the enum constant of this class with the specified name.static BlendMode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CLEAR
Destination pixels covered by the source are cleared to 0.
aout = 0
Cout = 0
-
SRC
The source pixels replace the destination pixels.
aout = asrc
Cout = Csrc
-
DST
The source pixels are discarded, leaving the destination intact.
aout = adst
Cout = Cdst
-
SRC_OVER
The source pixels are drawn over the destination pixels.
aout = asrc + (1 - asrc) * adst
Cout = Csrc + (1 - asrc) * Cdst
-
DST_OVER
The source pixels are drawn behind the destination pixels.
aout = adst + (1 - adst) * asrc
Cout = Cdst + (1 - adst) * Csrc
-
SRC_IN
Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.
aout = asrc * adst
Cout = Csrc * adst
-
DST_IN
Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.
aout = adst * asrc
Cout = Cdst * asrc
-
SRC_OUT
Keeps the source pixels that do not cover destination pixels. Discards source pixels that cover destination pixels. Discards all destination pixels.
aout = (1 - adst) * asrc
Cout = (1 - adst) * Csrc
-
DST_OUT
Keeps the destination pixels that are not covered by source pixels. Discards destination pixels that are covered by source pixels. Discards all source pixels.
aout = (1 - asrc) * adst
Cout = (1 - asrc) * Cdst
-
SRC_ATOP
Discards the source pixels that do not cover destination pixels. Draws remaining source pixels over destination pixels.
aout = adst
Cout = adst * Csrc + (1 - asrc) * Cdst
-
DST_ATOP
Discards the destination pixels that are not covered by source pixels. Draws remaining destination pixels over source pixels.
aout = asrc
Cout = asrc * Cdst + (1 - adst) * Csrc
-
XOR
Discards the source and destination pixels where source pixels cover destination pixels. Draws remaining source pixels.
aout = (1 - adst) * asrc + (1 - asrc) * adst
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdst
-
PLUS
Adds the source pixels to the destination pixels, without alpha blending. For floating-point textures, color components may be greater than 1.0.
aout = asrc + adst
Cout = Csrc + Cdst
- See Also:
-
PLUS_CLAMPED
Adds the source pixels to the destination pixels and saturates the result, without alpha blending. For unsigned fixed-point textures, this is the same as
PLUS
. This is a special blend equation.aout = max(0, min(asrc + adst, 1))
Cout = max(0, min(Csrc + Cdst, 1))
- See Also:
-
MINUS
Subtracts the source pixels from the destination pixels, without alpha blending. For floating-point textures, color components may be less than 0.0.
aout = adst - asrc
Cout = Cdst - Csrc
- See Also:
-
MINUS_CLAMPED
Subtracts the source pixels from the destination pixels and saturates the result, without alpha blending. For unsigned fixed-point textures, this is the same as
MINUS
. This is a special blend equation.aout = max(0, min(adst - asrc, 1))
Cout = max(0, min(Cdst - Csrc, 1))
- See Also:
-
MODULATE
Multiplies the source and destination pixels, without alpha blending.
aout = asrc * adst
Cout = Csrc * Cdst
- See Also:
-
MULTIPLY
Multiplies the source and destination pixels. This is
MODULATE
with alpha blending. If both the source and destination are opaque, then this is the same asMODULATE
. This is an advanced blend equation.aout = asrc + adst - asrc * adst
Cout = Csrc * Cdst + (1 - adst) * Csrc + (1 - asrc) * Cdst
- See Also:
-
SCREEN
Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - Csrc * Cdst
-
OVERLAY
Multiplies or screens the source and destination depending on the destination color. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≤ 0.5 * adst:
Cout = 2 * Csrc * Cdst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst - 2 * (asrc - Csrc) * (adst - Cdst) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
DARKEN
Retains the smallest component of the source and destination pixels. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = min(Csrc / asrc, Cdst / adst) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
LIGHTEN
Retains the largest component of the source and destination pixel. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = max(Csrc / asrc, Cdst / adst) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
COLOR_DODGE
Makes destination brighter to reflect source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≤ 0:
Cout = Csrc * (1 - adst)if Csrc ≥ asrc:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * min(adst, Cdst * asrc / (asrc - Csrc)) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
COLOR_BURN
Makes destination darker to reflect source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≥ adst:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif Csrc ≤ 0:
Cout = Cdst * (1 - asrc)otherwise:
Cout = asrc * (adst - min(adst, (adst - Cdst) * asrc / Cdst)) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
HARD_LIGHT
Makes destination lighter or darker, depending on source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0.5 * asrc:
Cout = 2 * Csrc * Cdst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst - 2 * (asrc - Csrc) * (adst - Cdst) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
SOFT_LIGHT
Makes destination lighter or darker, depending on source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0.5 * asrc:
Cout = Cdst * Cdst * (asrc - 2 * Csrc) / adst + (1 - adst) * Csrc + Cdst * (2 * Csrc + 1 - asrc)if Cdst ≤ 0.25 * adst:
Cout = (adst * adst * (Csrc + Cdst * (6 * Csrc - 3 * asrc + 1)) + 12 * adst * Cdst * Cdst * (asrc - 2 * Csrc) - 16 * Cdst * Cdst * Cdst * (asrc - 2 * Csrc) - adst * adst * adst * Csrc) / adst * adstotherwise:
Cout = Cdst * (asrc - 2 * Csrc + 1) + Csrc * (1 - adst) - sqrt(Cdst * adst) * (asrc - 2 * Csrc) -
DIFFERENCE
Subtracts darker from lighter with higher contrast. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - 2 * min(Csrc * adst, Cdst * asrc)
-
EXCLUSION
Subtracts darker from lighter with lower contrast. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - 2 * Csrc * Cdst
-
SUBTRACT
Subtracts the source pixels from the destination pixels and saturates the result, with alpha blending. If both the source and destination are opaque, then this is the same as
MINUS_CLAMPED
. This is a custom blend equation.aout = asrc + adst - asrc * adst
if Cdst / adst - Csrc / asrc ≥ 0:
Cout = Csrc + Cdst - 2 * Csrc * adstotherwise:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdst- See Also:
-
DIVIDE
Divides the destination pixels by the source pixels and saturates the result. For negative and NaN values, the result color is black (XOR). This is a custom blend equation.
aout = asrc + adst - asrc * adst
Cout = pin((Cdst * asrc) / (Csrc * adst), 0, 1) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
LINEAR_DODGE
Lightens the destination pixels to reflect the source pixels while also increasing contrast. This is
PLUS_CLAMPED
with alpha blending. If both the source and destination are opaque, then this is the same asPLUS_CLAMPED
. This is an extended advanced blend equation.aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst ≤ 1:
Cout = Csrc + Cdstotherwise:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst- See Also:
-
LINEAR_BURN
Darkens the destination pixels to reflect the source pixels while also increasing contrast. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst > 1:
Cout = Csrc + Cdst - asrc * adstotherwise:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdst -
VIVID_LIGHT
Burns or dodges colors by changing contrast, depending on the blend color. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0:
Cout = Cdst * (1 - asrc)if Csrc < 0.5 * asrc:
Cout = asrc * (adst - min(adst, (adst - Cdst) * asrc / (2 * Cdst))) + (1 - adst) * Csrc + (1 - asrc) * Cdstif Csrc ≥ asrc:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * min(adst, Cdst * asrc / (2 * (asrc - Csrc))) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
LINEAR_LIGHT
Burns or dodges colors by changing brightness, depending on the blend color. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if 2 * Csrc / asrc + Cdst / adst > 2:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc + Cdst / adst ≤ 1:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = 2 * Csrc * adst + Cdst * asrc - asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst -
PIN_LIGHT
Conditionally replaces destination pixels with source pixels depending on the brightness of the source pixels. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if 2 * Csrc / asrc - Cdst / adst > 1 && Csrc < 0.5 * asrc:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc - Cdst / adst > 1 && Csrc ≥ 0.5 * asrc:
Cout = 2 * Csrc * adst - asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc - Cdst / adst ≤ 1 && Csrc * adst < 0.5 * Cdst * asrc:
Cout = 2 * Csrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = Cdst * asrc + (1 - adst) * Csrc + (1 - asrc) * Cdst -
HARD_MIX
Adds two images together, setting each color channel value to either 0 or 1. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst < 1:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst -
DARKER_COLOR
-
LIGHTER_COLOR
-
HUE
Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged. This is an advanced blend equation.
-
SATURATION
Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged. This is an advanced blend equation.
-
COLOR
Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged. This is an advanced blend equation.
-
LUMINOSITY
Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged. This is an advanced blend equation.
-
-
Field Details
-
ADD
Name alias ofLINEAR_DODGE
. -
COUNT
public static final int COUNTNumber of blend modes, runtime constant.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
modeAt
Returns the value at the given index. This method can only be used at runtime, the return value does not guarantee binary compatibility.- Parameters:
index
- theEnum.ordinal()
- Returns:
- the blend mode
-
ref
public void ref()Description copied from interface:RefCounted
Increases the reference count by 1.- Specified by:
ref
in interfaceRefCounted
-
unref
public void unref()Description copied from interface:RefCounted
Decreases the reference count by 1.- Specified by:
unref
in interfaceRefCounted
-
asBlendMode
Description copied from interface:Blender
Returns the blender's BlendMode in 'mode' if this Blender represents any BlendMode. Returns null for other types of blends.- Specified by:
asBlendMode
in interfaceBlender
-
isAdvanced
public boolean isAdvanced()25 blend modes afterMULTIPLY
are advanced.Advanced blend modes are not directly supported by 3D API, they will be implemented with custom fragment shader code and DST read (via texture barrier, input attachment, or image copy). Advanced blend modes should be avoided for operations other than layer compositing. All advanced blend modes are SrcOver-like, then they are alpha conservative.
- MULTIPLY
- SCREEN
- OVERLAY
- DARKEN
- LIGHTEN
- COLOR_DODGE
- COLOR_BURN
- HARD_LIGHT
- SOFT_LIGHT
- DIFFERENCE
- EXCLUSION
- SUBTRACT
- DIVIDE
- LINEAR_DODGE
- LINEAR_BURN
- VIVID_LIGHT
- LINEAR_LIGHT
- PIN_LIGHT
- HARD_MIX
- DARKER_COLOR
- LIGHTER_COLOR
- HUE
- SATURATION
- COLOR
- LUMINOSITY
-
getBlendFuncName
Returns the name of blend function.Raster pipeline implementation and shader implementation must be consistent with this.
-
apply
Applies this blend mode with RGBA colors. src, dst and out store premultiplied R,G,B,A components from index 0 to 3. src, dst and out can be the same pointer. src and dst are read-only, out may be written multiple times.This method is mainly used for blending solid colors without using shader code.
This method is final to avoid generating too many anonymous classes.
-
blend_src_over
public static void blend_src_over(float[] src, float[] dst, float[] out) -
blend_dst_over
public static void blend_dst_over(float[] src, float[] dst, float[] out) -
blend_src_in
public static void blend_src_in(float[] src, float[] dst, float[] out) -
blend_dst_in
public static void blend_dst_in(float[] src, float[] dst, float[] out) -
blend_src_out
public static void blend_src_out(float[] src, float[] dst, float[] out) -
blend_dst_out
public static void blend_dst_out(float[] src, float[] dst, float[] out) -
blend_src_atop
public static void blend_src_atop(float[] src, float[] dst, float[] out) -
blend_dst_atop
public static void blend_dst_atop(float[] src, float[] dst, float[] out) -
blend_xor
public static void blend_xor(float[] src, float[] dst, float[] out) -
blend_plus
public static void blend_plus(float[] src, float[] dst, float[] out) Adds the source pixels to the destination pixels, without alpha blending. For floating-point textures, color components may be greater than 1.0.
aout = asrc + adst
Cout = Csrc + Cdst
-
blend_plus_clamped
public static void blend_plus_clamped(float[] src, float[] dst, float[] out) Adds the source pixels to the destination pixels and saturates the result, without alpha blending. For unsigned fixed-point textures, this is the same as
PLUS
. This is a special blend equation.aout = max(0, min(asrc + adst, 1))
Cout = max(0, min(Csrc + Cdst, 1))
-
blend_minus
public static void blend_minus(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels, without alpha blending. For floating-point textures, color components may be less than 0.0.
aout = adst - asrc
Cout = Cdst - Csrc
-
blend_minus_clamped
public static void blend_minus_clamped(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels and saturates the result, without alpha blending. For unsigned fixed-point textures, this is the same as
MINUS
. This is a special blend equation.aout = max(0, min(adst - asrc, 1))
Cout = max(0, min(Cdst - Csrc, 1))
-
blend_modulate
public static void blend_modulate(float[] src, float[] dst, float[] out) Multiplies the source and destination pixels, without alpha blending.
aout = asrc * adst
Cout = Csrc * Cdst
-
blend_multiply
public static void blend_multiply(float[] src, float[] dst, float[] out) -
blend_screen
public static void blend_screen(float[] src, float[] dst, float[] out) Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - Csrc * Cdst
-
blend_overlay
public static void blend_overlay(float[] src, float[] dst, float[] out) Multiplies or screens the source and destination depending on the destination color. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≤ 0.5 * adst:
Cout = 2 * Csrc * Cdst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst - 2 * (asrc - Csrc) * (adst - Cdst) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_darken
public static void blend_darken(float[] src, float[] dst, float[] out) Retains the smallest component of the source and destination pixels. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = min(Csrc / asrc, Cdst / adst) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
blend_lighten
public static void blend_lighten(float[] src, float[] dst, float[] out) Retains the largest component of the source and destination pixel. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = max(Csrc / asrc, Cdst / adst) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
blend_color_dodge
public static void blend_color_dodge(float[] src, float[] dst, float[] out) Makes destination brighter to reflect source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≤ 0:
Cout = Csrc * (1 - adst)if Csrc ≥ asrc:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * min(adst, Cdst * asrc / (asrc - Csrc)) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_color_burn
public static void blend_color_burn(float[] src, float[] dst, float[] out) Makes destination darker to reflect source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Cdst ≥ adst:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif Csrc ≤ 0:
Cout = Cdst * (1 - asrc)otherwise:
Cout = asrc * (adst - min(adst, (adst - Cdst) * asrc / Cdst)) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_hard_light
public static void blend_hard_light(float[] src, float[] dst, float[] out) Makes destination lighter or darker, depending on source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0.5 * asrc:
Cout = 2 * Csrc * Cdst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst - 2 * (asrc - Csrc) * (adst - Cdst) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_soft_light
public static void blend_soft_light(float[] src, float[] dst, float[] out) Makes destination lighter or darker, depending on source. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0.5 * asrc:
Cout = Cdst * Cdst * (asrc - 2 * Csrc) / adst + (1 - adst) * Csrc + Cdst * (2 * Csrc + 1 - asrc)if Cdst ≤ 0.25 * adst:
Cout = (adst * adst * (Csrc + Cdst * (6 * Csrc - 3 * asrc + 1)) + 12 * adst * Cdst * Cdst * (asrc - 2 * Csrc) - 16 * Cdst * Cdst * Cdst * (asrc - 2 * Csrc) - adst * adst * adst * Csrc) / adst * adstotherwise:
Cout = Cdst * (asrc - 2 * Csrc + 1) + Csrc * (1 - adst) - sqrt(Cdst * adst) * (asrc - 2 * Csrc) -
blend_difference
public static void blend_difference(float[] src, float[] dst, float[] out) Subtracts darker from lighter with higher contrast. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - 2 * min(Csrc * adst, Cdst * asrc)
-
blend_exclusion
public static void blend_exclusion(float[] src, float[] dst, float[] out) Subtracts darker from lighter with lower contrast. This is an advanced blend equation.
aout = asrc + adst - asrc * adst
Cout = Csrc + Cdst - 2 * Csrc * Cdst
-
blend_subtract
public static void blend_subtract(float[] src, float[] dst, float[] out) Subtracts the source pixels from the destination pixels and saturates the result, with alpha blending. If both the source and destination are opaque, then this is the same as
MINUS_CLAMPED
. This is a custom blend equation.aout = asrc + adst - asrc * adst
if Cdst / adst - Csrc / asrc ≥ 0:
Cout = Csrc + Cdst - 2 * Csrc * adstotherwise:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_divide
public static void blend_divide(float[] src, float[] dst, float[] out) Divides the destination pixels by the source pixels and saturates the result. For negative and NaN values, the result color is black (XOR). This is a custom blend equation.
aout = asrc + adst - asrc * adst
Cout = pin((Cdst * asrc) / (Csrc * adst), 0, 1) * asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst
-
blend_linear_dodge
public static void blend_linear_dodge(float[] src, float[] dst, float[] out) Lightens the destination pixels to reflect the source pixels while also increasing contrast. This is
PLUS_CLAMPED
with alpha blending. If both the source and destination are opaque, then this is the same asPLUS_CLAMPED
. This is an extended advanced blend equation.aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst ≤ 1:
Cout = Csrc + Cdstotherwise:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_linear_burn
public static void blend_linear_burn(float[] src, float[] dst, float[] out) Darkens the destination pixels to reflect the source pixels while also increasing contrast. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst > 1:
Cout = Csrc + Cdst - asrc * adstotherwise:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_vivid_light
public static void blend_vivid_light(float[] src, float[] dst, float[] out) Burns or dodges colors by changing contrast, depending on the blend color. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc ≤ 0:
Cout = Cdst * (1 - asrc)if Csrc < 0.5 * asrc:
Cout = asrc * (adst - min(adst, (adst - Cdst) * asrc / (2 * Cdst))) + (1 - adst) * Csrc + (1 - asrc) * Cdstif Csrc ≥ asrc:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * min(adst, Cdst * asrc / (2 * (asrc - Csrc))) + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_linear_light
public static void blend_linear_light(float[] src, float[] dst, float[] out) Burns or dodges colors by changing brightness, depending on the blend color. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if 2 * Csrc / asrc + Cdst / adst > 2:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc + Cdst / adst ≤ 1:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = 2 * Csrc * adst + Cdst * asrc - asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_pin_light
public static void blend_pin_light(float[] src, float[] dst, float[] out) Conditionally replaces destination pixels with source pixels depending on the brightness of the source pixels. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if 2 * Csrc / asrc - Cdst / adst > 1 && Csrc < 0.5 * asrc:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc - Cdst / adst > 1 && Csrc ≥ 0.5 * asrc:
Cout = 2 * Csrc * adst - asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstif 2 * Csrc / asrc - Cdst / adst ≤ 1 && Csrc * adst < 0.5 * Cdst * asrc:
Cout = 2 * Csrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = Cdst * asrc + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_hard_mix
public static void blend_hard_mix(float[] src, float[] dst, float[] out) Adds two images together, setting each color channel value to either 0 or 1. This is an extended advanced blend equation.
aout = asrc + adst - asrc * adst
if Csrc / asrc + Cdst / adst < 1:
Cout = (1 - adst) * Csrc + (1 - asrc) * Cdstotherwise:
Cout = asrc * adst + (1 - adst) * Csrc + (1 - asrc) * Cdst -
blend_darker_color
public static void blend_darker_color(float[] src, float[] dst, float[] out) -
blend_lighter_color
public static void blend_lighter_color(float[] src, float[] dst, float[] out) -
blend_hue
public static void blend_hue(float[] src, float[] dst, float[] out) Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged. This is an advanced blend equation.
-
blend_saturation
public static void blend_saturation(float[] src, float[] dst, float[] out) Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged. This is an advanced blend equation.
-
blend_color
public static void blend_color(float[] src, float[] dst, float[] out) Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged. This is an advanced blend equation.
-
blend_luminosity
public static void blend_luminosity(float[] src, float[] dst, float[] out) Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged. This is an advanced blend equation.
-