Book Home Java Enterprise in a Nutshell Search this book

Chapter 19. The java.awt.image.renderable Package

The java.awt.image.renderable package contains classes and interfaces used by the Java Advanced Imaging (JAI) standard extension (javax.jai.*). In general, these classes and interfaces are not of interest to Java 2D programs, but the package is part of the core Java platform so that the JAI can be tightly coupled to the core image-processing features. Only image-processing applications that use the JAI ever need to use the classes and interfaces in this package. Figure 19-1 shows the class hierarchy of this package, which is new in Java 1.2.

figure

Figure 19-1. The java.awt.image.renderable package

ContextualRenderedImageFactoryJava 1.2
java.awt.image.renderable

This interface is implemented by classes that, given a RenderContext and a ParameterBlock of arguments, can produce a java.awt.image.RenderedImage. Implementations of this interface are used to perform rendering-independent image filtering by RenderableImageOp.

public abstract interface ContextualRenderedImageFactory extends RenderedImageFactory {
// Public Instance Methods
public abstract RenderedImage create (RenderContext renderContext, ParameterBlock paramBlock);
public abstract java.awt.geom.Rectangle2D getBounds2D (ParameterBlock paramBlock);
public abstract Object getProperty (ParameterBlock paramBlock, String name);
public abstract String[ ] getPropertyNames ();
public abstract boolean isDynamic ();
public abstract RenderContext mapRenderContext (int i, RenderContext renderContext, ParameterBlock paramBlock, RenderableImage image);
}

Hierarchy: (ContextualRenderedImageFactory(RenderedImageFactory))

Passed To: RenderableImageOp.RenderableImageOp()

ParameterBlockJava 1.2
java.awt.image.renderablecloneable serializable

This utility class maintains a list of parameter objects and a list of source objects for use by a RenderableImageOp. Various methods allow sources and parameters to added, set, and queried.

public class ParameterBlock implements Cloneable, Serializable {
// Public Constructors
public ParameterBlock ();
public ParameterBlock (java.util.Vector sources);
public ParameterBlock (java.util.Vector sources, java.util.Vector parameters);
// Property Accessor Methods (by property name)
public int getNumParameters (); default:0
public int getNumSources (); default:0
public Class[ ] getParamClasses ();
public java.util.Vector getParameters ();
public void setParameters (java.util.Vector parameters);
public java.util.Vector getSources ();
public void setSources (java.util.Vector sources);
// Public Instance Methods
public ParameterBlock add (int i);
public ParameterBlock add (float f);
public ParameterBlock add (long l);
public ParameterBlock add (short s);
public ParameterBlock add (Object obj);
public ParameterBlock add (double d);
public ParameterBlock add (byte b);
public ParameterBlock add (char c);
public ParameterBlock addSource (Object source);
public byte getByteParameter (int index);
public char getCharParameter (int index);
public double getDoubleParameter (int index);
public float getFloatParameter (int index);
public int getIntParameter (int index);
public long getLongParameter (int index);
public Object getObjectParameter (int index);
public RenderableImage getRenderableSource (int index);
public RenderedImage getRenderedSource (int index);
public short getShortParameter (int index);
public Object getSource (int index);
public void removeParameters ();
public void removeSources ();
public ParameterBlock set (long l, int index);
public ParameterBlock set (int i, int index);
public ParameterBlock set (short s, int index);
public ParameterBlock set (Object obj, int index);
public ParameterBlock set (char c, int index);
public ParameterBlock set (byte b, int index);
public ParameterBlock set (float f, int index);
public ParameterBlock set (double d, int index);
public ParameterBlock setSource (Object source, int index);
public Object shallowClone ();
// Public Methods Overriding Object
public Object clone ();
// Protected Instance Fields
protected java.util.Vector parameters ;
protected java.util.Vector sources ;
}

Hierarchy: Object-->ParameterBlock(Cloneable,Serializable)

Passed To: ContextualRenderedImageFactory.{create(), getBounds2D(), getProperty(), mapRenderContext()}, RenderableImageOp.{RenderableImageOp(), setParameterBlock()}, RenderedImageFactory.create()

Returned By: Too many methods to list.

RenderableImageJava 1.2
java.awt.image.renderable

This interface represents a rendering-independent (and resolution-independent) image. A RenderableImage may be passed to the drawRenderableImage() method of Graphics2D. However, a working, concrete implementation RenderableImage requires the forthcoming Java Advanced Imaging API. Java 2D programs that are not using the JAI will never use this interface.

public abstract interface RenderableImage {
// Public Constants
public static final String HINTS_OBSERVED ; ="HINTS_OBSERVED"
// Property Accessor Methods (by property name)
public abstract boolean isDynamic ();
public abstract float getHeight ();
public abstract float getMinX ();
public abstract float getMinY ();
public abstract String[ ] getPropertyNames ();
public abstract java.util.Vector getSources ();
public abstract float getWidth ();
// Public Instance Methods
public abstract RenderedImage createDefaultRendering ();
public abstract RenderedImage createRendering (RenderContext renderContext);
public abstract RenderedImage createScaledRendering (int w, int h, RenderingHints hints);
public abstract Object getProperty (String name);
}

Implementations: RenderableImageOp

Passed To: Graphics2D.drawRenderableImage(), ContextualRenderedImageFactory.mapRenderContext(), RenderableImageProducer.RenderableImageProducer()

Returned By: ParameterBlock.getRenderableSource()

RenderableImageOpJava 1.2
java.awt.image.renderable

This class defines an image-processing operation on a RenderableImage and is itself a RenderableImage, allowing processing operations to be pipelined, or streamed. Although this is a concrete class, the image-processing operation itself is defined in an external ContextualRenderedImageFactor object.

public class RenderableImageOp implements RenderableImage {
// Public Constructors
public RenderableImageOp (ContextualRenderedImageFactory CRIF, ParameterBlock paramBlock);
// Public Instance Methods
public ParameterBlock getParameterBlock ();
public ParameterBlock setParameterBlock (ParameterBlock paramBlock);
// Methods Implementing RenderableImage
public RenderedImage createDefaultRendering ();
public RenderedImage createRendering (RenderContext renderContext);
public RenderedImage createScaledRendering (int w, int h, RenderingHints hints);
public float getHeight ();
public float getMinX ();
public float getMinY ();
public Object getProperty (String name);
public String[ ] getPropertyNames ();
public java.util.Vector getSources ();
public float getWidth ();
public boolean isDynamic ();
}

Hierarchy: Object-->RenderableImageOp(RenderableImage)

RenderableImageProducerJava 1.2
java.awt.image.renderablerunnable

This class is an adapter that allows RenderableImage objects of the Java Advanced Imaging API to be used with the Java 1.0 ImageProducer/ImageConsumer image-processing model. The JAI is a forthcoming standard extension. This class exists in a core AWT package solely for future interoperability.

public class RenderableImageProducer implements ImageProducer, Runnable {
// Public Constructors
public RenderableImageProducer (RenderableImage rdblImage, RenderContext rc);
// Public Instance Methods
public void setRenderContext (RenderContext rc); synchronized
// Methods Implementing ImageProducer
public void addConsumer (ImageConsumer ic); synchronized
public boolean isConsumer (ImageConsumer ic); synchronized
public void removeConsumer (ImageConsumer ic); synchronized
public void requestTopDownLeftRightResend (ImageConsumer ic); empty
public void startProduction (ImageConsumer ic); synchronized
// Methods Implementing Runnable
public void run ();
}

Hierarchy: Object-->RenderableImageProducer(ImageProducer,Runnable)

RenderContextJava 1.2
java.awt.image.renderablecloneable

This class contains the information necessary to produce a device-specific java.awt. image.RenderedImage from a RenderableImage. That information is a transformation from user coordinates to device coordinates, an optional java.awt.Shape describing the area of interest in the RenderableImage, and an optional set of java.awt.RenderingHints.

public class RenderContext implements Cloneable {
// Public Constructors
public RenderContext (java.awt.geom.AffineTransform usr2dev);
public RenderContext (java.awt.geom.AffineTransform usr2dev, Shape aoi);
public RenderContext (java.awt.geom.AffineTransform usr2dev, RenderingHints hints);
public RenderContext (java.awt.geom.AffineTransform usr2dev, Shape aoi, RenderingHints hints);
// Public Instance Methods
public void concetenateTransform (java.awt.geom.AffineTransform modTransform);
public Shape getAreaOfInterest ();
public RenderingHints getRenderingHints ();
public java.awt.geom.AffineTransform getTransform ();
public void preConcetenateTransform (java.awt.geom.AffineTransform modTransform);
public void setAreaOfInterest (Shape newAoi);
public void setRenderingHints (RenderingHints hints);
public void setTransform (java.awt.geom.AffineTransform newTransform);
// Public Methods Overriding Object
public Object clone ();
}

Hierarchy: Object-->RenderContext(Cloneable)

Passed To: ContextualRenderedImageFactory.{create(), mapRenderContext()}, RenderableImage.createRendering(), RenderableImageOp.createRendering(), RenderableImageProducer.{RenderableImageProducer(), setRenderContext()}

Returned By: ContextualRenderedImageFactory.mapRenderContext()

RenderedImageFactoryJava 1.2
java.awt.image.renderable

This interface is implemented by classes that, given a ParameterBlock of arguments and a set of RenderingHints, can create RenderedImage objects, typically through the process of rendering a RenderableImage object. The subinterface ContextualRenderedImageFactory is used more often than RenderedImageFactory.

public abstract interface RenderedImageFactory {
// Public Instance Methods
public abstract RenderedImage create (ParameterBlock paramBlock, RenderingHints hints);
}

Implementations: ContextualRenderedImageFactory



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.