public class BlendComposite extends Object implements Composite
Graphics2D.setComposite(java.awt.Composite)
that facilitates
basic image blending such as lighten-only overlays.Modifier and Type | Class and Description |
---|---|
(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.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
BlendComposite(int mode)
Simplified constructor with full opacity.
|
BlendComposite(int mode,
double alpha)
Full constructor, with alpha (opacity) value.
|
Modifier and Type | Method and Description |
---|---|
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) |
public static final int NORMAL
public static final int LIGHTEN
public static final int DARKEN
public static final int SCREEN
public static final int MULTIPLY
public static final int OVERLAY
public static final int AVERAGE
private double alpha
private int mode
public BlendComposite(int mode)
mode
- Blending mode.public BlendComposite(int mode, double alpha)
mode
- Blending modealpha
- Opacity valuepublic CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
createContext
in interface Composite
protected static final int combineComponents(int a, int r, int g, int b)
a
- alpha component (0-255)r
- red component (0-255)g
- green component (0-255)b
- blue component (0-255)