001package squidpony.squidgrid.gui.gdx; 002 003import com.badlogic.gdx.graphics.Color; 004import squidpony.IFilter; 005 006/** 007 * Like {@link IFilter}, but produces packed floats that encode colors instead of {@link Color} objects. 008 * Accepts packed float colors (as produced by {@link Color#toFloatBits()}, or given in SColor documentation) or Color 009 * objects (including {@link SColor} instances). 010 * <br> 011 * Created by Tommy Ettinger on 7/22/2018. 012 */ 013public abstract class FloatFilter { 014 /** 015 * Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited. 016 * @param color a packed float color, as produced by {@link Color#toFloatBits()} 017 * @return a packed float color, as produced by {@link Color#toFloatBits()} 018 */ 019 public abstract float alter(float color); 020 /** 021 * Takes a {@link Color} or subclass of Color (such as {@link SColor}, which is a little more efficient here) and 022 * produces a packed float color that this FloatFilter edited. 023 * @param color a {@link Color} or instance of a subclass such as {@link SColor} 024 * @return a packed float color, as produced by {@link Color#toFloatBits()} 025 */ 026 public float alter(Color color) 027 { 028 return alter(color.toFloatBits()); 029 } 030}