All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Interface java.awt.Composite

public interface Composite
This interface, together with CompositeContext, defines the methods to compose a draw primitive with the underlying graphics area. The Composite is set in the Graphics2D and thereafter, whenever a shape, text, or an image is drawn, the Composite will combine the source with the colors that have already been drawn, according to pre-defined rules. The classes implementing this interface will provide the rules and a method to create the context for a particular operation. CompositeContext is an environment used by the compositing operation that a Graphics2D object must create prior to the start of the operation. CompositeContext contains various private information and resources needed for a compositing operation. When the CompositeContext is no longer needed it will be disposed by the Graphics2D object to reclaim resources allocated for the operation.

Instances of classes implementing Composite must be immutable (i.e. read-only) because the Graphics2D does not clone these objects when they are set as an attribute with the setComposite method or when the Graphics2D object is itself cloned. This is to avoid undefined behavior of Graphics2D rendering which would result if the Composite object were modified after being set in the Graphics2D state.

See Also:
AlphaComposite, CompositeContext, setComposite

Method Index

 o createContext(ColorModel, ColorModel)
Create a context for the compositing operation.

Methods

 o createContext
public abstract CompositeContext createContext(ColorModel srcColorModel,
                                               ColorModel dstColorModel)
Create a context for the compositing operation. The context contains state that is used to perform the compositing operation. In a multi-threaded environment several contexts may exist simultaneously for a single Composite object.

Parameters:
srcColorModel - The ColorModel of the source.
dstColorModel - The ColorModel of the destination.
Returns:
The CompositeContext object to perform the compositing operation.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature