Class FloatFilters.MultiLerpFilter

java.lang.Object
squidpony.squidgrid.gui.gdx.FloatFilter
squidpony.squidgrid.gui.gdx.FloatFilters.MultiLerpFilter
Enclosing class:
FloatFilters

public static class FloatFilters.MultiLerpFilter
extends FloatFilter
A FloatFilter that linearly interpolates (lerps) any color it is given toward the most-similar of a group of given colors. Uses SColor.lerpFloatColorsBlended(float, float, float) to mix a requested color with the chosen target color, and this means the alpha of the target color affects the amount of change instead of the resulting alpha. Changing the alpha of the colors this is given can be done easily with SColor.translucentColor(float, float), and this allows you to specify varying amounts to mix by.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    float amount  
    float[] targets  
  • Constructor Summary

    Constructors 
    Constructor Description
    MultiLerpFilter​(float amount, float... targets)
    Builds a MultiLerpFilter with an array of packed float colors and an amount as a float.
    MultiLerpFilter​(float amount, com.badlogic.gdx.graphics.Color[] targets)
    Builds a MultiLerpFilter with an array of Color objects (which will be converted to an array of packed float colors) and an amount as a float.
  • 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.

    Methods inherited from class squidpony.squidgrid.gui.gdx.FloatFilter

    alter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MultiLerpFilter

      public MultiLerpFilter​(float amount, com.badlogic.gdx.graphics.Color[] targets)
      Builds a MultiLerpFilter with an array of Color objects (which will be converted to an array of packed float colors) and an amount as a float. The amount is how much the target colors will affect input colors, from 0f to 1f. If a target color has an alpha component that is less than 1, then amount is effectively multiplied by that alpha. If you want to edit the alpha without duplicating Color objects, you can use SColor.translucentColor(Color, float) to make a float array to pass to MultiLerpFilter(float, float...).
      Parameters:
      amount - a float that determines how much target will affect an input color; will be clamped between 0f and 1f
      targets - an array of libGDX Color objects; must not be null or empty
    • MultiLerpFilter

      public MultiLerpFilter​(float amount, float... targets)
      Builds a MultiLerpFilter with an array of packed float colors and an amount as a float. The amount is how much the target color will affect input colors, from 0f to 1f. If the target color has an alpha component that is less than 1, then amount is effectively multiplied by that alpha.
      Parameters:
      amount - a float that determines how much target will affect an input color; will be clamped between 0f and 1f
      targets - an array or vararg of packed float colors; must not be null or empty
  • Method Details

    • alter

      public float alter​(float color)
      Takes a packed float color and produces a potentially-different packed float color that this FloatFilter edited.
      Specified by:
      alter in class FloatFilter
      Parameters:
      color - a packed float color, as produced by Color.toFloatBits()
      Returns:
      a packed float color, as produced by Color.toFloatBits()