java.awt.image

Class ByteLookupTable

public class ByteLookupTable extends LookupTable

ByteLookupTable 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
ByteLookupTable(int offset, byte[][] data)
Creates a new ByteLookupTable instance.
ByteLookupTable(int offset, byte[] data)
Creates a new ByteLookupTable instance.
Method Summary
byte[][]getTable()
Return the lookup tables.
int[]lookupPixel(int[] src, int[] dst)
Return translated values for a pixel.
byte[]lookupPixel(byte[] src, byte[] dst)
Return translated values for a pixel.

Constructor Detail

ByteLookupTable

public ByteLookupTable(int offset, byte[][] data)
Creates a new ByteLookupTable 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 (null not permitted).

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

ByteLookupTable

public ByteLookupTable(int offset, byte[] data)
Creates a new ByteLookupTable 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 byte[][] getTable()
Return the lookup tables.

Returns: the tables

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 byte[] lookupPixel(byte[] src, byte[] 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.