java.awt.image

Class ShortLookupTable

public class ShortLookupTable extends LookupTable

ShortLookupTable represents translation arrays for pixel values. It wraps one or more data arrays for each layer (or component) in an image, such as Alpha, R, G, and B. When doing translation, the offset is subtracted from the pixel values to allow a subset of an array to be used.
Constructor Summary
ShortLookupTable(int offset, short[][] data)
Creates a new ShortLookupTable instance.
ShortLookupTable(int offset, short[] data)
Creates a new ShortLookupTable instance.
Method Summary
short[][]getTable()
Return the lookup tables.
int[]lookupPixel(int[] src, int[] dst)
Return translated values for a pixel.
short[]lookupPixel(short[] src, short[] dst)
Return translated values for a pixel.

Constructor Detail

ShortLookupTable

public ShortLookupTable(int offset, short[][] data)
Creates a new ShortLookupTable instance. Offset is subtracted from pixel values when looking up in the translation tables. If data.length is one, the same table is applied to all pixel components.

Parameters: offset Offset to be subtracted. data Array of lookup tables.

Throws: IllegalArgumentException if offset < 0 or data.length < 1.

ShortLookupTable

public ShortLookupTable(int offset, short[] data)
Creates a new ShortLookupTable instance. Offset is subtracted from pixel values when looking up in the translation table. The same table is applied to all pixel components.

Parameters: offset Offset to be subtracted. data Lookup table for all components (null not permitted).

Throws: IllegalArgumentException if offset < 0.

Method Detail

getTable

public final short[][] getTable()
Return the lookup tables. This is a reference to the actual table, so modifying the contents of the returned array will modify the lookup table.

Returns: The lookup table.

lookupPixel

public int[] lookupPixel(int[] src, int[] dst)
Return translated values for a pixel. For each value in the pixel src, use the value minus offset as an index in the component array and copy the value there to the output for the component. If dest is null, the output is a new array, otherwise the translated values are written to dest. Dest can be the same array as src. For example, if the pixel src is [2, 4, 3], and offset is 1, the output is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the translation arrays.

Parameters: src Component values of a pixel. dst Destination array for values, or null.

Returns: Translated values for the pixel.

lookupPixel

public short[] lookupPixel(short[] src, short[] dst)
Return translated values for a pixel. For each value in the pixel src, use the value minus offset as an index in the component array and copy the value there to the output for the component. If dest is null, the output is a new array, otherwise the translated values are written to dest. Dest can be the same array as src. For example, if the pixel src is [2, 4, 3], and offset is 1, the output is [comp1[1], comp2[3], comp3[2]], where comp1, comp2, and comp3 are the translation arrays.

Parameters: src Component values of a pixel. dst Destination array for values, or null.

Returns: Translated values for the pixel.