java.awt
Class AlphaComposite

java.lang.Object
  |
  +--java.awt.AlphaComposite
All Implemented Interfaces:
Composite

public final class AlphaComposite
extends Object
implements Composite

Safe:


Field Summary
static AlphaComposite Clear
          Suppressed: AlphaComposite object that implements the opaque CLEAR rule with an alpha of 1.0f.
static int CLEAR
          Enabled: Porter-Duff Clear rule.
static AlphaComposite Dst
          Suppressed: AlphaComposite object that implements the opaque DST rule with an alpha of 1.0f.
static int DST
          Enabled: Porter-Duff Destination rule.
static int DST_ATOP
          Enabled: Porter-Duff Destination Atop Source rule.
static int DST_IN
          Enabled: Porter-Duff Destination In Source rule.
static int DST_OUT
          Enabled: Porter-Duff Destination Held Out By Source rule.
static int DST_OVER
          Enabled: Porter-Duff Destination Over Source rule.
static AlphaComposite DstAtop
          Suppressed: AlphaComposite object that implements the opaque DST_ATOP rule with an alpha of 1.0f.
static AlphaComposite DstIn
          Suppressed: AlphaComposite object that implements the opaque DST_IN rule with an alpha of 1.0f.
static AlphaComposite DstOut
          Suppressed: AlphaComposite object that implements the opaque DST_OUT rule with an alpha of 1.0f.
static AlphaComposite DstOver
          Suppressed: AlphaComposite object that implements the opaque DST_OVER rule with an alpha of 1.0f.
(package private)  float extraAlpha
           
private static int MAX_RULE
           
private static int MIN_RULE
           
(package private)  int rule
           
static AlphaComposite Src
          Suppressed: AlphaComposite object that implements the opaque SRC rule with an alpha of 1.0f.
static int SRC
          Enabled: Porter-Duff Source rule.
static int SRC_ATOP
          Enabled: Porter-Duff Source Atop Destination rule.
static int SRC_IN
          Enabled: Porter-Duff Source In Destination rule.
static int SRC_OUT
          Enabled: Porter-Duff Source Held Out By Destination rule.
static int SRC_OVER
          Enabled: Porter-Duff Source Over Destination rule.
static AlphaComposite SrcAtop
          Suppressed: AlphaComposite object that implements the opaque SRC_ATOP rule with an alpha of 1.0f.
static AlphaComposite SrcIn
          Suppressed: AlphaComposite object that implements the opaque SRC_IN rule with an alpha of 1.0f.
static AlphaComposite SrcOut
          Suppressed: AlphaComposite object that implements the opaque SRC_OUT rule with an alpha of 1.0f.
static AlphaComposite SrcOver
          Suppressed: AlphaComposite object that implements the opaque SRC_OVER rule with an alpha of 1.0f.
static AlphaComposite Xor
          Suppressed: AlphaComposite object that implements the opaque XOR rule with an alpha of 1.0f.
static int XOR
          Enabled: Porter-Duff Source Xor Destination rule.
 
Constructor Summary
private AlphaComposite(int rule)
           
private AlphaComposite(int rule, float alpha)
           
 
Method Summary
 CompositeContext createContext(java.awt.image.ColorModel srcColorModel, java.awt.image.ColorModel dstColorModel, RenderingHints hints)
          Enabled: Creates a context for the compositing operation.
 boolean equals(Object obj)
          Suppressed: Determines whether the specified object is equal to this AlphaComposite.
 float getAlpha()
          Enabled: Returns the alpha value of this AlphaComposite.
static AlphaComposite getInstance(int rule)
          Enabled: Creates an AlphaComposite object with the specified rule.
static AlphaComposite getInstance(int rule, float alpha)
          Enabled: Creates an AlphaComposite object with the specified rule and the constant alpha to multiply with the alpha of the source.
 int getRule()
          Enabled: Returns the compositing rule of this AlphaComposite.
 int hashCode()
          Suppressed: Returns the hashcode for this composite.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEAR

public static final int CLEAR
Enabled: Porter-Duff Clear rule. Both the color and the alpha of the destination are cleared. Neither the source nor the destination is used as input.

Fs = 0 and Fd = 0, thus:

 	Cd = 0
 	Ad = 0


SRC

public static final int SRC
Enabled: Porter-Duff Source rule. The source is copied to the destination. The destination is not used as input.

Fs = 1 and Fd = 0, thus:

 	Cd = Cs
 	Ad = As


DST

public static final int DST
Enabled: Porter-Duff Destination rule. The destination is left untouched.

Fs = 0 and Fd = 1, thus:

 	Cd = Cd
 	Ad = Ad

Since:
1.4

SRC_OVER

public static final int SRC_OVER
Enabled: Porter-Duff Source Over Destination rule. The source is composited over the destination.

Fs = 1 and Fd = (1-As), thus:

 	Cd = Cs + Cd*(1-As)
 	Ad = As + Ad*(1-As)


DST_OVER

public static final int DST_OVER
Enabled: Porter-Duff Destination Over Source rule. The destination is composited over the source and the result replaces the destination.

Fs = (1-Ad) and Fd = 1, thus:

 	Cd = Cs*(1-Ad) + Cd
 	Ad = As*(1-Ad) + Ad


SRC_IN

public static final int SRC_IN
Enabled: Porter-Duff Source In Destination rule. The part of the source lying inside of the destination replaces the destination.

Fs = Ad and Fd = 0, thus:

 	Cd = Cs*Ad
 	Ad = As*Ad


DST_IN

public static final int DST_IN
Enabled: Porter-Duff Destination In Source rule. The part of the destination lying inside of the source replaces the destination.

Fs = 0 and Fd = As, thus:

 	Cd = Cd*As
 	Ad = Ad*As


SRC_OUT

public static final int SRC_OUT
Enabled: Porter-Duff Source Held Out By Destination rule. The part of the source lying outside of the destination replaces the destination.

Fs = (1-Ad) and Fd = 0, thus:

 	Cd = Cs*(1-Ad)
 	Ad = As*(1-Ad)


DST_OUT

public static final int DST_OUT
Enabled: Porter-Duff Destination Held Out By Source rule. The part of the destination lying outside of the source replaces the destination.

Fs = 0 and Fd = (1-As), thus:

 	Cd = Cd*(1-As)
 	Ad = Ad*(1-As)


SRC_ATOP

public static final int SRC_ATOP
Enabled: Porter-Duff Source Atop Destination rule. The part of the source lying inside of the destination is composited onto the destination.

Fs = Ad and Fd = (1-As), thus:

 	Cd = Cs*Ad + Cd*(1-As)
 	Ad = As*Ad + Ad*(1-As) = Ad

Since:
1.4

DST_ATOP

public static final int DST_ATOP
Enabled: Porter-Duff Destination Atop Source rule. The part of the destination lying inside of the source is composited over the source and replaces the destination.

Fs = (1-Ad) and Fd = As, thus:

 	Cd = Cs*(1-Ad) + Cd*As
 	Ad = As*(1-Ad) + Ad*As = As

Since:
1.4

XOR

public static final int XOR
Enabled: Porter-Duff Source Xor Destination rule. The part of the source that lies outside of the destination is combined with the part of the destination that lies outside of the source.

Fs = (1-Ad) and Fd = (1-As), thus:

 	Cd = Cs*(1-Ad) + Cd*(1-As)
 	Ad = As*(1-Ad) + Ad*(1-As)

Since:
1.4

Clear

public static final AlphaComposite Clear
Suppressed: AlphaComposite object that implements the opaque CLEAR rule with an alpha of 1.0f.

See Also:
CLEAR

Src

public static final AlphaComposite Src
Suppressed: AlphaComposite object that implements the opaque SRC rule with an alpha of 1.0f.

See Also:
SRC

Dst

public static final AlphaComposite Dst
Suppressed: AlphaComposite object that implements the opaque DST rule with an alpha of 1.0f.

Since:
1.4
See Also:
DST

SrcOver

public static final AlphaComposite SrcOver
Suppressed: AlphaComposite object that implements the opaque SRC_OVER rule with an alpha of 1.0f.

See Also:
SRC_OVER

DstOver

public static final AlphaComposite DstOver
Suppressed: AlphaComposite object that implements the opaque DST_OVER rule with an alpha of 1.0f.

See Also:
DST_OVER

SrcIn

public static final AlphaComposite SrcIn
Suppressed: AlphaComposite object that implements the opaque SRC_IN rule with an alpha of 1.0f.

See Also:
SRC_IN

DstIn

public static final AlphaComposite DstIn
Suppressed: AlphaComposite object that implements the opaque DST_IN rule with an alpha of 1.0f.

See Also:
DST_IN

SrcOut

public static final AlphaComposite SrcOut
Suppressed: AlphaComposite object that implements the opaque SRC_OUT rule with an alpha of 1.0f.

See Also:
SRC_OUT

DstOut

public static final AlphaComposite DstOut
Suppressed: AlphaComposite object that implements the opaque DST_OUT rule with an alpha of 1.0f.

See Also:
DST_OUT

SrcAtop

public static final AlphaComposite SrcAtop
Suppressed: AlphaComposite object that implements the opaque SRC_ATOP rule with an alpha of 1.0f.

Since:
1.4
See Also:
SRC_ATOP

DstAtop

public static final AlphaComposite DstAtop
Suppressed: AlphaComposite object that implements the opaque DST_ATOP rule with an alpha of 1.0f.

Since:
1.4
See Also:
DST_ATOP

Xor

public static final AlphaComposite Xor
Suppressed: AlphaComposite object that implements the opaque XOR rule with an alpha of 1.0f.

Since:
1.4
See Also:
XOR

MIN_RULE

private static final int MIN_RULE

MAX_RULE

private static final int MAX_RULE

extraAlpha

float extraAlpha

rule

int rule
Constructor Detail

AlphaComposite

private AlphaComposite(int rule)

AlphaComposite

private AlphaComposite(int rule,
                       float alpha)
Method Detail

getInstance

public static AlphaComposite getInstance(int rule)
Enabled: Creates an AlphaComposite object with the specified rule.

Parameters:
rule - the compositing rule
Throws:
IllegalArgumentException - if rule is not one of the following: CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, SRC_ATOP, DST_ATOP, or XOR

getInstance

public static AlphaComposite getInstance(int rule,
                                         float alpha)
Enabled: Creates an AlphaComposite object with the specified rule and the constant alpha to multiply with the alpha of the source. The source is multiplied with the specified alpha before being composited with the destination.

Parameters:
rule - the compositing rule
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].
Throws:
IllegalArgumentException - if alpha is less than 0.0 or greater than 1.0, or if rule is not one of the following: CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, SRC_ATOP, DST_ATOP, or XOR

createContext

public CompositeContext createContext(java.awt.image.ColorModel srcColorModel,
                                      java.awt.image.ColorModel dstColorModel,
                                      RenderingHints hints)
Enabled: Creates a context for the compositing operation. The context contains state that is used in performing the compositing operation.

Specified by:
createContext in interface Composite
Parameters:
srcColorModel - the ColorModel of the source
dstColorModel - the ColorModel of the destination
hints - the hint that the context object uses to choose between rendering alternatives
Returns:
the CompositeContext object to be used to perform compositing operations.

getAlpha

public float getAlpha()
Enabled: Returns the alpha value of this AlphaComposite. If this AlphaComposite does not have an alpha value, 1.0 is returned.

Returns:
the alpha value of this AlphaComposite.

getRule

public int getRule()
Enabled: Returns the compositing rule of this AlphaComposite.

Returns:
the compositing rule of this AlphaComposite.

hashCode

public int hashCode()
Suppressed: Returns the hashcode for this composite.

Overrides:
hashCode in class Object
Returns:
a hash code for this composite.
See Also:
java.lang.Object#equals(java.lang.Object), java.util.Hashtable

equals

public boolean equals(Object obj)
Suppressed: Determines whether the specified object is equal to this AlphaComposite.

The result is true if and only if the argument is not null and is an AlphaComposite object that has the same compositing rule and alpha value as this object.

Overrides:
equals in class Object
Parameters:
obj - the Object to test for equality
Returns:
true if obj equals this AlphaComposite; false otherwise.
See Also:
Object.hashCode(), java.util.Hashtable


comments?