| java.lang.Object org.geotools.resources.image.ImageUtilities
ImageUtilities | final public class ImageUtilities (Code) | | 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.
since: 2.0 version: $Id: ImageUtilities.java 26890 2007-09-07 11:05:40Z desruisseaux $ author: Martin Desruisseaux author: Simone Giannecchini |
Method Summary | |
public static synchronized void | allowNativeCodec(String format, boolean writer, boolean allowed) Allows or disallows native acceleration for the specified image format. | public static ImageLayout | createIntersection(ImageLayout layout, List sources) Computes a new
ImageLayout which is the intersection of the specified
ImageLayout and all
RenderedImage s in the supplied list. | public static ImageLayout | getImageLayout(RenderedImage image) Suggests an
ImageLayout for the specified image. | public static String | getInterpolationName(Interpolation interp) Returns the interpolation name for the specified interpolation object. | public static RenderingHints | getRenderingHints(RenderedImage image) Suggests a set of
RenderingHints for the specified image. | public static RenderedOp | tileImage(RenderedOp image) Tiles the specified image. | public static Interpolation | toInterpolation(Object type) Casts the specified object to an
Interpolation object .
Parameters: type - The interpolation type as an Interpolation or a CharSequenceobject. | public static Dimension | toTileSize(Dimension size) Suggests a tile size for the specified image size. |
EXTEND_BORDER_BY_COPYING | final public static RenderingHints EXTEND_BORDER_BY_COPYING(Code) | | Cached instance of a
RenderingHints for controlling border extension on
JAI operations. It contains an instance of a
BorderExtenderCopy .
|
EXTEND_BORDER_BY_REFLECT | final public static RenderingHints EXTEND_BORDER_BY_REFLECT(Code) | | Cached instance of a
RenderingHints for controlling border extension on
JAI operations. It contains an instance of a
BorderExtenderReflect .
|
allowNativeCodec | public static synchronized void allowNativeCodec(String format, boolean writer, boolean allowed)(Code) | | Allows or disallows native acceleration for the specified image format. By default, the
image I/O extension for JAI provides native acceleration for PNG and JPEG. Unfortunatly,
those native codec has bug in their 1.0 version. Invoking this method will force the use
of standard codec provided in J2SE 1.4.
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.
Parameters: format - The format name (e.g. "png"). Parameters: writer - false to set the reader, or true to set the writer. Parameters: allowed - false to disallow native acceleration. |
createIntersection | public static ImageLayout createIntersection(ImageLayout layout, List sources)(Code) | | Computes a new
ImageLayout which is the intersection of the specified
ImageLayout and all
RenderedImage s in the supplied list. If the
ImageLayout.getMinX minX ,
ImageLayout.getMinY minY ,
ImageLayout.getWidth width and
ImageLayout.getHeight height properties are not defined in the
layout , then they will be inherited
from the first source for consistency with
OpImage constructor.
Parameters: layout - The original layout. This object will not be modified. Parameters: sources - The list of sources RenderedImage. A new ImageLayout , or the original layout if no change was needed. |
getImageLayout | public static ImageLayout getImageLayout(RenderedImage image)(Code) | | Suggests an
ImageLayout for the specified image. All parameters are initially set
equal to those of the given
RenderedImage , and then the
. This method never returns
null .
|
getInterpolationName | public static String getInterpolationName(Interpolation interp)(Code) | | Returns the interpolation name for the specified interpolation object.
This method tries to infer the name from the object's class name.
Parameters: Interpolation - The interpolation object. |
getRenderingHints | public static RenderingHints getRenderingHints(RenderedImage image)(Code) | | Suggests a set of
RenderingHints for the specified image.
The rendering hints may include the following parameters:
-
JAI.KEY_IMAGE_LAYOUT with a proposed tile size.
This method may returns
null if no rendering hints is proposed.
|
toInterpolation | public static Interpolation toInterpolation(Object type) throws IllegalArgumentException(Code) | | Casts the specified object to an
Interpolation object .
Parameters: type - The interpolation type as an Interpolation or a CharSequenceobject. The interpolation object for the specified type. throws: IllegalArgumentException - if the specified interpolation type is not a know one. |
toTileSize | public static Dimension toTileSize(Dimension size)(Code) | | Suggests a tile size for the specified image size. On input,
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 (
Dimension.width width or
Dimension.height height )
unchanged.
The
Dimension.width width and
Dimension.height 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
. 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:
- A suitable tile size is found. More specifically, a size is found which is a dividor
of the specified image size, and is the closest one of the default tile size. The
Dimension field (
width or
height ) is set to this value.
- An arbitrary limit (both a minimum and a maximum tile size) is reached. In this case,
this method may set the
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).
|
|
|