|
|||||||||
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.ScaleDescriptor
An OperationDescriptor
describing the "Scale" operation.
The "Scale" operation translates and resizes an image. For each pixel (x, y) of the destination, the source value at the fractional subpixel position ((x - xTrans)/xScale, (y - yTrans)/yScale) is constructed by means of an Interpolation object and written to the destination.
When applying scale factors of scale_x, scale_y to a source image
with width of src_width and height of src_height, the resulting image
is defined to have the following dimensions:
dst_width = src_width * scale_x
dst_height = src_height * scale_y
When interpolations which require padding the source such as Bilinear
or Bicubic interpolation are specified, the source needs to be extended
such that it has the extra pixels needed to compute all the destination
pixels. This extension is performed via the BorderExtender
class. The type of Border Extension can be specified as a
RenderingHint
to the JAI.create
method.
If no Border Extension is specified, the source will not be extended. The scaled image size is still calculated according to the formula specified above. However since there isn't enough source to compute all the destination pixels, only that subset of the destination image's pixels, which can be computed, will be written in the destination. The rest of the destination will not be written.
Specifying a scale factor of greater than 1 increases the size of the image, specifying a scale factor between 0 and 1 (non-inclusive) decreases the size of an image. An IllegalArgumentException will be thrown if the specified scale factors are negative or equal to zero.
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.
"Scale" defines a PropertyGenerator that performs an identical
transformation on the "ROI" property of the source image, which can
be retrieved by calling the getProperty
method with
"ROI" as the property name.
Name | Value |
---|---|
GlobalName | Scale |
LocalName | Scale |
Vendor | com.sun.media.jai |
Description | Resizes an image. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ScaleDescriptor.html |
Version | 1.0 |
arg0Desc | The X scale factor. |
arg1Desc | The Y scale factor. |
arg2Desc | The X translation. |
arg3Desc | The Y translation. |
arg4Desc | The interpolation method for resampling. |
Name | Class Type | Default Value |
---|---|---|
xScale | java.lang.Float | 1.0F |
yScale | java.lang.Float | 1.0F |
xTrans | java.lang.Float | 0.0F |
yTrans | java.lang.Float | 0.0F |
interpolation | javax.media.jai.Interpolation | InterpolationNearest |
Interpolation
,
BorderExtender
,
OperationDescriptor
, Serialized FormFields inherited from class javax.media.jai.OperationDescriptorImpl |
resources,
sourceNames,
supportedModes |
Constructor Summary | |
ScaleDescriptor()
Constructor. |
Method Summary | |
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 "Scale" 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 ScaleDescriptor()
Method Detail |
public boolean isRenderableSupported()
true
since renderable operation is supported.OperationDescriptorImpl.isModeSupported(java.lang.String)
public PropertyGenerator[] getPropertyGenerators()
PropertyGenerators
implementing
property inheritance for the "Scale" operation.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.
args
is null
.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.
index
- The index of the parameter to be queried.Number
representing the minimum legal value,
or null
if the specified parameter is not
numeric.index
.ParameterListDescriptor.getParamValueRange(java.lang.String)
,
ParameterListDescriptor.getEnumeratedParameterValues(java.lang.String)
,
ParameterListDescriptor.isParameterValueValid(java.lang.String, java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |