| java.lang.Object com.sun.media.jai.util.ImageUtil
ImageUtil | final public class ImageUtil (Code) | | |
Field Summary | |
final public static int | BYTE_MASK A constant used to extract a byte from a short or an int. | final public static int | USHORT_MASK A constant used to extract an unsigned short from an int. |
Method Summary | |
public boolean | areEqualSampleModels(SampleModel sm1, SampleModel sm2) Determines whether two SampleModels are "equal", i.e.,
assignment-compatible. | final public static byte | clampByte(int in) Clamps a number to the range supported by byte data type. | final public static byte | clampByteNegative(int in) Clamps a negative number to the range supported by byte data type. | final public static byte | clampBytePositive(int in) Clamps a positive number to the range supported by byte data type. | final public static float | clampFloat(double in) Clamps a number to the range supported by float data type. | final public static int | clampInt(long in) Clamps a number to the range supported by integer data type. | final public static byte | clampRoundByte(float in) Clamps and rounds a number to the range supported by
byte data type. | final public static byte | clampRoundByte(double in) Clamps and rounds a number to the range supported by
byte data type. | final public static int | clampRoundInt(float in) Clamps and rounds a number to the range supported by
integer data type. | final public static int | clampRoundInt(double in) Clamps and rounds a number to the range supported by
integer data type. | final public static short | clampRoundShort(float in) Clamps and rounds a number to the range supported by
short data type. | final public static short | clampRoundShort(double in) Clamps and rounds a number to the range supported by
short data type. | final public static short | clampRoundUShort(float in) Clamps and rounds a number to the range supported by
unsigned short data type. | final public static short | clampRoundUShort(double in) Clamps and rounds a number to the range supported by
unsigned short data type. | final public static short | clampShort(int in) Clamps a number to the range supported by short data type. | final public static short | clampUShort(int in) Clamps a number to the range supported by unsigned short data type. | final public static short | clampUShortNegative(int in) | final public static short | clampUShortPositive(int in) Clamps a positive number to the range supported by
unsigned short data type. | final public static void | copyRaster(RasterAccessor src, RasterAccessor dst) | public static Vector | evaluateParameters(Vector parameters) If any DeferredData components are detected,
the argument is cloned and the DeferredData
object is replaced with what its getData() returns. | public static ParameterBlock | evaluateParameters(ParameterBlock pb) If any DeferredData parameters are detected,
a new ParameterBlock is constructed and the
DeferredData object is replaced with what its
getData() returns. | public static void | fillBackground(WritableRaster raster, Rectangle rect, double[] backgroundValues) Fill the specified rectangle of raster with the provided
background values. | public static void | fillBordersWithBackgroundValues(Rectangle outerRect, Rectangle innerRect, WritableRaster raster, double[] backgroundValues) When the destination rectangle is not the same as the image bounds,
should fill the border. | public static synchronized Object | generateID(Object owner) Generates a UID for the provided Object .
The counter for the objects that request an ID, the hashcode of the
class of the provided object, the hashcode of the provided object,
the current time in milli seconds, and a random number are
concatenated together in a BigInteger . | public static ColorModel | getCompatibleColorModel(SampleModel sm, Map config) Derive a compatible ColorModel for the supplied
SampleModel using the method specified via the
OpImage configuration Map . | public static ImagingListener | getImagingListener(RenderingHints hints) | public static ImagingListener | getImagingListener(RenderContext context) | public static byte[] | getPackedBinaryData(Raster raster, Rectangle rect) For the case of binary data (isBinary() returns
true ), return the binary data as a packed byte array.
The data will be packed as eight bits per byte with no bit offset,
i.e., the first bit in each image line will be the left-most of the
first byte of the line. | public static String | getStackTraceString(Exception e) Converts the supplied Exception 's stack trace
to a String . | final public static Point[] | getTileIndices(int txmin, int txmax, int tymin, int tymax) Retrieve the indices of a set of tiles in row-major order with
the given tile index bounds in x and y. | public static byte[] | getUnpackedBinaryData(Raster raster, Rectangle rect) Returns the binary data unpacked into an array of bytes. | public static KernelJAI | getUnsharpMaskEquivalentKernel(KernelJAI kernel, float gain) Given a kernel and the gain (sharpness) factor of an
UnsharpMask operation, compute a modified kernel that
would be equivalent to the specified unsharp operation.
for UnsharpMask function we have the following formula:
dst(i,j) = src(i,j) + gain *
(src(i,j) - SUM SUM K(l,m) * src(i+l,j+m))
l m
Which can be written as :
dst(i,j) = SUM SUM Q(l,m) * src(i+l,j+m),
l m
where Q(0,0) = 1 + gain * (1 - K(0,0)), and
Q(l,m) = - gain * K(l,m) otherwise
Parameters: kernel - the unsharp mask kernel Parameters: gain - the unsharp mask gain (sharpness) factor. | public static boolean | isBinary(SampleModel sm) Check whether a SampleModel represents a binary
data set, i.e., a single band of data with one bit per pixel
packed into a MultiPixelPackedSampleModel . | static void | sendExceptionToListener(String message, Exception e) | public static void | setPackedBinaryData(byte[] binaryDataArray, WritableRaster raster, Rectangle rect) Sets the supplied Raster 's data from an array
of packed binary data of the form returned by
getPackedBinaryData() . | public static void | setUnpackedBinaryData(byte[] bdata, WritableRaster raster, Rectangle rect) Copies data into the packed array of the Raster
from an array of unpacked data of the form returned by
getUnpackedBinaryData() . |
BYTE_MASK | final public static int BYTE_MASK(Code) | | A constant used to extract a byte from a short or an int.
|
USHORT_MASK | final public static int USHORT_MASK(Code) | | A constant used to extract an unsigned short from an int.
|
areEqualSampleModels | public boolean areEqualSampleModels(SampleModel sm1, SampleModel sm2)(Code) | | Determines whether two SampleModels are "equal", i.e.,
assignment-compatible. This signifies that the two SampleModels
are either the very same object or are two different objects
with identical characteristics.
|
clampByte | final public static byte clampByte(int in)(Code) | | Clamps a number to the range supported by byte data type.
|
clampByteNegative | final public static byte clampByteNegative(int in)(Code) | | Clamps a negative number to the range supported by byte data type.
|
clampBytePositive | final public static byte clampBytePositive(int in)(Code) | | Clamps a positive number to the range supported by byte data type.
|
clampFloat | final public static float clampFloat(double in)(Code) | | Clamps a number to the range supported by float data type.
|
clampInt | final public static int clampInt(long in)(Code) | | Clamps a number to the range supported by integer data type.
|
clampRoundByte | final public static byte clampRoundByte(float in)(Code) | | Clamps and rounds a number to the range supported by
byte data type. The input number is float.
|
clampRoundByte | final public static byte clampRoundByte(double in)(Code) | | Clamps and rounds a number to the range supported by
byte data type. The input number is double.
|
clampRoundInt | final public static int clampRoundInt(float in)(Code) | | Clamps and rounds a number to the range supported by
integer data type. The input number is float.
|
clampRoundInt | final public static int clampRoundInt(double in)(Code) | | Clamps and rounds a number to the range supported by
integer data type. The input number is double.
|
clampRoundShort | final public static short clampRoundShort(float in)(Code) | | Clamps and rounds a number to the range supported by
short data type. The input number is float.
|
clampRoundShort | final public static short clampRoundShort(double in)(Code) | | Clamps and rounds a number to the range supported by
short data type. The input number is double.
|
clampRoundUShort | final public static short clampRoundUShort(float in)(Code) | | Clamps and rounds a number to the range supported by
unsigned short data type. The input number is float.
|
clampRoundUShort | final public static short clampRoundUShort(double in)(Code) | | Clamps and rounds a number to the range supported by
unsigned short data type. The input number is double.
|
clampShort | final public static short clampShort(int in)(Code) | | Clamps a number to the range supported by short data type.
|
clampUShort | final public static short clampUShort(int in)(Code) | | Clamps a number to the range supported by unsigned short data type.
|
clampUShortNegative | final public static short clampUShortNegative(int in)(Code) | | |
clampUShortPositive | final public static short clampUShortPositive(int in)(Code) | | Clamps a positive number to the range supported by
unsigned short data type.
|
evaluateParameters | public static Vector evaluateParameters(Vector parameters)(Code) | | If any DeferredData components are detected,
the argument is cloned and the DeferredData
object is replaced with what its getData() returns.
|
evaluateParameters | public static ParameterBlock evaluateParameters(ParameterBlock pb)(Code) | | If any DeferredData parameters are detected,
a new ParameterBlock is constructed and the
DeferredData object is replaced with what its
getData() returns.
|
fillBackground | public static void fillBackground(WritableRaster raster, Rectangle rect, double[] backgroundValues)(Code) | | Fill the specified rectangle of raster with the provided
background values. Suppose the raster is initialized to 0. Thus,
for binary data, if the provided background values are 0, do nothing.
|
fillBordersWithBackgroundValues | public static void fillBordersWithBackgroundValues(Rectangle outerRect, Rectangle innerRect, WritableRaster raster, double[] backgroundValues)(Code) | | When the destination rectangle is not the same as the image bounds,
should fill the border.
|
generateID | public static synchronized Object generateID(Object owner)(Code) | | Generates a UID for the provided Object .
The counter for the objects that request an ID, the hashcode of the
class of the provided object, the hashcode of the provided object,
the current time in milli seconds, and a random number are
concatenated together in a BigInteger . This
BigInteger is returned as the unique ID.
|
getCompatibleColorModel | public static ColorModel getCompatibleColorModel(SampleModel sm, Map config)(Code) | | Derive a compatible ColorModel for the supplied
SampleModel using the method specified via the
OpImage configuration Map .
a compatible ColorModel or null . |
getPackedBinaryData | public static byte[] getPackedBinaryData(Raster raster, Rectangle rect)(Code) | | For the case of binary data (isBinary() returns
true ), return the binary data as a packed byte array.
The data will be packed as eight bits per byte with no bit offset,
i.e., the first bit in each image line will be the left-most of the
first byte of the line. The line stride in bytes will be
(int)((getWidth()+7)/8) . The length of the returned
array will be the line stride multiplied by getHeight()
the binary data as a packed array of bytes with zero offsetof null if the data are not binary. throws: IllegalArgumentException - if isBinary() returnsfalse with the SampleModel of thesupplied Raster as argument. |
getStackTraceString | public static String getStackTraceString(Exception e)(Code) | | Converts the supplied Exception 's stack trace
to a String .
|
getTileIndices | final public static Point[] getTileIndices(int txmin, int txmax, int tymin, int tymax)(Code) | | Retrieve the indices of a set of tiles in row-major order with
the given tile index bounds in x and y.
|
getUnpackedBinaryData | public static byte[] getUnpackedBinaryData(Raster raster, Rectangle rect)(Code) | | Returns the binary data unpacked into an array of bytes.
The line stride will be the width of the Raster .
throws: IllegalArgumentException - if isBinary() returnsfalse with the SampleModel of thesupplied Raster as argument. |
getUnsharpMaskEquivalentKernel | public static KernelJAI getUnsharpMaskEquivalentKernel(KernelJAI kernel, float gain)(Code) | | Given a kernel and the gain (sharpness) factor of an
UnsharpMask operation, compute a modified kernel that
would be equivalent to the specified unsharp operation.
for UnsharpMask function we have the following formula:
dst(i,j) = src(i,j) + gain *
(src(i,j) - SUM SUM K(l,m) * src(i+l,j+m))
l m
Which can be written as :
dst(i,j) = SUM SUM Q(l,m) * src(i+l,j+m),
l m
where Q(0,0) = 1 + gain * (1 - K(0,0)), and
Q(l,m) = - gain * K(l,m) otherwise
Parameters: kernel - the unsharp mask kernel Parameters: gain - the unsharp mask gain (sharpness) factor. an equivalent convolution KernelJAI |
isBinary | public static boolean isBinary(SampleModel sm)(Code) | | Check whether a SampleModel represents a binary
data set, i.e., a single band of data with one bit per pixel
packed into a MultiPixelPackedSampleModel .
|
setPackedBinaryData | public static void setPackedBinaryData(byte[] binaryDataArray, WritableRaster raster, Rectangle rect)(Code) | | Sets the supplied Raster 's data from an array
of packed binary data of the form returned by
getPackedBinaryData() .
throws: IllegalArgumentException - if isBinary() returnsfalse with the SampleModel of thesupplied Raster as argument. |
setUnpackedBinaryData | public static void setUnpackedBinaryData(byte[] bdata, WritableRaster raster, Rectangle rect)(Code) | | Copies data into the packed array of the Raster
from an array of unpacked data of the form returned by
getUnpackedBinaryData() .
If the data are binary, then the target bit will be set if
and only if the corresponding byte is non-zero.
throws: IllegalArgumentException - if isBinary() returnsfalse with the SampleModel of thesupplied Raster as argument. |
|
|