de.lmu.ifi.dbs.elki.data.images
Class BlendComposite

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.images.BlendComposite
All Implemented Interfaces:
Composite

public class BlendComposite
extends Object
implements Composite

Class to use in Graphics2D.setComposite(java.awt.Composite) that facilitates basic image blending such as lighten-only overlays.


Nested Class Summary
(package private)  class BlendComposite.AverageBlendingContext
          Blending context for an "average" blending.
protected  class BlendComposite.BlendingContext
          Abstract blending context that takes care of color space conversion and pixel iteration.
(package private)  class BlendComposite.DarkenBlendingContext
          Blending context for a "darken only" blending.
(package private)  class BlendComposite.LightenBlendingContext
          Blending context for a "lighten only" blending.
(package private)  class BlendComposite.MultiplyBlendingContext
          Blending context for a "multiply" blending.
(package private)  class BlendComposite.OverlayBlendingContext
          Blending context for a "overlay" blending.
(package private)  class BlendComposite.ScreenBlendingContext
          Blending context for a "screen" blending.
 
Field Summary
private  double alpha
          Alpha (opacity) value.
static int AVERAGE
          "Average" blending.
static int DARKEN
          Darken-only blending.
static int LIGHTEN
          Lighten-only blending.
private  int mode
          Blending mode to use.
static int MULTIPLY
          "Multiply" blending.
static int NORMAL
          Source blending, using the source image only.
static int OVERLAY
          "Overlay" blending.
static int SCREEN
          "Screen" blending.
 
Constructor Summary
BlendComposite(int mode)
          Simplified constructor with full opacity.
BlendComposite(int mode, double alpha)
          Full constructor, with alpha (opacity) value.
 
Method Summary
protected static int combineComponents(int a, int r, int g, int b)
          Helper function that combines separate ARGB values into a single ARGB integer.
 CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL

public static final int NORMAL
Source blending, using the source image only.

See Also:
Constant Field Values

LIGHTEN

public static final int LIGHTEN
Lighten-only blending.

See Also:
Constant Field Values

DARKEN

public static final int DARKEN
Darken-only blending.

See Also:
Constant Field Values

SCREEN

public static final int SCREEN
"Screen" blending.

See Also:
Constant Field Values

MULTIPLY

public static final int MULTIPLY
"Multiply" blending.

See Also:
Constant Field Values

OVERLAY

public static final int OVERLAY
"Overlay" blending.

See Also:
Constant Field Values

AVERAGE

public static final int AVERAGE
"Average" blending.

See Also:
Constant Field Values

alpha

private double alpha
Alpha (opacity) value.


mode

private int mode
Blending mode to use.

Constructor Detail

BlendComposite

public BlendComposite(int mode)
Simplified constructor with full opacity.

Parameters:
mode - Blending mode.

BlendComposite

public BlendComposite(int mode,
                      double alpha)
Full constructor, with alpha (opacity) value.

Parameters:
mode - Blending mode
alpha - Opacity value
Method Detail

createContext

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

combineComponents

protected static final int combineComponents(int a,
                                             int r,
                                             int g,
                                             int b)
Helper function that combines separate ARGB values into a single ARGB integer.

Parameters:
a - alpha component (0-255)
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
Returns:
Integer value in ARGB order.

Release 0.4.0 (2011-09-20_1324)