java.awt.image.renderable

Class RenderContext

Implemented Interfaces:
Cloneable

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.

Constructor Summary

RenderContext(AffineTransform usr2dev)
Constructs a RenderContext with a given transform.
RenderContext(AffineTransform usr2dev, RenderingHints hints)
Constructs a RenderContext with a given transform and rendering hints.
RenderContext(AffineTransform usr2dev, Shape aoi)
Constructs a RenderContext with a given transform and area of interest.
RenderContext(AffineTransform usr2dev, Shape aoi, RenderingHints hints)
Constructs a RenderContext with a given transform.

Method Summary

Object
clone()
Makes a copy of a RenderContext.
void
concatenateTransform(AffineTransform modTransform)
Modifies the current user-to-device transform by appending another transform.
Shape
getAreaOfInterest()
Gets the ares of interest currently contained in the RenderContext.
RenderingHints
getRenderingHints()
Gets the rendering hints of this RenderContext.
AffineTransform
getTransform()
Gets the current user-to-device AffineTransform.
void
preConcatenateTransform(AffineTransform modTransform)
Modifies the current user-to-device transform by prepending another transform.
void
setAreaOfInterest(Shape newAoi)
Sets the current area of interest.
void
setRenderingHints(RenderingHints hints)
Sets the rendering hints of this RenderContext.
void
setTransform(AffineTransform newTransform)
Sets the current user-to-device AffineTransform contained in the RenderContext to a given transform.
@Deprecated
void concetenateTransform(AffineTransform modTransform)
Deprecated. replaced by concatenateTransform(AffineTransform).
@Deprecated
void preConcetenateTransform(AffineTransform modTransform)
Deprecated. replaced by preConcatenateTransform(AffineTransform).

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

RenderContext

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.
Parameters:
usr2dev - an AffineTransform.
Usages and Demos :

View More Examples of RenderContext(AffineTransform usr2dev)
   1:         RenderedImage ri = background.createRendering
   2:             (new RenderContext(renderContext.getTransform(), r2d, 
   3:                                renderContext.getRenderingHints()));
   4:         return ri;
   5:     }

View Full Code Here
   1:   {
   2:     drawRenderedImage (image.createRendering (new RenderContext(xform)), xform);
   3:   }
   4:   
   5:   public boolean drawImage(Image img, 

View Full Code Here
   1:             }
   2:             return new RenderContext(matrix.toAffineTransform2D(), hints);
   3:         }
   4: 
   5:         public int getNumElements() {

View Full Code Here
   1:             }
   2:             return new RenderContext(matrix.toAffineTransform2D(), hints);
   3:         }
   4: 
   5:         public int getNumElements() {

View Full Code Here

RenderContext

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.
Parameters:
usr2dev - an AffineTransform.
hints - a RenderingHints object containing rendering hints.
Usages and Demos :

View More Examples of RenderContext(AffineTransform usr2dev,RenderingHints hints)
   1:         AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
   2:         rc = new RenderContext(at, rc.getRenderingHints());
   3:         RenderedImage histRI = getSource().createRendering(rc);
   4: 
   5:         histo = new HistogramRed(convertSourceCS(histRI)).getHistogram();

View Full Code Here
   1:         AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
   2:         RenderContext rc = new RenderContext(at, hints);
   3: 
   4:         float dX = (getWidth()*scale)-w;
   5:         float dY = (getHeight()*scale)-h;

View Full Code Here
   1:         RenderedImage ri = filter.createRendering
   2:             (new RenderContext(at, g2d.getClip(), g2d.getRenderingHints()));
   3: 
   4:         if (ri == null)
   5:             return;

View Full Code Here

RenderContext

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.
Parameters:
usr2dev - an AffineTransform.
aoi - a Shape representing the area of interest.
Usages and Demos :

View More Examples of RenderContext(AffineTransform usr2dev,Shape aoi)
   1:         AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
   2:         rc = new RenderContext(at, rc.getRenderingHints());
   3:         RenderedImage histRI = getSource().createRendering(rc);
   4: 
   5:         histo = new HistogramRed(convertSourceCS(histRI)).getHistogram();

View Full Code Here
   1:         AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
   2:         RenderContext rc = new RenderContext(at, hints);
   3: 
   4:         float dX = (getWidth()*scale)-w;
   5:         float dY = (getHeight()*scale)-h;

View Full Code Here
   1:         RenderedImage ri = filter.createRendering
   2:             (new RenderContext(at, g2d.getClip(), g2d.getRenderingHints()));
   3: 
   4:         if (ri == null)
   5:             return;

View Full Code Here

RenderContext

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.
Parameters:
usr2dev - an AffineTransform.
aoi - a Shape representing the area of interest.
hints - a RenderingHints object containing rendering hints.
Usages and Demos :

View More Examples of RenderContext(AffineTransform usr2dev,Shape aoi,RenderingHints hints)
   1:         RenderedImage ri;
   2:         ri = getSource().createRendering(new RenderContext(at, aoi, rh));
   3:         if (ri == null)
   4:             return null;

View Full Code Here
   1:         RenderedImage ri;
   2:         ri = getSource().createRendering(new RenderContext(at, aoi, rh));
   3:         
   4:         if(ri == null){
   5:             return null;

View Full Code Here
   1:         
   2:         RenderContext rc = new RenderContext(curTxf, null, null);
   3:         RenderedImage img = f.createRendering(rc);
   4: 
   5:         int w = img.getWidth();

View Full Code Here
   1: 
   2:         return getSource().createRendering(new RenderContext(at, aoi, rh));
   3:     }
   4: 
   5:     public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) {

View Full Code Here
   1:         RenderedImage ri;
   2:         ri = getSource().createRendering(new RenderContext(usr2dev, rect, rh));
   3: 
   4:         CachableRed cr, clipCr;
   5:         cr = RenderedImageCachableRed.wrap(ri);

View Full Code Here

Method Details

clone

public Object clone()
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.
Overrides:
clone in interface Object
Returns:
the new cloned RenderContext.
Usages and Demos :

View More Examples of clone()
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5:     public Rectangle2D getBounds2D(){
   6:         return (Rectangle2D)(litRegion.clone());
   7:     }
   8:         ...
   9: 
  10:     public RenderedImage createRendering(RenderContext rc) {
  11:         Shape aoi = rc.getAreaOfInterest();
  12:         ...
  13: 
  14:         rc = (RenderContext)rc.clone();

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5:     public Rectangle2D getBounds2D(){
   6:         return (Rectangle2D)(litRegion.clone());
   7:     }
   8:         ...
   9: 
  10:     public RenderedImage createRendering(RenderContext rc){
  11:         Shape aoi = rc.getAreaOfInterest();
  12:         ...
  13: 
  14:         rc = (RenderContext)rc.clone();

View Full Code Here

concatenateTransform

public void concatenateTransform(AffineTransform modTransform)
Modifies the current user-to-device transform by appending another transform. In matrix notation the operation is:
 [this] = [this] x [modTransform]
 
Parameters:
modTransform - the AffineTransform to append to the current usr2dev transform.

getAreaOfInterest

public Shape getAreaOfInterest()
Gets the ares of interest currently contained in the RenderContext.
Returns:
a reference to the area of interest of the RenderContext, or null if none is specified.

getRenderingHints

public RenderingHints getRenderingHints()
Gets the rendering hints of this RenderContext.
Returns:
a RenderingHints object that represents the rendering hints of this RenderContext.
Usages and Demos :

View More Examples of getRenderingHints()
   1: import java.awt.image.SampleModel;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public void computeHistogram(RenderContext rc) {
   7:         if (histo != null) 
   8:         ...
   9:         AffineTransform at = AffineTransform.getScaleInstance(scale, scale);
  10:         rc = new RenderContext(at, rc.getRenderingHints());
  11:         RenderedImage histRI = getSource().createRendering(rc);
  12:         ...
  13:     
  14:     public RenderedImage createRendering(RenderContext rc) {

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc){
   7:         RenderedImage srcRI = getSource().createRendering(rc);
   8:         ...
   9:                                         getTransferFunctions(),
  10:                                         rc.getRenderingHints());
  11:     }

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext renderContext){
   7:         AffineTransform usr2dev = renderContext.getTransform();
   8:         ...
   9:                 (node, usr2dev, usePrimitivePaint, 
  10:                  renderContext.getRenderingHints());
  11:             return cachedRed;

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: import java.util.Iterator;
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext renderContext){
   7: 
   8:         ...
   9:             (new RenderContext(renderContext.getTransform(), r2d, 
  10:                                renderContext.getRenderingHints()));
  11:         return ri;

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc){
   7:         ...
   8:         RenderingHints rh = rc.getRenderingHints();
   9:         if (rh == null) rh = new RenderingHints(null);
  10:         ...
  11: 
  12:         RenderContext tileRc  = new RenderContext(tileAt, srcRect, rh);

View Full Code Here

getTransform

public AffineTransform getTransform()
Gets the current user-to-device AffineTransform.
Returns:
a reference to the current AffineTransform.
Usages and Demos :

View More Examples of getTransform()
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: import java.util.Map;
   4:         ...
   5: 
   6:         AffineTransform at = node.getTransform();
   7:         if (at != null){
   8:         ...
   9: 
  10:     public RenderedImage createRendering(RenderContext renderContext){
  11:         ...
  12:         AffineTransform usr2dev = renderContext.getTransform();

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: import java.util.Iterator;
   4:         ...
   5:             Rectangle2D cr2d = gn.getBounds();
   6:             AffineTransform at = gn.getTransform();
   7:             if (at != null)
   8:         ...
   9: 
  10:         AffineTransform at = gn.getTransform();
  11:         if (at != null) {
  12:         ...
  13: 
  14:         AffineTransform at = gn.getTransform();

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc){
   7:         RenderingHints rh = rc.getRenderingHints();
   8:         ...
   9: 
  10:         AffineTransform at = rc.getTransform();
  11: 
  12:         ...
  13: 
  14:         RenderContext tileRc  = new RenderContext(tileAt, srcRect, rh);

View Full Code Here

preConcatenateTransform

public void preConcatenateTransform(AffineTransform modTransform)
Modifies the current user-to-device transform by prepending another transform. In matrix notation the operation is:
 [this] = [modTransform] x [this]
 
Parameters:
modTransform - the AffineTransform to prepend to the current usr2dev transform.

setAreaOfInterest

public void setAreaOfInterest(Shape newAoi)
Sets the current area of interest. The old area is discarded.
Parameters:
newAoi - The new area of interest.
Usages and Demos :

View More Examples of setAreaOfInterest(Shape newAoi)
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc) {
   7:         Shape aoi = rc.getAreaOfInterest();
   8:         ...
   9: 
  10:         rc = (RenderContext)rc.clone();
  11:         ...
  12:         rc.setAreaOfInterest(aoiR);

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc){
   7:         Shape aoi = rc.getAreaOfInterest();
   8:         ...
   9: 
  10:         rc = (RenderContext)rc.clone();
  11:         ...
  12:         rc.setAreaOfInterest(aoiR);

View Full Code Here

setRenderingHints

public void setRenderingHints(RenderingHints hints)
Sets the rendering hints of this RenderContext.
Parameters:
hints - a RenderingHints object that represents the rendering hints to assign to this RenderContext.

setTransform

public void setTransform(AffineTransform newTransform)
Sets the current user-to-device AffineTransform contained in the RenderContext to a given transform.
Parameters:
newTransform - the new AffineTransform.
Usages and Demos :

View More Examples of setTransform(AffineTransform newTransform)
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc) {
   7:         Shape aoi = rc.getAreaOfInterest();
   8:         ...
   9: 
  10:         rc = (RenderContext)rc.clone();
  11:         rc.setAreaOfInterest(aoiR);
  12:         ...
  13:         rc.setTransform(scale);

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.renderable.RenderContext;
   3: 
   4:         ...
   5: 
   6:     public RenderedImage createRendering(RenderContext rc){
   7:         Shape aoi = rc.getAreaOfInterest();
   8:         ...
   9: 
  10:         rc = (RenderContext)rc.clone();
  11:         rc.setAreaOfInterest(aoiR);
  12:         ...
  13:         rc.setTransform(scale);

View Full Code Here

void concetenateTransform

public @Deprecated void concetenateTransform(AffineTransform modTransform)

Deprecated. replaced by concatenateTransform(AffineTransform).

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.
Parameters:
modTransform - the AffineTransform to append to the current usr2dev transform.

void preConcetenateTransform

public @Deprecated void preConcetenateTransform(AffineTransform modTransform)

Deprecated. replaced by preConcatenateTransform(AffineTransform).

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.
Parameters:
modTransform - the AffineTransform to prepend to the current usr2dev transform.