blending
Class BlendingComposite

java.lang.Object
  extended by blending.BlendingComposite
All Implemented Interfaces:
java.awt.Composite

public class BlendingComposite
extends java.lang.Object
implements java.awt.Composite

The BlendingComposite, along with abstract class BlendingContext, defines the methods to compose a draw primitive with the underlying graphics area.

Any implementation of BlendingContext is available to be used by this Blending composite

See Also:
GRAIN_MERGE, MULTIPLY, COLOR_OVERLAY

Field Summary
static int COLOR_OVERLAY
          ColorOverlay mode uses only the pixel color values of the upper layer with the pixel alpha value of the layer below.
static int GRAIN_MERGE
          Grain Merge mode merges a grain layer into the current layer, leaving a grainy version of the original layer.
static int MULTIPLY
          Multiply mode multiplies the pixel values of the upper layer with those of the layer below it and then divides the result by 255.
 
Constructor Summary
BlendingComposite(int blendingMode)
          Create a new instance of BlendingComposite using the given BlentingMode value
 
Method Summary
 java.awt.CompositeContext createContext(java.awt.image.ColorModel srcColorModel, java.awt.image.ColorModel dstColorModel, java.awt.RenderingHints hints)
           
 int getBlendingMode()
          Return the type of this instance blending mode, which could be one of the GRAIN_MERGE, MULTIPLY or COLOR_OVERLAY values
static int parse(java.lang.String blendingMode)
          Converts a string representation of a given blending mode into the blending mode INT constant value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAIN_MERGE

public static final int GRAIN_MERGE
Grain Merge mode merges a grain layer into the current layer, leaving a grainy version of the original layer. It adds the pixel values of the upper and lower layers together and subtracts 128.

The equation is: R = B + T - 128

See Also:
Constant Field Values

MULTIPLY

public static final int MULTIPLY
Multiply mode multiplies the pixel values of the upper layer with those of the layer below it and then divides the result by 255. The result is usually a darker image.

The equation is: R = T × B ÷ 255

See Also:
Constant Field Values

COLOR_OVERLAY

public static final int COLOR_OVERLAY
ColorOverlay mode uses only the pixel color values of the upper layer with the pixel alpha value of the layer below.

See Also:
Constant Field Values
Constructor Detail

BlendingComposite

public BlendingComposite(int blendingMode)
Create a new instance of BlendingComposite using the given BlentingMode value

The value is one of the constants defined in class BlendingComposite which is applicable to instances of this class. The class description lists the constants that are applicable to the class.

Parameters:
blendingMode - the BlendingMode value to be used
Method Detail

createContext

public java.awt.CompositeContext createContext(java.awt.image.ColorModel srcColorModel,
                                               java.awt.image.ColorModel dstColorModel,
                                               java.awt.RenderingHints hints)
Specified by:
createContext in interface java.awt.Composite

parse

public static int parse(java.lang.String blendingMode)
Converts a string representation of a given blending mode into the blending mode INT constant value

Parameters:
blendingMode - the string for the blending mode
Returns:
it's constant value or -1 if match is not found

getBlendingMode

public int getBlendingMode()
Return the type of this instance blending mode, which could be one of the GRAIN_MERGE, MULTIPLY or COLOR_OVERLAY values

Returns:
the blending mode in use by this instance