Package squidpony.squidgrid.gui.gdx
Class FloatFilters.PaletteFilter
java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.PaletteFilter
- Enclosing class:
- FloatFilters
public static class FloatFilters.PaletteFilter extends FloatFilter
A FloatFilter that limits the colors it can return to a fixed palette, and won't return any colors that are
missing from that palette (although it can always return fully-transparent).
FloatFilters.PaletteReducerFilter
is also
an option; it uses more memory but is faster to look up colors in larger palettes (it has a maximum size of 256
colors, though, which this class doesn't).-
Field Summary
Fields Modifier and Type Field Description float[]
targets
-
Constructor Summary
Constructors Constructor Description PaletteFilter(float... targets)
Builds a PaletteFilter with an array of packed float colors that this will choose from.PaletteFilter(com.badlogic.gdx.graphics.Color[] targets)
Builds a PaletteFilter with an array of Color objects that this will choose from. -
Method Summary
Modifier and Type Method Description float
alter(float color)
Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.
-
Field Details
-
Constructor Details
-
PaletteFilter
Builds a PaletteFilter with an array of Color objects that this will choose from. The array will be converted to an array of packed float colors, and not referenced directly.- Parameters:
targets
- an array of libGDX Color objects; must not be null or empty
-
PaletteFilter
Builds a PaletteFilter with an array of packed float colors that this will choose from. The array will be referenced directly, not copied, so if you change the contents of targets, it will be reflected here.- Parameters:
targets
- an array or vararg of packed float colors; must not be null or empty
-
-
Method Details
-
alter
Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.- Specified by:
alter
in classFloatFilter
- Parameters:
color
- a packed float color, as produced byColor.toFloatBits()
- Returns:
- a packed float color, as produced by
Color.toFloatBits()
-