javax.media.jai.operator
Class OverlayDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.OverlayDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class OverlayDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Overlay" operation.

The Overlay operation takes two rendered or renderable source images, and overlays the second source image on top of the first source image. No additional parameters are required.

The two source images must have the same data type and number of bands. However, their SampleModel types may differ. The destination image will always have the same bounding rectangle as the first source image, that is, the image on the bottom, and the same data type and number of bands as the two sources. In case the two sources don't intersect, the destination will be the same as the first source.

The destination pixel values are defined by the pseudocode:

 if (srcs[1] contains the point (x, y)) {
     dst[x][y][b] = srcs[1][x][y][b];
 } else {
     dst[x][y][b] = srcs[0][x][y][b];
 }
 

Resource List
Name Value
GlobalName Overlay
LocalName Overlay
Vendor com.sun.media.jai
Description Overlays one image on top of another.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/OverlayDescriptor.html
Version 1.0

No parameters are needed for this operation.

See Also:
OperationDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
OverlayDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, RenderedImage source1, RenderingHints hints)
          Overlays one image on top of another.
static RenderableOp createRenderable(RenderableImage source0, RenderableImage source1, RenderingHints hints)
          Overlays one image on top of another.
protected  boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg)
          Validates the input sources.
 
Methods inherited from class javax.media.jai.OperationDescriptorImpl
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverlayDescriptor

public OverlayDescriptor()
Constructor.

Method Detail

validateSources

protected boolean validateSources(String modeName,
                                  ParameterBlock args,
                                  StringBuffer msg)
Validates the input sources.

In addition to the standard checks performed by the superclass method, this method checks that the source image SampleModels have the same number of bands and transfer types.

Overrides:
validateSources in class OperationDescriptorImpl
Parameters:
modeName - the operation mode name
args - a ParameterBlock that has the sources
msg - A string that may contain error messages.
See Also:
OperationDescriptorImpl.validateArguments(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)

create

public static RenderedOp create(RenderedImage source0,
                                RenderedImage source1,
                                RenderingHints hints)
Overlays one image on top of another.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderedImage source 0.
source1 - RenderedImage source 1.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if source1 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp

createRenderable

public static RenderableOp createRenderable(RenderableImage source0,
                                            RenderableImage source1,
                                            RenderingHints hints)
Overlays one image on top of another.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.createRenderable(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderableImage source 0.
source1 - RenderableImage source 1.
hints - The RenderingHints to use. May be null.
Returns:
The RenderableOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if source1 is null.
See Also:
JAI, ParameterBlockJAI, RenderableOp