Class PaletteEntryForValue
- java.lang.Object
-
- org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntryForValue
-
- All Implemented Interfaces:
PaletteEntry
public class PaletteEntryForValue extends java.lang.Object implements PaletteEntry
Provides a palette entry for a color assignment to a single value. This class will assign a color to a value only if it is an exact match for the input. This class will also support Float.NaN
-
-
Constructor Summary
Constructors Constructor Description PaletteEntryForValue(float value, java.awt.Color color)
Constructs a palette entry for a single value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
coversSingleEntry()
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.java.awt.Color
getColor(float f)
Gets the color assignment associated with the input value.float
getLowerBound()
Gets the lower-bound value for the palette entryfloat
getUpperBound()
Gets the upper-bound value for the palette entryboolean
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.java.lang.String
toString()
-
-
-
Constructor Detail
-
PaletteEntryForValue
public PaletteEntryForValue(float value, java.awt.Color color)
Constructs a palette entry for a single value.This class will support color-assignments for Float.NaN.
- Parameters:
value
- the color value associated with this palette entry; a Float.NaN is allowed.color
- the color assigned to value
-
-
Method Detail
-
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 interfacePaletteEntry
- 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 interfacePaletteEntry
- Parameters:
f
- valid floating point value, or a NaN.- Returns:
- an integer value
-
getColor
public java.awt.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 interfacePaletteEntry
- 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 interfacePaletteEntry
- 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 interfacePaletteEntry
- 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 interfacePaletteEntry
- Returns:
- if defined, a valid floating point value; otherwise, a null.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-