|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.PlanarImage | +--javax.media.jai.OpImage | +--javax.media.jai.GeometricOpImage | +--javax.media.jai.ScaleOpImage
A class extending WarpOpImage
for use by further
extension classes that perform image scaling. Image scaling operations
require rectilinear backwards mapping and padding by the resampling
filter dimensions.
When applying scale factors of scaleX, scaleY to a source image
with width of src_width and height of src_height, the resulting image
is defined to have the following bounds:
dst minX = floor(src minX * scaleX + transX)
dst minY = floor(src minY * scaleY + transY)
dst width = ceil(src width * scaleX)
dst height = ceil(src height * scaleY)
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 BorderExtender
is specified, the source will
not be extended. The scaled image size is still calculated
according to the formula specified above. However since there is not
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 be set to zeros.
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.
WarpOpImage
,
OpImage
Field Summary | |
protected com.sun.media.jai.util.Rational |
invScaleXRational
|
protected long |
invScaleXRationalDenom
|
protected long |
invScaleXRationalNum
|
protected com.sun.media.jai.util.Rational |
invScaleYRational
|
protected long |
invScaleYRationalDenom
|
protected long |
invScaleYRationalNum
|
protected static float |
rationalTolerance
|
protected float |
scaleX
The horizontal scale factor. |
protected com.sun.media.jai.util.Rational |
scaleXRational
Rational representations |
protected long |
scaleXRationalDenom
|
protected long |
scaleXRationalNum
|
protected float |
scaleY
The vertical scale factor. |
protected com.sun.media.jai.util.Rational |
scaleYRational
Rational representations |
protected long |
scaleYRationalDenom
|
protected long |
scaleYRationalNum
|
protected float |
transX
Thee horizontal translation factor |
protected com.sun.media.jai.util.Rational |
transXRational
|
protected long |
transXRationalDenom
|
protected long |
transXRationalNum
|
protected float |
transY
The vertical translation factor |
protected com.sun.media.jai.util.Rational |
transYRational
|
protected long |
transYRationalDenom
|
protected long |
transYRationalNum
|
Fields inherited from class javax.media.jai.GeometricOpImage |
computableBounds,
extender,
interp |
Fields inherited from class javax.media.jai.OpImage |
cache,
cobbleSources,
OP_COMPUTE_BOUND,
OP_IO_BOUND,
OP_NETWORK_BOUND,
tileCacheMetric |
Fields inherited from class javax.media.jai.PlanarImage |
colorModel,
eventManager,
height,
minX,
minY,
properties,
sampleModel,
tileGridXOffset,
tileGridYOffset,
tileHeight,
tileWidth,
width |
Constructor Summary | |
ScaleOpImage(RenderedImage source,
ImageLayout layout,
Map configuration,
boolean cobbleSources,
BorderExtender extender,
Interpolation interp,
float scaleX,
float scaleY,
float transX,
float transY)
Constructs a ScaleOpImage from a RenderedImage
source, an optional BorderExtender , x and y scale
and translation factors, and an Interpolation
object. |
Method Summary | |
protected Rectangle |
backwardMapRect(Rectangle destRect,
int sourceIndex)
Returns the minimum bounding box of the region of the specified source to which a particular Rectangle of the
destination will be mapped. |
Raster |
computeTile(int tileX,
int tileY)
Computes a tile. |
protected Rectangle |
forwardMapRect(Rectangle sourceRect,
int sourceIndex)
Returns the minimum bounding box of the region of the destination to which a particular Rectangle of the specified source
will be mapped. |
int |
getBottomPadding()
Deprecated. as of JAI 1.1. |
int |
getLeftPadding()
Deprecated. as of JAI 1.1. |
int |
getRightPadding()
Deprecated. as of JAI 1.1. |
int |
getTopPadding()
Deprecated. as of JAI 1.1. |
Methods inherited from class javax.media.jai.GeometricOpImage |
getBorderExtender,
getInterpolation,
mapDestRect,
mapSourceRect |
Methods inherited from class javax.media.jai.OpImage |
addTileToCache,
cancelTiles,
computeRect,
computeRect,
computesUniqueTiles,
finalize,
getExpandedNumBands,
getFormatTags,
getOperationComputeType,
getTile,
getTileCache,
getTileCacheMetric,
getTileDependencies,
getTileFromCache,
getTiles,
hasExtender,
prefetchTiles,
queueTiles,
setTileCache,
vectorize,
vectorize,
vectorize |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected float scaleX
protected float scaleY
protected float transX
protected float transY
protected com.sun.media.jai.util.Rational scaleXRational
protected com.sun.media.jai.util.Rational scaleYRational
protected long scaleXRationalNum
protected long scaleXRationalDenom
protected long scaleYRationalNum
protected long scaleYRationalDenom
protected com.sun.media.jai.util.Rational invScaleXRational
protected com.sun.media.jai.util.Rational invScaleYRational
protected long invScaleXRationalNum
protected long invScaleXRationalDenom
protected long invScaleYRationalNum
protected long invScaleYRationalDenom
protected com.sun.media.jai.util.Rational transXRational
protected com.sun.media.jai.util.Rational transYRational
protected long transXRationalNum
protected long transXRationalDenom
protected long transYRationalNum
protected long transYRationalDenom
protected static float rationalTolerance
Constructor Detail |
public ScaleOpImage(RenderedImage source, ImageLayout layout, Map configuration, boolean cobbleSources, BorderExtender extender, Interpolation interp, float scaleX, float scaleY, float transX, float transY)
ScaleOpImage
from a RenderedImage
source, an optional BorderExtender
, x and y scale
and translation factors, and an Interpolation
object. The image dimensions are determined by forward-mapping
the source bounds, and are passed to the superclass constructor
by means of the layout
parameter. Other fields of
the layout are passed through unchanged. If
layout
is null
, a new
ImageLayout
will be constructor to hold the bounds
information.
Note that the scale factors are represented internally as Rational
numbers in order to workaround inexact device specific representation
of floating point numbers. For instance the floating point number 1.2
is internally represented as 1.200001, which can throw the
calculations off during a forward/backward map.
The Rational approximation is valid upto the sixth decimal place.
layout
- an ImageLayout
optionally containing
the tile grid layout, SampleModel
, and
ColorModel
, or null
.source
- a RenderedImage
.configuration
- Configurable attributes of the image including
configuration variables indexed by
RenderingHints.Key
s and image properties indexed
by String
s or CaselessStringKey
s.
This is simply forwarded to the superclass constructor.cobbleSources
- a boolean indicating whether
computeRect
expects contiguous sources.extender
- a BorderExtender
, or null
.interp
- an Interpolation
object to use for
resampling.scaleX
- scale factor along x axis.scaleY
- scale factor along y axis.transX
- translation factor along x axis.transY
- translation factor along y axis.source
is null
.Method Detail |
public int getLeftPadding()
public int getRightPadding()
public int getTopPadding()
public int getBottomPadding()
protected Rectangle forwardMapRect(Rectangle sourceRect, int sourceIndex)
Rectangle
of the specified source
will be mapped.sourceRect
- the Rectangle
in source coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the destination
bounding box, or null
if the bounding box
is unknown.sourceIndex
is
negative or greater than the index of the last source.sourceRect
is
null
.protected Rectangle backwardMapRect(Rectangle destRect, int sourceIndex)
Rectangle
of the
destination will be mapped.destRect
- the Rectangle
in destination coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the source bounding box,
or null
if the bounding box is unknown.sourceIndex
is
negative or greater than the index of the last source.destRect
is
null
.public Raster computeTile(int tileX, int tileY)
computeRect(Raster[], WritableRaster, Rectangle)
is called for each of the resulting regions. Otherwise,
computeRect(PlanarImage[], WritableRaster,
Rectangle)
is called once to compute the entire active
area of the tile.
The image bounds may be larger than the bounds of the source image. In this case, samples for which there are no corresponding sources are set to zero.
The following steps are performed in order to compute the tile:
tileX
- The X index of the tile.tileY
- The Y index of the tile.Raster
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |