Package squidpony.squidgrid.gui.gdx
Class FloatFilters.GrayscaleFilter
java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.GrayscaleFilter
- Enclosing class:
- FloatFilters
public static class FloatFilters.GrayscaleFilter extends FloatFilter
A FloatFilter that makes all colors given to it grayscale, using only their luma as calculated by
SColor.lumaOfFloat(float)
as the lightness (it does also preserve alpha transparency).-
Constructor Summary
Constructors Constructor Description GrayscaleFilter()
-
Method Summary
Modifier and Type Method Description float
alter(float color)
Takes a packed float color and produces a grayscale packed float color that this FloatFilter edited.
-
Constructor Details
-
GrayscaleFilter
public GrayscaleFilter()
-
-
Method Details
-
alter
Takes a packed float color and produces a grayscale packed float color that this FloatFilter edited. Uses the luma calculation fromSColor.lumaOfFloat(float)
instead of the value calculation fromSColor.valueOfFloat(float)
; luma tends to be more visually-accurate on modern monitors.- 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()
-