public final class

CompositeType

extends Object
java.lang.Object
   ↳ sun.java2d.loops.CompositeType

Class Overview

A CompositeType object provides a chained description of a type of algorithm for color compositing. The object will provide a single String constant descriptor which is one way of describing a particular compositing algorithm as well as a pointer to another CompositeType which describes a more general algorithm for achieving the same result.

A description of a more specific algorithm is considered a "subtype" and a description of a more general algorithm is considered a "supertype". Thus, the deriveSubType method provides a way to create a new CompositeType that is related to but more specific than an existing CompositeType and the getSuperType method provides a way to ask a given CompositeType for a more general algorithm to achieve the same result.

Note that you cannot construct a brand new root for a chain since the constructor is private. Every chain of types must at some point derive from the Any node provided here using the deriveSubType() method. The presence of this common Any node on every chain ensures that all chains end with the DESC_ANY descriptor so that a suitable General GraphicsPrimitive object can be obtained for the indicated algorithm if all of the more specific searches fail.

Summary

Constants
String DESC_ALPHA_XOR
String DESC_ANY algorithm is a general algorithm that uses a CompositeContext to do the rendering.
String DESC_ANY_ALPHA constant used to describe an algorithm that implements all 8 of the Porter-Duff rules in one Primitive.
String DESC_CLEAR constants used to describe the various AlphaComposite algorithms.
String DESC_DST
String DESC_DST_ATOP
String DESC_DST_IN
String DESC_DST_OUT
String DESC_DST_OVER
String DESC_SRC
String DESC_SRC_ATOP
String DESC_SRC_IN
String DESC_SRC_NO_EA constants used to describe the two common cases of AlphaComposite algorithms that are simpler if there is not extraAlpha.
String DESC_SRC_OUT
String DESC_SRC_OVER
String DESC_SRC_OVER_NO_EA
String DESC_XOR constant used to describe the Graphics.setXORMode() algorithm
Fields
public static final CompositeType AlphaXor
public static final CompositeType Any The root CompositeType object for all chains of algorithm descriptions.
public static final CompositeType AnyAlpha
public static final CompositeType Clear
public static final CompositeType Dst
public static final CompositeType DstAtop
public static final CompositeType DstIn
public static final CompositeType DstOut
public static final CompositeType DstOver
public static final CompositeType General
public static final CompositeType Src
public static final CompositeType SrcAtop
public static final CompositeType SrcIn
public static final CompositeType SrcNoEa
public static final CompositeType SrcOut
public static final CompositeType SrcOver
public static final CompositeType SrcOverNoEa
public static final CompositeType Xor
Public Methods
CompositeType deriveSubType(String desc)
Return a new CompositeType object which uses this object as its more general "supertype" descriptor.
boolean equals(Object o)
Indicates whether some other object is "equal to" this one.
static CompositeType forAlphaComposite(AlphaComposite ac)
Return a CompositeType object for the specified AlphaComposite rule.
String getDescriptor()
CompositeType getSuperType()
int getUniqueID()
int hashCode()
Returns a hash code value for the object.
boolean isDerivedFrom(CompositeType other)
String toString()
Returns a string representation of the object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String DESC_ALPHA_XOR

Constant Value: "Porter-Duff Xor"

public static final String DESC_ANY

algorithm is a general algorithm that uses a CompositeContext to do the rendering.

Constant Value: "Any CompositeContext"

public static final String DESC_ANY_ALPHA

constant used to describe an algorithm that implements all 8 of the Porter-Duff rules in one Primitive.

Constant Value: "Any AlphaComposite Rule"

public static final String DESC_CLEAR

constants used to describe the various AlphaComposite algorithms.

Constant Value: "Porter-Duff Clear"

public static final String DESC_DST

Constant Value: "Porter-Duff Dst"

public static final String DESC_DST_ATOP

Constant Value: "Porter-Duff Dst Atop Src"

public static final String DESC_DST_IN

Constant Value: "Porter-Duff Dst In Src"

public static final String DESC_DST_OUT

Constant Value: "Porter-Duff Dst HeldOutBy Src"

public static final String DESC_DST_OVER

Constant Value: "Porter-Duff Dst Over Src"

public static final String DESC_SRC

Constant Value: "Porter-Duff Src"

public static final String DESC_SRC_ATOP

Constant Value: "Porter-Duff Src Atop Dst"

public static final String DESC_SRC_IN

Constant Value: "Porter-Duff Src In Dst"

public static final String DESC_SRC_NO_EA

constants used to describe the two common cases of AlphaComposite algorithms that are simpler if there is not extraAlpha.

Constant Value: "Porter-Duff Src, No Extra Alpha"

public static final String DESC_SRC_OUT

Constant Value: "Porter-Duff Src HeldOutBy Dst"

public static final String DESC_SRC_OVER

Constant Value: "Porter-Duff Src Over Dst"

public static final String DESC_SRC_OVER_NO_EA

Constant Value: "Porter-Duff SrcOverDst, No Extra Alpha"

public static final String DESC_XOR

constant used to describe the Graphics.setXORMode() algorithm

Constant Value: "XOR mode"

Fields

public static final CompositeType AlphaXor

public static final CompositeType Any

The root CompositeType object for all chains of algorithm descriptions.

public static final CompositeType AnyAlpha

public static final CompositeType Clear

public static final CompositeType Dst

public static final CompositeType DstAtop

public static final CompositeType DstIn

public static final CompositeType DstOut

public static final CompositeType DstOver

public static final CompositeType General

public static final CompositeType Src

public static final CompositeType SrcAtop

public static final CompositeType SrcIn

public static final CompositeType SrcNoEa

public static final CompositeType SrcOut

public static final CompositeType SrcOver

public static final CompositeType SrcOverNoEa

public static final CompositeType Xor

Public Methods

public CompositeType deriveSubType (String desc)

Return a new CompositeType object which uses this object as its more general "supertype" descriptor. If no operation can be found that implements the algorithm described more exactly by desc, then this object will define the more general compositing algorithm that can be used instead.

public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
o the reference object with which to compare.
Returns
  • true if this object is the same as the obj argument; false otherwise.

public static CompositeType forAlphaComposite (AlphaComposite ac)

Return a CompositeType object for the specified AlphaComposite rule.

public String getDescriptor ()

public CompositeType getSuperType ()

public int getUniqueID ()

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Returns
  • a hash code value for this object.

public boolean isDerivedFrom (CompositeType other)

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a string representation of the object.