|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.media.jai.OperationDescriptorImpl
javax.media.jai.operator.SubsampleAverageDescriptor
An OperationDescriptor describing the "SubsampleAverage"
operation. "SubsampleAverage" supports the rendered and renderable modes.
The "SubsampleAverage" operation subsamples an image by averaging
over a moving window. The scale factors supplied to the operation are
forward mapping coefficients representing the geometric transformation
from source to destination image coordinates. For example, if both
scale factors were equal to 0.5, the operation would produce an output
image of half the size of the input image in both dimensions. Both
scale factors must be in the range (0.0, 1.0] or an
exception will be thrown when the operation is created. The default
value of the vertical scale factor is the value of the horizontal scale
factor. If both scale factors equal
The size of the moving window or block over which source pixels are averaged varies as a function of the scale factors and is defined as
int blockX = (int)Math.ceil(1.0/scaleX);
int blockY = (int)Math.ceil(1.0/scaleY);
For a given destination pixel (dstX, dstY), the upper
left corner (srcX, srcY) of the source block over which
averaging occurs is defined as
int srcX = (int)Math.floor((dstX - dstMinX)/scaleX + 0.5) + srcMinX;
int srcY = (int)Math.floor((dstY - dstMinY)/scaleY + 0.5) + srcMinY;
where (srcMinX, srcMinY) are the image coordinates of the
upper left pixel of the source and (dstMinX, dstMinY) are
the image coordinates of the upper left pixel of the destination.
The destination image bounds are defined as
int dstMinX = (int)Math.floor(srcMinX*scaleX);
int dstMinY = (int)Math.floor(srcMinY*scaleY);
int dstWidth = (int)(srcWidth*scaleX);
int dstHeight = (int)(srcHeight*scaleY);
where (srcWidth, srcHeight) and
(dstWidth, dstHeight) are the source and destination
image dimensions, respectively.
| Name | Value |
|---|---|
| GlobalName | SubsampleAverage |
| LocalName | SubsampleAverage |
| Vendor | com.sun.media.jai |
| Description | Subsamples an image by averaging over a moving window. |
| DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/SubsampleAverageDescriptor.html |
| Version | 1.0 |
| arg0Desc | The X scale factor. |
| arg1Desc | The Y scale factor. |
| Name | Class Type | Default Value |
|---|---|---|
| scaleX | java.lang.Double | 0.5 |
| scaleY | java.lang.Double | scaleX |
FilteredSubsampleDescriptor,
SubsampleBinaryToGrayDescriptor,
ScaleDescriptor,
Serialized Form| Field Summary |
| Fields inherited from class javax.media.jai.OperationDescriptorImpl |
sourceNames, supportedModes |
| Fields inherited from interface javax.media.jai.OperationDescriptor |
NO_PARAMETER_DEFAULT |
| Constructor Summary | |
SubsampleAverageDescriptor()
Constructor. |
|
| Method Summary | |
static RenderedOp |
create(RenderedImage source0,
Double scaleX,
Double scaleY,
RenderingHints hints)
Subsamples an image by averaging over a moving window. |
static RenderableOp |
createRenderable(RenderableImage source0,
Double scaleX,
Double scaleY,
RenderingHints hints)
Subsamples an image by averaging over a moving window. |
PropertyGenerator[] |
getPropertyGenerators(String modeName)
Returns an array of PropertyGenerators implementing
property inheritance for the "SubsampleAverage" operation. |
protected boolean |
validateParameters(String modeName,
ParameterBlock args,
StringBuffer msg)
Validates the input parameters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SubsampleAverageDescriptor()
| Method Detail |
public PropertyGenerator[] getPropertyGenerators(String modeName)
PropertyGenerators implementing
property inheritance for the "SubsampleAverage" operation.
getPropertyGenerators in interface RegistryElementDescriptorgetPropertyGenerators in class OperationDescriptorImplmodeName - the registry mode name
PropertyGenerators, or
null if this operation does not have any of
its own PropertyGenerators.RegistryElementDescriptor
protected boolean validateParameters(String modeName,
ParameterBlock args,
StringBuffer msg)
In addition to the standard checks performed by the
superclass method, this method sets "scaleX" to "scaleY"
if the latter is not provided in args.
validateParameters in class OperationDescriptorImplOperationDescriptorImpl.validateArguments(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer),
ParameterListDescriptorImpl.isParameterValueValid(java.lang.String, java.lang.Object)
public static RenderedOp create(RenderedImage source0,
Double scaleX,
Double scaleY,
RenderingHints hints)
Creates a ParameterBlockJAI from all
supplied arguments except hints and invokes
JAI.create(String,ParameterBlock,RenderingHints).
source0 - RenderedImage source 0.scaleX - The X scale factor.
May be null.scaleY - The Y scale factor.
May be null.hints - The RenderingHints to use.
May be null.
RenderedOp destination.
IllegalArgumentException - if source0 is null.JAI,
ParameterBlockJAI,
RenderedOp
public static RenderableOp createRenderable(RenderableImage source0,
Double scaleX,
Double scaleY,
RenderingHints hints)
Creates a ParameterBlockJAI from all
supplied arguments except hints and invokes
JAI.createRenderable(String,ParameterBlock,RenderingHints).
source0 - RenderableImage source 0.scaleX - The X scale factor.
May be null.scaleY - The Y scale factor.
May be null.hints - The RenderingHints to use.
May be null.
RenderableOp destination.
IllegalArgumentException - if source0 is null.JAI,
ParameterBlockJAI,
RenderableOp
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||