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 Details

    • size

      public B size(int aWidth, int aHeight, int aDepth)
      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 filter
      • 16x16x16 for a non-linear filter
      • 256x1x1 for a filter that only changes the red color channel
      Parameters:
      aWidth - the width of the table
      aHeight - the height of the table
      aDepth - the depth of the table
      Returns:
      this builder
    • componentType

      public B componentType(TLcdLookupTable.ComponentType aComponentType)
      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

      public B interpolation(ELcdInterpolationType aInterpolationType)
      Sets the interpolation type between table pixels. Note that only NONE and LINEAR are currently supported.
      Parameters:
      aInterpolationType - the interpolation type
      Returns:
      this builder
    • alphaMode

      public B alphaMode(TLcdColorLookupTable.AlphaMode aAlphaMode)
      Sets the mode use for the alpha channel.
      Parameters:
      aAlphaMode - the alpha mode
      Returns:
      this builder
    • filter

      public B filter(ILcdColorFilter aColorFilter)
      Sets the table's entries from a color filter.
      Parameters:
      aColorFilter - the color filter
      Returns:
      this builder
    • filter

      public B filter(Buffer aPixelData)
      Sets the table's entries directly from a buffer.

      The buffer should contain the appropriate number of bytes according to the table size and component type. Each table entry has 4 components. See TLcdColorLookupTable and TLcdLookupTable for details.

      Parameters:
      aPixelData - the pixel buffer
      Returns:
      this builder
    • build

      public TLcdColorLookupTable build()
      Builds the color lookup table.
      Returns:
      the color lookup table