|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.OperationDescriptorImpl | +--javax.media.jai.operator.SubsampleBinaryToGrayDescriptor
An OperationDescriptor
describing the "SubsampleBinaryToGray"
operation.
The "SubsampleBinaryToGray" operation collects a Binary image pixels into a gray scale image. Roughly speaking, each pixel (x, y) of the destination, is the sum of the source pixel values of the source pixel matrix of size 1/xScale by 1/yScale. In the noninteger case, the next bigger inter is used. Thus when xScale = yScale = 1/2.2, a 3 x 3 pixel matrix into a single destination pixel, resulting in 10 levels [0..9]. The resulting gray values are then normalized to have gray values in [0..255].
The source is a Binary image and the result of the operation is
a grayscale image. The scale factors xScale
and yScale
must be between (0, 1] and strictly bigger
than 0.
The destination image is a byte image whose
dimensions are:
dstWidth = floor(srcWidth * xScale)
dstHeight = floor(srcHeight * yScale)
It may be noted that the minX, minY, width and height hints as
specified through the JAI.KEY_IMAGE_LAYOUT
hint in the
RenderingHints
object are not honored, as this operator
calculates the destination image bounds itself. The other
ImageLayout
hints, like tileWidth and tileHeight,
however, are honored.
It should be noted that this operation automatically adds a
value of Boolean.FALSE
for the
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
to the given
configuration
since this operation is capable of
dealing correctly with a source that has an IndexColorModel
,
without having to expand the IndexColorModel
.
This addition will take place only if a value for the
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
has not already been
provided by the user. Note that the configuration
Map
is cloned before the new hint is added to it.
Specifying a scale factor of greater than 1 or less than 0
will cause an exception. To scale image sizes up or down,
see Scale
operator.
Name | Value |
---|---|
GlobalName | SubsampleBinaryToGray |
LocalName | SubsampleBinaryToGray |
Vendor | com.sun.media.jai |
Description | Subsamples a binary image into a gray scale image. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/SubsampleBinaryToGrayDescriptor.html |
Version | 1.0 |
arg0Desc | The X scale factor. |
arg1Desc | The Y scale factor. |
Name | Class Type | Default Value |
---|---|---|
xScale | java.lang.Float | 1.0F |
yScale | java.lang.Float | 1.0F |
OperationDescriptor
, Serialized FormFields inherited from class javax.media.jai.OperationDescriptorImpl |
resources, sourceNames, supportedModes |
Fields inherited from interface javax.media.jai.OperationDescriptor |
NO_PARAMETER_DEFAULT |
Constructor Summary | |
SubsampleBinaryToGrayDescriptor()
Constructor. |
Method Summary | |
static RenderedOp |
create(RenderedImage source0,
Float xScale,
Float yScale,
RenderingHints hints)
To subsamples binary image to gray; reverse of dithering. |
static RenderableOp |
createRenderable(RenderableImage source0,
Float xScale,
Float yScale,
RenderingHints hints)
To subsamples binary image to gray; reverse of dithering. |
Number |
getParamMinValue(int index)
Returns the minimum legal value of a specified numeric parameter for this operation. |
PropertyGenerator[] |
getPropertyGenerators()
Returns an array of PropertyGenerators implementing
property inheritance for the "SubsampleBinaryToGray" operation. |
boolean |
isRenderableSupported()
Returns true since renderable operation is supported. |
protected boolean |
validateParameters(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 SubsampleBinaryToGrayDescriptor()
Method Detail |
public boolean isRenderableSupported()
true
since renderable operation is supported.isRenderableSupported
in class OperationDescriptorImpl
javax.media.jai.OperationDescriptorImpl
OperationDescriptorImpl.isModeSupported(java.lang.String)
public PropertyGenerator[] getPropertyGenerators()
PropertyGenerators
implementing
property inheritance for the "SubsampleBinaryToGray" operation.getPropertyGenerators
in class OperationDescriptorImpl
protected boolean validateParameters(ParameterBlock args, StringBuffer msg)
In addition to the standard checks performed by the superclass method, this method checks that "xScale" and "yScale" are both greater than 0 and less than or equal to 1.
The src image must be a binary, a one band, one bit
per pixel image with a MultiPixelPackedSampleModel
.
validateParameters
in class OperationDescriptorImpl
javax.media.jai.OperationDescriptorImpl
IllegalArgumentException
- if args
is null
.IllegalArgumentException
- if msg
is null
and the validation fails.OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
public Number getParamMinValue(int index)
For the minimum value of "xScale" and "yScale", this method returns 0. However, the scale factors must be a positive floating number and can not be 0.
getParamMinValue
in class OperationDescriptorImpl
javax.media.jai.OperationDescriptorImpl
index
- The index of the parameter to be queried.Number
representing the minimum legal value,
or null
if the specified parameter is not
numeric.IllegalArgumentException
- if this operation has no parameters.ArrayIndexOutOfBoundsException
- if there is no parameter
corresponding to the specified index
.ParameterListDescriptor.getParamValueRange(java.lang.String)
,
ParameterListDescriptor.getEnumeratedParameterValues(java.lang.String)
,
ParameterListDescriptor.isParameterValueValid(java.lang.String, java.lang.Object)
public static RenderedOp create(RenderedImage source0, Float xScale, Float yScale, RenderingHints hints)
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.create(String,ParameterBlock,RenderingHints)
.
source0
- RenderedImage
source 0.xScale
- scaleX must be between 0 and 1, excluding 0.
May be null
.yScale
- scaleY must be between 0 and 1, excluding 0.
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, Float xScale, Float yScale, RenderingHints hints)
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.createRenderable(String,ParameterBlock,RenderingHints)
.
source0
- RenderableImage
source 0.xScale
- scaleX must be between 0 and 1, excluding 0.
May be null
.yScale
- scaleY must be between 0 and 1, excluding 0.
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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |