Package squidpony.squidgrid.gui.gdx
Class FloatFilters.PaletteReducerFilter
java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.PaletteReducerFilter
- Enclosing class:
- FloatFilters
public static class FloatFilters.PaletteReducerFilter extends FloatFilter
A FloatFilter that limits the colors it can return to a fixed palette as determined by a
PaletteReducer
,
and won't return any colors that are missing from that palette (although it can always return fully-transparent).
This is like FloatFilters.PaletteFilter
but trades off memory usage (it uses about 33KB to store a large-ish lookup
table) to improve speed on large palettes. This can't use a palette larger than 256 colors (including transparent
almost always).-
Field Summary
Fields Modifier and Type Field Description com.github.tommyettinger.anim8.PaletteReducer
reducer
-
Constructor Summary
Constructors Constructor Description PaletteReducerFilter()
Builds a PaletteReducerFilter that will use the 256-color (including transparent) DawnBringer Aurora palette.PaletteReducerFilter(com.badlogic.gdx.graphics.Color... targets)
Builds a PaletteReducerFilter with an array or vararg of libGDX colors (at most 256 colors, and often starting with a transparent color) that this will choose from.PaletteReducerFilter(com.github.tommyettinger.anim8.PaletteReducer palette)
Builds a PaletteReducerFilter with the given PaletteReducer, which will be referenced without copying. -
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
-
PaletteReducerFilter
public PaletteReducerFilter()Builds a PaletteReducerFilter that will use the 256-color (including transparent) DawnBringer Aurora palette. -
PaletteReducerFilter
Builds a PaletteReducerFilter with the given PaletteReducer, which will be referenced without copying. You can callPaletteReducer.exact(Color[])
or other similar methods before this filter is used to set up the palette, and this is often done before the PaletteReducer is passed here.- Parameters:
palette
- a PaletteReducer that should have the desired palette set up before this is used
-
PaletteReducerFilter
Builds a PaletteReducerFilter with an array or vararg of libGDX colors (at most 256 colors, and often starting with a transparent color) that this will choose from. The array will have its contents read but will not be held onto, so later changes won't affect it.- Parameters:
targets
- an array or vararg of libGDX colors; must not be null
-
-
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()
-