public final class DVBAlphaComposite extends Object
DVBAlphaComposite
class implements the basic alpha
compositing rules for combining source and destination pixels to achieve
blending and transparency effects with graphics, images and video.
The rules implemented by this class are a subset of the Porter-Duff
rules described in
T. Porter and T. Duff, "Compositing Digital Images", SIGGRAPH 84,
253-259.
If any input does not have an alpha channel, an alpha value of 1,0, which is 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:
cn = (As*Ar)*Cs*Fs + Ad*Cd*Fd An = (As*Ar)*Fs + Ad*Fd Cn = cn/Anwhere Fs and Fd are specified by each rule.
The alpha resulting from 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.
AlphaComposite
Modifier and Type | Field and Description |
---|---|
static DVBAlphaComposite |
Clear
DVBAlphaComposite object that implements the opaque CLEAR rule
with an alpha (Ar) of 1,0f. |
static int |
CLEAR
Porter-Duff Clear rule.
|
static int |
DST_IN
Porter-Duff Destination In Source rule.
|
static int |
DST_OUT
Porter-Duff Destination Held Out By Source rule.
|
static int |
DST_OVER
Porter-Duff Destination Over Source rule.
|
static DVBAlphaComposite |
DstIn
DVBAlphaComposite object that implements the opaque DST_IN rule
with an alpha (Ar) of 1,0f. |
static DVBAlphaComposite |
DstOut
DVBAlphaComposite object that implements the opaque DST_OUT rule
with an alpha (Ar) of 1,0f. |
static DVBAlphaComposite |
DstOver
DVBAlphaComposite object that implements the opaque DST_OVER rule
with an alpha (Ar) of 1,0f. |
static DVBAlphaComposite |
Src
DVBAlphaComposite object that implements the opaque SRC rule
with an alpha (Ar) of 1,0f. |
static int |
SRC
Porter-Duff Source rule.
|
static int |
SRC_IN
Porter-Duff Source In Destination rule.
|
static int |
SRC_OUT
Porter-Duff Source Held Out By Destination rule.
|
static int |
SRC_OVER
Porter-Duff Source Over Destination rule.
|
static DVBAlphaComposite |
SrcIn
DVBAlphaComposite object that implements the opaque SRC_IN rule
with an alpha (Ar) of 1,0f. |
static DVBAlphaComposite |
SrcOut
DVBAlphaComposite object that implements the opaque SRC_OUT rule
with an alpha (Ar) of 1,0f. |
static DVBAlphaComposite |
SrcOver
DVBAlphaComposite object that implements the opaque SRC_OVER rule
with an alpha (Ar) of 1,0f. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Tests if the specified
Object is equal to this
DVBAlphaComposite object. |
float |
getAlpha()
Returns the alpha value of this
DVBAlphaComposite . |
static DVBAlphaComposite |
getInstance(int rule)
Creates an
DVBAlphaComposite object with the specified rule. |
static DVBAlphaComposite |
getInstance(int rule,
float alpha)
Creates an
DVBAlphaComposite object with the specified rule and
the constant alpha (Ar) to multiply with the alpha of the source (As). |
int |
getRule()
Returns the compositing rule of this
DVBAlphaComposite . |
public static final int CLEAR
Fs = 0 and Fd = 0, thus:
cn = 0 An = 0 Cn = 0
Note that this operation is a fast drawing operation This operation is the same as using a source with alpha= 0 and the SRC rule
public static final int SRC
Fs = 1 and Fd = 0, thus:
cn = (As*Ar)*Cs An = As*Ar Cn = Cs
Note that this is a fast drawing routine
public static final int SRC_OVER
Fs = 1 and Fd = (1-(As*Ar)), thus:
cn = (As*Ar)*Cs + Ad*Cd*(1-(As*Ar)) An = (As*Ar) + Ad*(1-(As*Ar))
Note that this can be a very slow drawing operation
public static final int DST_OVER
Fs = (1-Ad) and Fd = 1, thus:
cn = (As*Ar)*Cs*(1-Ad) + Ad*Cd An = (As*Ar)*(1-Ad) + Ad
Note that this can be a very slow drawing operation
public static final int SRC_IN
Fs = Ad and Fd = 0, thus:
cn = (As*Ar)*Cs*Ad An = (As*Ar)*Ad Cn = Cs
Note that this operation is faster than e.g. SRC_OVER but slower than SRC
public static final int DST_IN
Fs = 0 and Fd = (As*Ar), thus:
cn = Ad*Cd*(As*Ar) An = Ad*(As*Ar) Cn = Cd
Note that this operation is faster than e.g. SRC_OVER but slower than SRC
public static final int SRC_OUT
Fs = (1-Ad) and Fd = 0, thus:
cn = (As*Ar)*Cs*(1-Ad) An = (As*Ar)*(1-Ad) Cn = Cs
Note that this operation is faster than e.g. SRC_OVER but slower than SRC
public static final int DST_OUT
Fs = 0 and Fd = (1-(As*Ar)), thus:
cn = Ad*Cd*(1-(As*Ar)) An = Ad*(1-(As*Ar)) Cn = Cd
Note that this operation is faster than e.g. SRC_OVER but slower than SRC
public static final DVBAlphaComposite Clear
DVBAlphaComposite
object that implements the opaque CLEAR rule
with an alpha (Ar) of 1,0f.CLEAR
public static final DVBAlphaComposite Src
DVBAlphaComposite
object that implements the opaque SRC rule
with an alpha (Ar) of 1,0f.SRC
public static final DVBAlphaComposite SrcOver
DVBAlphaComposite
object that implements the opaque SRC_OVER rule
with an alpha (Ar) of 1,0f.SRC_OVER
public static final DVBAlphaComposite DstOver
DVBAlphaComposite
object that implements the opaque DST_OVER rule
with an alpha (Ar) of 1,0f.DST_OVER
public static final DVBAlphaComposite SrcIn
DVBAlphaComposite
object that implements the opaque SRC_IN rule
with an alpha (Ar) of 1,0f.SRC_IN
public static final DVBAlphaComposite DstIn
DVBAlphaComposite
object that implements the opaque DST_IN rule
with an alpha (Ar) of 1,0f.DST_IN
public static final DVBAlphaComposite SrcOut
DVBAlphaComposite
object that implements the opaque SRC_OUT rule
with an alpha (Ar) of 1,0f.SRC_OUT
public static final DVBAlphaComposite DstOut
DVBAlphaComposite
object that implements the opaque DST_OUT rule
with an alpha (Ar) of 1,0f.DST_OUT
public boolean equals(Object obj)
Object
is equal to this
DVBAlphaComposite
object.equals
in class Object
obj
- the Object
to test for equalitytrue
if obj
is a DVBAlphaComposite
and has the same values for rule and alpha as this object.
Otherwise false
shall be returned.Object.hashCode()
,
Hashtable
public float getAlpha()
DVBAlphaComposite
. If this
DVBAlphaComposite
does not have an alpha value, 1,0 is returned.DVBAlphaComposite
.public static DVBAlphaComposite getInstance(int rule)
DVBAlphaComposite
object with the specified rule.
The value for alpha shall be 1,0f.rule
- the compositing ruleDVBAlphaComposite
object with the specified rule.public static DVBAlphaComposite getInstance(int rule, float alpha)
DVBAlphaComposite
object with the specified rule and
the constant alpha (Ar) to multiply with the alpha of the source (As).
The source is multiplied with the specified alpha before being composited
with the destination.rule
- the compositing rulealpha
- the constant alpha (Ar) to be multiplied with the alpha of
the source (As). alpha
must be a floating point number in the
inclusive range [0,0, 1,0].DVBAlphaComposite
object with the specified rule and
the constant alpha to multiply with the alpha of the source.public int getRule()
DVBAlphaComposite
.DVBAlphaComposite
.Copyright © 2013 CableLabs. All rights reserved.