Package com.luciad.imaging.operator.util
Class TLcdColorLookupTable.Builder<B extends TLcdColorLookupTable.Builder<B>>
java.lang.Object
com.luciad.imaging.operator.util.TLcdColorLookupTable.Builder<B>
- Enclosing class:
TLcdColorLookupTable
public static class TLcdColorLookupTable.Builder<B extends TLcdColorLookupTable.Builder<B>>
extends Object
Builder for color lookup tables. The default table is
2x2x2
pixels with 8-bit color
components, uses linear interpolation and multiplies the opacity from the input and lookup
table color for the final result. The actual filter must be specified as either a ColorFilter
or a pixel buffer
.
For example to create a grey-scale filter:
TLcdColorLookupTable table = TLcdColorLookupTable.newBuilder().
filter(
new ILcdColorFilter() {
public void apply( float[] aRGBColorSFCT ) {
float lum = 0.2126f * aRGBColorSFCT[ 0 ] + 0.7152f * aRGBColorSFCT[ 1 ] + 0.0722f * aRGBColorSFCT[ 2 ];
aRGBColorSFCT[ 0 ] = aRGBColorSFCT[ 1 ] = aRGBColorSFCT[ 2 ] = lum;
}
}
).
build();
-
Method Summary
Modifier and TypeMethodDescriptionalphaMode
(TLcdColorLookupTable.AlphaMode aAlphaMode) Sets the mode use for the alpha channel.build()
Builds the color lookup table.componentType
(TLcdLookupTable.ComponentType aComponentType) Sets the type of the table's color components.filter
(ILcdColorFilter aColorFilter) Sets the table's entries from a color filter.Sets the table's entries directly from a buffer.interpolation
(ELcdInterpolationType aInterpolationType) Sets the interpolation type between table pixels.size
(int aWidth, int aHeight, int aDepth) Sets the size of the table.
-
Method Details
-
size
Sets the size of the table. Note that the size of the lookup table should be chosen carefully to avoid high memory usage and performance problems. Some typical sizes are:2x2x2
for a linear filter16x16x16
for a non-linear filter256x1x1
for a filter that only changes the red color channel
- Parameters:
aWidth
- the width of the tableaHeight
- the height of the tableaDepth
- the depth of the table- Returns:
- this builder
-
componentType
Sets the type of the table's color components. Typically a byte provides sufficient accuracy for rendering.- Parameters:
aComponentType
- the component type- Returns:
- this builder
-
interpolation
Sets the interpolation type between table pixels. Note that onlyNONE
andLINEAR
are currently supported.- Parameters:
aInterpolationType
- the interpolation type- Returns:
- this builder
-
alphaMode
Sets the mode use for the alpha channel.- Parameters:
aAlphaMode
- the alpha mode- Returns:
- this builder
-
filter
Sets the table's entries from a color filter.- Parameters:
aColorFilter
- the color filter- Returns:
- this builder
-
filter
Sets the table's entries directly from a buffer. The buffer should contain the appropriate number of bytes according to the tablesize
andcomponent type
. Each table entry has 4 components. SeeTLcdColorLookupTable
andTLcdLookupTable
for details.- Parameters:
aPixelData
- the pixel buffer- Returns:
- this builder
-
build
Builds the color lookup table.- Returns:
- the color lookup table
-