org.geotools.image.jai
Class Registry

Object
  extended by Registry

public final class Registry
extends Object

A set of static methods for managing JAI's operation registry.

Since:
2.2
Author:
Martin Desruisseaux (IRD), Andrea Aime - GeoSolutions

Field Summary
static String GEOTOOLS_PRODUCT
          The GeoTools product name (used to register operations in JAI)
static String JAI_TOOLS_PRODUCT
          The JAITools product name (used to register operations in JAI)
 
Method Summary
static boolean registerRIF(JAI jai, OperationDescriptor descriptor, RenderedImageFactory rif, String productName)
          Forcefully registers the specified rendered operation in the JAI registry
static boolean registerRIF(JAI jai, OperationDescriptor descriptor, String name, ContextualRenderedImageFactory crif)
          Register the "SampleTranscode" image operation to the operation registry of the specified JAI instance.
static void setNativeAccelerationAllowed(String operation, boolean allowed)
          Allows or disallow native acceleration for the specified operation on the default JAI instance.
static void setNativeAccelerationAllowed(String operation, boolean allowed, JAI jai)
          Allows or disallow native acceleration for the specified operation on the given JAI instance.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAI_TOOLS_PRODUCT

public static final String JAI_TOOLS_PRODUCT
The JAITools product name (used to register operations in JAI)

See Also:
Constant Field Values

GEOTOOLS_PRODUCT

public static final String GEOTOOLS_PRODUCT
The GeoTools product name (used to register operations in JAI)

See Also:
Constant Field Values
Method Detail

setNativeAccelerationAllowed

public static void setNativeAccelerationAllowed(String operation,
                                                boolean allowed,
                                                JAI jai)
Allows or disallow native acceleration for the specified operation on the given JAI instance. By default, JAI uses hardware accelerated methods when available. For example, it make use of MMX instructions on Intel processors. Unfortunatly, some native method crash the Java Virtual Machine under some circonstances. For example on JAI 1.1.2, the "Affine" operation on an image with float data type, bilinear interpolation and an ImageLayout rendering hint cause an exception in medialib native code. Disabling the native acceleration (i.e using the pure Java version) is a convenient workaround until Sun fix the bug.

Implementation note: the current implementation assumes that factories for native implementations are declared in the com.sun.media.jai.mlib package, while factories for pure java implementations are declared in the com.sun.media.jai.opimage package. It work for Sun's 1.1.2 implementation, but may change in future versions. If this method doesn't recognize the package, it does nothing.

Parameters:
operation - The operation name (e.g. "Affine").
allowed - false to disallow native acceleration.
jai - The instance of JAI we are going to work on. This argument can be omitted for the default JAI instance.
Since:
2.5
See Also:
JAI bug report 4906854

setNativeAccelerationAllowed

public static void setNativeAccelerationAllowed(String operation,
                                                boolean allowed)
Allows or disallow native acceleration for the specified operation on the default JAI instance. This method is a shortcut for setNativeAccelerationAllowed(operation, allowed, JAI.getDefaultInstance()).

See Also:
setNativeAccelerationAllowed(String, boolean, JAI)

registerRIF

public static boolean registerRIF(JAI jai,
                                  OperationDescriptor descriptor,
                                  String name,
                                  ContextualRenderedImageFactory crif)
Register the "SampleTranscode" image operation to the operation registry of the specified JAI instance. This method is invoked by the static initializer of GridSampleDimension.

Parameters:
jai - is he JAI instance in which we ant to register this operation.
descriptor - is the OperationDescriptor for the JAI operation to register.
name - is the name of the operation to register.
crif - is the rendered image facotry for this operation.
Returns:
true if everything goes well, false otherwise.

registerRIF

public static boolean registerRIF(JAI jai,
                                  OperationDescriptor descriptor,
                                  RenderedImageFactory rif,
                                  String productName)
Forcefully registers the specified rendered operation in the JAI registry

Parameters:
descriptor -
rif -
productName -
Returns:
true if the registration succeded, false if the registration was not required as the operation was already available in the registry


Copyright © 1996-2014 Geotools. All Rights Reserved.