FileDocCategorySizeDatePackage
RenderContext.javaAPI DocJava SE 5 API9035Fri Aug 26 14:56:56 BST 2005java.awt.image.renderable

RenderContext

public class RenderContext extends Object implements Cloneable
A RenderContext encapsulates the information needed to produce a specific rendering from a RenderableImage. It contains the area to be rendered specified in rendering-independent terms, the resolution at which the rendering is to be performed, and hints used to control the rendering process.

Users create RenderContexts and pass them to the RenderableImage via the createRendering method. Most of the methods of RenderContexts are not meant to be used directly by applications, but by the RenderableImage and operator classes to which it is passed.

The AffineTransform parameter passed into and out of this class are cloned. The RenderingHints and Shape parameters are not necessarily cloneable and are therefore only reference copied. Altering RenderingHints or Shape instances that are in use by instances of RenderContext may have undesired side effects.

Fields Summary
RenderingHints
hints
Table of hints. May be null.
AffineTransform
usr2dev
Transform to convert user coordinates to device coordinates.
Shape
aoi
The area of interest. May be null.
Constructors Summary
public RenderContext(AffineTransform usr2dev, Shape aoi, RenderingHints hints)
Constructs a RenderContext with a given transform. The area of interest is supplied as a Shape, and the rendering hints are supplied as a RenderingHints object.

param
usr2dev an AffineTransform.
param
aoi a Shape representing the area of interest.
param
hints a RenderingHints object containing rendering hints.

        this.hints = hints;
        this.aoi = aoi;
        this.usr2dev = (AffineTransform)usr2dev.clone();
    
public RenderContext(AffineTransform usr2dev)
Constructs a RenderContext with a given transform. The area of interest is taken to be the entire renderable area. No rendering hints are used.

param
usr2dev an AffineTransform.

        this(usr2dev, null, null);
    
public RenderContext(AffineTransform usr2dev, RenderingHints hints)
Constructs a RenderContext with a given transform and rendering hints. The area of interest is taken to be the entire renderable area.

param
usr2dev an AffineTransform.
param
hints a RenderingHints object containing rendering hints.

        this(usr2dev, null, hints);
    
public RenderContext(AffineTransform usr2dev, Shape aoi)
Constructs a RenderContext with a given transform and area of interest. The area of interest is supplied as a Shape. No rendering hints are used.

param
usr2dev an AffineTransform.
param
aoi a Shape representing the area of interest.

        this(usr2dev, aoi, null);
    
Methods Summary
public java.lang.Objectclone()
Makes a copy of a RenderContext. The area of interest is copied by reference. The usr2dev AffineTransform and hints are cloned, while the area of interest is copied by reference.

return
the new cloned RenderContext.

        RenderContext newRenderContext = new RenderContext(usr2dev,
                                                           aoi, hints);
        return newRenderContext;
    
public voidconcatenateTransform(java.awt.geom.AffineTransform modTransform)
Modifies the current user-to-device transform by appending another transform. In matrix notation the operation is:
[this] = [this] x [modTransform]

param
modTransform the AffineTransform to append to the current usr2dev transform.

        this.concetenateTransform(modTransform);                
    
public voidconcetenateTransform(java.awt.geom.AffineTransform modTransform)
Modifies the current user-to-device transform by appending another transform. In matrix notation the operation is:
[this] = [this] x [modTransform]
This method does the same thing as the concatenateTransform method. It is here for backward compatibility with previous releases which misspelled the method name.

param
modTransform the AffineTransform to append to the current usr2dev transform.
deprecated
replaced by concatenateTransform(AffineTransform).

        usr2dev.concatenate(modTransform);                
    
public java.awt.ShapegetAreaOfInterest()
Gets the ares of interest currently contained in the RenderContext.

return
a reference to the area of interest of the RenderContext, or null if none is specified.
see
#setAreaOfInterest(Shape)

        return aoi;
    
public java.awt.RenderingHintsgetRenderingHints()
Gets the rendering hints of this RenderContext.

return
a RenderingHints object that represents the rendering hints of this RenderContext.
see
#setRenderingHints(RenderingHints)

        return hints;
    
public java.awt.geom.AffineTransformgetTransform()
Gets the current user-to-device AffineTransform.

return
a reference to the current AffineTransform.
see
#setTransform(AffineTransform)

        return (AffineTransform)usr2dev.clone();
    
public voidpreConcatenateTransform(java.awt.geom.AffineTransform modTransform)
Modifies the current user-to-device transform by prepending another transform. In matrix notation the operation is:
[this] = [modTransform] x [this]

param
modTransform the AffineTransform to prepend to the current usr2dev transform.

        this.preConcetenateTransform(modTransform);                
    
public voidpreConcetenateTransform(java.awt.geom.AffineTransform modTransform)
Modifies the current user-to-device transform by prepending another transform. In matrix notation the operation is:
[this] = [modTransform] x [this]
This method does the same thing as the preConcatenateTransform method. It is here for backward compatibility with previous releases which misspelled the method name.

param
modTransform the AffineTransform to prepend to the current usr2dev transform.
deprecated
replaced by preConcatenateTransform(AffineTransform).

        usr2dev.preConcatenate(modTransform);                
    
public voidsetAreaOfInterest(java.awt.Shape newAoi)
Sets the current area of interest. The old area is discarded.

param
newAoi The new area of interest.
see
#getAreaOfInterest

        aoi = newAoi;
    
public voidsetRenderingHints(java.awt.RenderingHints hints)
Sets the rendering hints of this RenderContext.

param
hints a RenderingHints object that represents the rendering hints to assign to this RenderContext.
see
#getRenderingHints

        this.hints = hints;
    
public voidsetTransform(java.awt.geom.AffineTransform newTransform)
Sets the current user-to-device AffineTransform contained in the RenderContext to a given transform.

param
newTransform the new AffineTransform.
see
#getTransform

        usr2dev = (AffineTransform)newTransform.clone();