java.lang.Object
org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntryForRange
All Implemented Interfaces:
PaletteEntry

public class PaletteEntryForRange extends Object implements PaletteEntry
Provides a palette entry for colors associated with a range of values. The return value will be interpolated between the minimum and maximum value for this entry.

In keeping with the conventions of many Geographic Information Systems (GIS) and art applications, this instance "covered" values in the range v0 ≤ f < v1. Thus, a value that exactly matches the upper bound of the range is not considered "covered".

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
    private final float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PaletteEntryForRange(float v0, float v1, Color color)
    Constructs a palette entry for the range of values v0 ≤ f < v1.
    PaletteEntryForRange(float v0, float v1, Color color0, Color color1)
    Constructs a palette entry for the range of values v0 ≤ f < v1.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates that the entry covers exactly one unique value (including, potentially, Float.NaN).
    int
    getARGB(float f)
    Gets the integer ARGB color assignment associated with the input value.
    getColor(float f)
    Gets the color assignment associated with the input value.
    float
    Gets the lower-bound value for the palette entry
    float
    Gets the upper-bound value for the palette entry
    boolean
    isCovered(float f)
    Indicates whether the indicated floating-point value is within the range covered by this palette entry and can be assigned a valid color by the implementation.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • v0

      private final float v0
    • v1

      private final float v1
    • r0

      private final float r0
    • r1

      private final float r1
    • g0

      private final float g0
    • g1

      private final float g1
    • b0

      private final float b0
    • b1

      private final float b1
    • a0

      private final float a0
    • a1

      private final float a1
  • Constructor Details

    • PaletteEntryForRange

      public PaletteEntryForRange(float v0, float v1, Color color0, Color color1)
      Constructs a palette entry for the range of values v0 ≤ f < v1. The return color value will be interpolated between the two specified colors.
      Parameters:
      v0 - the lower bounds (inclusive) of the covered range of values
      v1 - the upper bounds (non-inclusive) of the covered range of value
      color0 - the color assigned to value v0
      color1 - the color assigned to value v1
    • PaletteEntryForRange

      public PaletteEntryForRange(float v0, float v1, Color color)
      Constructs a palette entry for the range of values v0 ≤ f < v1. A single color will be returned for all values in range
      Parameters:
      v0 - the lower bounds (inclusive) of the covered range of values
      v1 - the upper bounds (non-inclusive) of the covered range of value
      color - the color assigned to value v0
  • Method Details

    • isCovered

      public boolean isCovered(float f)
      Description copied from interface: PaletteEntry
      Indicates whether the indicated floating-point value is within the range covered by this palette entry and can be assigned a valid color by the implementation.
      Specified by:
      isCovered in interface PaletteEntry
      Parameters:
      f - a valid floating point value, or a NaN.
      Returns:
      true if the entry can assign a color to the entry; otherwise, false.
    • getARGB

      public int getARGB(float f)
      Description copied from interface: PaletteEntry
      Gets the integer ARGB color assignment associated with the input value. If the input value is not within the covered range of this instance, the return value is undefined (though the value zero is often used).
      Specified by:
      getARGB in interface PaletteEntry
      Parameters:
      f - valid floating point value, or a NaN.
      Returns:
      an integer value
    • getColor

      public Color getColor(float f)
      Description copied from interface: PaletteEntry
      Gets the color assignment associated with the input value. If the input value is not within the covered range of this instance, the return value is undefined (though a null return is often used).
      Specified by:
      getColor in interface PaletteEntry
      Parameters:
      f - a valid floating point value, or a NaN.
      Returns:
      a valid color instance or, potentially, a null if the floating point input is not within the covered range.
    • coversSingleEntry

      public boolean coversSingleEntry()
      Description copied from interface: PaletteEntry
      Indicates that the entry covers exactly one unique value (including, potentially, Float.NaN).
      Specified by:
      coversSingleEntry in interface PaletteEntry
      Returns:
      true if the entry covers exactly one unique value
    • getLowerBound

      public float getLowerBound()
      Description copied from interface: PaletteEntry
      Gets the lower-bound value for the palette entry
      Specified by:
      getLowerBound in interface PaletteEntry
      Returns:
      if defined, a valid floating point value; otherwise, a null.
    • getUpperBound

      public float getUpperBound()
      Description copied from interface: PaletteEntry
      Gets the upper-bound value for the palette entry
      Specified by:
      getUpperBound in interface PaletteEntry
      Returns:
      if defined, a valid floating point value; otherwise, a null.
    • toString

      public String toString()
      Overrides:
      toString in class Object