|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.resources.image.ImageUtilities
public final class ImageUtilities
A set of static methods working on images. Some of those methods are useful, but not really rigorous. This is why they do not appear in any "official" package, but instead in this private one. Do not rely on this API! It may change in incompatible way in any future version.
Field Summary | |
---|---|
static java.awt.RenderingHints |
DONT_REPLACE_INDEX_COLOR_MODEL
RenderingHints used to prevent JAI operations from expanding
IndexColorModel s. |
static java.awt.RenderingHints |
EXTEND_BORDER_BY_COPYING
Cached instance of a RenderingHints for controlling border extension on
JAI operations. |
static java.awt.RenderingHints |
EXTEND_BORDER_BY_REFLECT
Cached instance of a RenderingHints for controlling border extension on
JAI operations. |
static java.awt.RenderingHints |
NN_INTERPOLATION_HINT
RenderingHints for requesting Nearest Neighbor intepolation. |
static java.awt.RenderingHints |
NOCACHE_HINT
RenderingHints for avoiding caching of JAI RenderedOp s. |
static java.awt.RenderingHints |
REPLACE_INDEX_COLOR_MODEL
RenderingHints used to force JAI operations to expand
IndexColorModel s. |
Method Summary | ||
---|---|---|
static
|
allowNativeCodec(java.lang.String format,
java.lang.Class<T> category,
boolean allowed)
Allows or disallows native acceleration for the specified image format. |
|
static javax.media.jai.ImageLayout |
createIntersection(javax.media.jai.ImageLayout layout,
java.util.List<java.awt.image.RenderedImage> sources)
Computes a new ImageLayout which is the intersection of the specified
ImageLayout and all RenderedImage s in the supplied list. |
|
static void |
fill(java.awt.image.WritableRenderedImage image,
java.lang.Number value)
Sets every samples in the given image to the given value. |
|
static javax.media.jai.ImageLayout |
getImageLayout(java.awt.image.RenderedImage image)
Suggests an ImageLayout for the specified image. |
|
static java.lang.String |
getInterpolationName(javax.media.jai.Interpolation interp)
Returns the interpolation name for the specified interpolation object. |
|
static java.awt.RenderingHints |
getRenderingHints(java.awt.image.RenderedImage image)
Suggests a set of RenderingHints for the specified image. |
|
static boolean |
isCLibAvailable()
Tells me whether or not the native libraries for JAI/ImageIO are active or not. |
|
static boolean |
isMediaLibAvailable()
Tells me whether or not the native libraries for JAI are active or not. |
|
static javax.media.jai.RenderedOp |
tileImage(javax.media.jai.RenderedOp image)
Tiles the specified image. |
|
static javax.media.jai.Interpolation |
toInterpolation(java.lang.Object type)
Casts the specified object to an object . |
|
static java.awt.Dimension |
toTileSize(java.awt.Dimension size)
Suggests a tile size for the specified image size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.RenderingHints DONT_REPLACE_INDEX_COLOR_MODEL
RenderingHints
used to prevent JAI
operations from expanding
IndexColorModel
s.
public static final java.awt.RenderingHints REPLACE_INDEX_COLOR_MODEL
RenderingHints
used to force JAI
operations to expand
IndexColorModel
s.
public static final java.awt.RenderingHints NN_INTERPOLATION_HINT
RenderingHints
for requesting Nearest Neighbor intepolation.
public static final java.awt.RenderingHints NOCACHE_HINT
RenderingHints
for avoiding caching of JAI
RenderedOp
s.
public static final java.awt.RenderingHints EXTEND_BORDER_BY_COPYING
RenderingHints
for controlling border extension on
JAI
operations. It contains an instance of a BorderExtenderCopy
.
public static final java.awt.RenderingHints EXTEND_BORDER_BY_REFLECT
RenderingHints
for controlling border extension on
JAI
operations. It contains an instance of a BorderExtenderReflect
.
Method Detail |
---|
public static javax.media.jai.ImageLayout getImageLayout(java.awt.image.RenderedImage image)
ImageLayout
for the specified image. All parameters are initially set
equal to those of the given RenderedImage
, and then the tile size is updated according the image size. This method never returns null
.
public static java.awt.RenderingHints getRenderingHints(java.awt.image.RenderedImage image)
RenderingHints
for the specified image.
The rendering hints may include the following parameters:
JAI.KEY_IMAGE_LAYOUT
with a proposed tile size.null
if no rendering hints is proposed.
public static java.awt.Dimension toTileSize(java.awt.Dimension size)
size
is the image's
size. On output, it is the tile size. This method write the result directly in the supplied
object and returns size
for convenience.
This method it aimed to computing a tile size such that the tile grid would have overlapped
the image bound in order to avoid having tiles crossing the image bounds and being therefore
partially empty. This method will never returns a tile size smaller than
. If this method can't suggest a size,
then it left the corresponding size
field (width
or
height
) unchanged.
The width
and height
fields are processed
independently in the same way. The following discussion use the width
field as an
example.
This method inspects different tile sizes close to the default tile size. Lets width
be the default tile width. Values are tried in the
following order: width
, width+1
, width-1
, width+2
,
width-2
, width+3
, width-3
, etc. until one of the
following happen:
Dimension
field (width
or height
) is set to this value.Dimension
field to a value that
maximize the remainder of image size / tile size (in other
words, the size that left as few empty pixels as possible).
public static javax.media.jai.ImageLayout createIntersection(javax.media.jai.ImageLayout layout, java.util.List<java.awt.image.RenderedImage> sources)
ImageLayout
which is the intersection of the specified
ImageLayout
and all RenderedImage
s in the supplied list. If the
minX
, minY
,
width
and height
properties are not defined in the layout
, then they will be inherited
from the first source for consistency with OpImage
constructor.
layout
- The original layout. This object will not be modified.sources
- The list of sources RenderedImage
.
ImageLayout
, or the original layout
if no change was needed.public static javax.media.jai.Interpolation toInterpolation(java.lang.Object type) throws java.lang.IllegalArgumentException
object
.
type
- The interpolation type as an Interpolation
or a CharSequence
object.
java.lang.IllegalArgumentException
- if the specified interpolation type is not a know one.public static java.lang.String getInterpolationName(javax.media.jai.Interpolation interp)
Interpolation
- The interpolation object, or null
for "nearest"
(which is an other way to say "no interpolation").public static <T extends javax.imageio.spi.ImageReaderWriterSpi> void allowNativeCodec(java.lang.String format, java.lang.Class<T> category, boolean allowed)
Implementation note: the current implementation assume that JAI codec class name start with "CLib". It work for Sun's 1.0 implementation, but may change in future versions. If this method doesn't recognize the class name, it does nothing.
format
- The format name (e.g. "png").category
- ImageReaderSpi.class
to set the reader, or
ImageWriterSpi.class
to set the writer.allowed
- false
to disallow native acceleration.public static javax.media.jai.RenderedOp tileImage(javax.media.jai.RenderedOp image) throws java.io.IOException
java.io.IOException
- If an I/O operation were required (in order to check if the image
were tiled on disk) and failed.public static void fill(java.awt.image.WritableRenderedImage image, java.lang.Number value)
image
- The image to fill.value
- The value to to given to every samples.public static boolean isMediaLibAvailable()
false
in case the JAI native libs are not in the path, true
otherwise.public static boolean isCLibAvailable()
false
in case the JAI/ImageIO native libs are not in the path, true
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |