Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.AlphaComposite
If any input does not have an alpha channel, an alpha value of 1.0 (completely opaque) is assumed for all pixels.
A constant alpha value can also be specified to be multiplied with the alpha value of the source pixels.
The following abbreviations are used in the description of the rules:
The color and alpha components produced by the compositing operation are calculated as follows:
Cd = Cs*Fs + Cd*Fd Ad = As*Fs + Ad*Fdwhere Fs and Fd are specified by each rule. The above equations assume that both source and destination pixels have the color components premultiplied by the alpha component. Similarly, the equations expressed in the definitions of compositing rules below assume premultiplied alpha.
For performance reasons, it is preferable that Tiles passed to the compose method of a CompositeContext object created by the AlphaComposite class have premultiplied data. However, if either source or destination Tiles are not premultiplied, appropriate conversions will be performed before and after the compositing operation.
The resulting alpha of the compositing operation is stored in the destination if the destination has an alpha channel. Otherwise, the resulting color is divided by the resulting alpha before being stored in the destination and the alpha is discarded (if the alpha value is 0.0, the color values are set to 0.0).
Field Summary | |
static int | CLEAR
|
static AlphaComposite | Clear
|
static int | DST_IN
|
static int | DST_OUT
|
static int | DST_OVER
|
static AlphaComposite | DstIn
|
static AlphaComposite | DstOut
|
static AlphaComposite | DstOver
|
static int | SRC
|
static AlphaComposite | Src
|
static int | SRC_IN
|
static int | SRC_OUT
|
static int | SRC_OVER
|
static AlphaComposite | SrcIn
|
static AlphaComposite | SrcOut
|
static AlphaComposite | SrcOver
|
Method Summary | |
CompositeContext | createContext(ColorModel srcColorModel,
ColorModel dstColorModel)
|
boolean | equals(Object obj)
|
float | getAlpha()
|
static AlphaComposite | getInstance(int rule)
|
static AlphaComposite | getInstance(int rule,
float alpha)
|
int | getRule()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int CLEAR
Fs = 0 and Fd = 0, thus:
Cd = 0 Ad = 0
public static final int SRC
Fs = 1 and Fd = 0, thus:
Cd = Cs Ad = As
public static final int SRC_OVER
Fs = 1 and Fd = (1-As), thus:
Cd = Cs + Cd*(1-As) Ad = As + Ad*(1-As)
public static final int DST_OVER
Fs = (1-Ad) and Fd = 1, thus:
Cd = Cs*(1-Ad) + Cd Ad = As*(1-Ad) + Ad
public static final int SRC_IN
Fs = Ad and Fd = 0, thus:
Cd = Cs*Ad Ad = As*Ad
public static final int DST_IN
Fs = 0 and Fd = As, thus:
Cd = Cd*As Ad = Ad*As
public static final int SRC_OUT
Fs = (1-Ad) and Fd = 0, thus:
Cd = Cs*(1-Ad) Ad = As*(1-Ad)
public static final int DST_OUT
Fs = 0 and Fd = (1-As), thus:
Cd = Cd*(1-As) Ad = Ad*(1-As)
public static final AlphaComposite Clear
public static final AlphaComposite Src
public static final AlphaComposite SrcOver
public static final AlphaComposite DstOver
public static final AlphaComposite SrcIn
public static final AlphaComposite DstIn
public static final AlphaComposite SrcOut
public static final AlphaComposite DstOut
Method Detail |
public static AlphaComposite getInstance(int rule)
rule
- Rule for the composition.
public static AlphaComposite getInstance(int rule, float alpha)
rule
- Rule for the composition.
alpha
- The constant alpha to be multiplied with the alpha of
the source. Alpha must be a floating point number in the inclusive
range [0.0, 1.0].
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel)
srcColorModel
- The ColorModel of the source.
dstColorModel
- The ColorModel of the destination.
public float getAlpha()
public int getRule()
public boolean equals(Object obj)
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |