Class BlendMode
- java.lang.Object
-
- ca.cgjennings.graphics.composites.AbstractARGBComposite
-
- ca.cgjennings.graphics.composites.BlendMode
-
- All Implemented Interfaces:
java.awt.Composite
- Direct Known Subclasses:
MaskComposite
public abstract class BlendMode extends AbstractARGBComposite
Composites that have similar effects to the layer blending modes in popular paint programs. This class itself is an abstract superclass of such composites; it provides concrete implementations for several common modes as immutable static members.Note: Because this extends
AbstractARGBComposite, it only supports 32-bit integer (A)RGB colour models. To avoid potential problems, do not apply this composite directly to a screen, printer, or other arbitrary graphics context. Instead, create a temporary image inTYPE_INT_RGBorTYPE_INT_ARGBmode, composite into this image, and then draw the image to the destination.- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static BlendModeAddFor each channel,Addtakes the sum of the of the source and destination values.static BlendModeBurnFor each channel,Burndecreases the brightness of the destination relative to the brightness of the source.static BlendModeColorColormixes the hue and saturation of the source pixel but keeps the brightness of the destination.static BlendModeColorBurnFor each channel,ColorBurndecreases the contrast of the destination relative to the brightness of the source.static BlendModeColorDodgeFor each channel,ColorDodgebrightens the destination by decreasing the contrast relative to the source.static BlendModeDarkenFor each channel,Darkenchooses the darker of the source and destination values.static BlendModeDifferenceFor each channel,Differencetakes the absolute value of the difference of the source and destination values.static BlendModeDodgeFor each channel,Dodgeincreases the brightness of the destination relative to the brightness of the source.static BlendModeExclusionExclusionproduces an effect similar toDifference, but lower in contrast.static BlendModeGlowGlowhas the same effect asReflect, but is used when the source and destination are reversed.static BlendModeHardLightFor each channel,HardLighteither multiplies or screens the values, depending on the source value.static BlendModeHardMixFor each channel,HardMixdrives the value to either be fully off or fully on depending on the sum of the source and destination values.static BlendModeHueHuemixes the hue of the source pixel but keeps the saturation and brightness of the destination.static BlendModeLightenFor each channel,Lightenchooses the lighter of the source and destination values.static BlendModeLinearBurnFor each channel,LinearBurndarkens the destination by increasing the contrast relative to the source.static BlendModeLinearDodgeLinearDodgeis the same asAdd.static BlendModeLinearLightFor each channel,LinearLighteither dodges or burns the values by adjusting brightness, depending on the source value.static BlendModeLuminosityLuminositymixes the brightness of the source pixel but keeps the hue and saturation of the destination.static BlendModeMultiplyFor each channel,Multiplytakes the product of the of the source and destination values.static BlendModeNegationNegationproduces a similar effect toDifference, but the values are inverted so that the destination becomes lighter rather than darker.static java.awt.AlphaCompositeNormalNormalmixes the source and destination using the weighted averagesource/alpha + destination/(1-alpha).static BlendModeOverlayFor each channel,Overlayeither multiplies or screens the values, depending on the destination.static BlendModePinLightFor each channel,PinLightmay replace the destination value with the source value.static BlendModeReflectReflectlightens the destination based on the source using a non-linear function.static BlendModeSaturationSaturationmixes the saturation of the source pixel but keeps the hue and brightness of the destination.static BlendModeScreenFor each channel,Screentakes the inverse product of the source and destination values.static BlendModeSoftLightFor each channel,SoftLighteither dodges or burns the values, depending on the source value.static BlendModeSubtractFor each channel,Subtractsubtracts the source value from the destination value.static BlendModeVividLightFor each channel,VividLighteither dodges or burns the values by adjusting contrast, depending on the source value.-
Fields inherited from class ca.cgjennings.graphics.composites.AbstractARGBComposite
alpha
-
-
Method Summary
-
Methods inherited from class ca.cgjennings.graphics.composites.AbstractARGBComposite
compose, createContext, derive, getAlpha
-
-
-
-
Field Detail
-
Normal
public static final java.awt.AlphaComposite Normal
Normalmixes the source and destination using the weighted averagesource/alpha + destination/(1-alpha).Normalis identical to theAlphaComposite.SrcOvercomposite. It is included here for completeness.
-
Lighten
public static final BlendMode Lighten
For each channel,Lightenchooses the lighter of the source and destination values.
-
Darken
public static final BlendMode Darken
For each channel,Darkenchooses the darker of the source and destination values.
-
Add
public static final BlendMode Add
For each channel,Addtakes the sum of the of the source and destination values. The result is always lighter unless the destination is white or the source is black.Addis sometimes called Linear Dodge.
-
Subtract
public static final BlendMode Subtract
For each channel,Subtractsubtracts the source value from the destination value.
-
Difference
public static final BlendMode Difference
For each channel,Differencetakes the absolute value of the difference of the source and destination values.
-
Exclusion
public static final BlendMode Exclusion
Exclusionproduces an effect similar toDifference, but lower in contrast.
-
Negation
public static final BlendMode Negation
Negationproduces a similar effect toDifference, but the values are inverted so that the destination becomes lighter rather than darker.
-
Multiply
public static final BlendMode Multiply
For each channel,Multiplytakes the product of the of the source and destination values. The result is always darker unless the destination is black.
-
Screen
public static final BlendMode Screen
For each channel,Screentakes the inverse product of the source and destination values. The result is always lighter unless the destination is white. Visually, the effect is comparable to projecting one photographic slide over another.
-
Burn
public static final BlendMode Burn
For each channel,Burndecreases the brightness of the destination relative to the brightness of the source.
-
ColorBurn
public static final BlendMode ColorBurn
For each channel,ColorBurndecreases the contrast of the destination relative to the brightness of the source.
-
LinearBurn
public static final BlendMode LinearBurn
For each channel,LinearBurndarkens the destination by increasing the contrast relative to the source.
-
Dodge
public static final BlendMode Dodge
For each channel,Dodgeincreases the brightness of the destination relative to the brightness of the source.
-
ColorDodge
public static final BlendMode ColorDodge
For each channel,ColorDodgebrightens the destination by decreasing the contrast relative to the source.
-
Overlay
public static final BlendMode Overlay
For each channel,Overlayeither multiplies or screens the values, depending on the destination. The effect is to retain shadows from the destination while taking on colour from the source.
-
HardLight
public static final BlendMode HardLight
For each channel,HardLighteither multiplies or screens the values, depending on the source value. Visually, the effect is similar to shining a hard spotlight over the destination.
-
SoftLight
public static final BlendMode SoftLight
For each channel,SoftLighteither dodges or burns the values, depending on the source value. Visually, the effect is similar to shining a diffuse spotlight over the destination.
-
LinearLight
public static final BlendMode LinearLight
For each channel,LinearLighteither dodges or burns the values by adjusting brightness, depending on the source value. Visually, the effect is similar to shining a diffuse spotlight over the destination.
-
PinLight
public static final BlendMode PinLight
For each channel,PinLightmay replace the destination value with the source value. When the source value is light, the darker of the source and destination is selected. When the source value is dark, the lighter of the source and destination is selected.
-
VividLight
public static final BlendMode VividLight
For each channel,VividLighteither dodges or burns the values by adjusting contrast, depending on the source value. Visually, the effect is similar to shining a diffuse spotlight over the destination.
-
HardMix
public static final BlendMode HardMix
For each channel,HardMixdrives the value to either be fully off or fully on depending on the sum of the source and destination values. Thus, each pixel will be one of black, red, green, blue, yellow, cyan, magenta, or white.
-
Reflect
public static final BlendMode Reflect
Reflectlightens the destination based on the source using a non-linear function. It is useful for adding shine or highlights to the destination.
-
Glow
public static final BlendMode Glow
Glowhas the same effect asReflect, but is used when the source and destination are reversed.
-
Hue
public static final BlendMode Hue
Huemixes the hue of the source pixel but keeps the saturation and brightness of the destination.
-
Saturation
public static final BlendMode Saturation
Saturationmixes the saturation of the source pixel but keeps the hue and brightness of the destination.
-
Color
public static final BlendMode Color
Colormixes the hue and saturation of the source pixel but keeps the brightness of the destination.
-
Luminosity
public static final BlendMode Luminosity
Luminositymixes the brightness of the source pixel but keeps the hue and saturation of the destination.
-
-