Class FloatFilters.YCoCgFilter

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

public static class FloatFilters.YCoCgFilter
extends FloatFilter
Like FloatFilters.YCbCrFilter, but edits its input colors in YCoCg color space, or like FloatFilters.HSVFilter except it doesn't add, it multiplies. Most of the time you should prefer FloatFilters.YCbCrFilter as long as it isn't a performance bottleneck; this method is faster but less accurate. Y is luminance, ranging from 0 (dark) to 1 (light), and affects how bright the color is, but isn't very accurate perceptually. Co is Chrominance(orange) and Cg is Chrominance(green) (both range from -0.5 to 0.5), two inter-related channels that determine the hue and vividness of a specific color. When Co and Cg are both 0, the color is grayscale. When Co is 0.5 and Cg is -0.5, the color is red unless Y is very high or low. When Co is -0.5 and Cg is 0.5, the color is cyan with the same caveats re: Y. When Co and Cg are both -0.5, the color is blue (same caveats), and when both are 0.5, the color is yellow.
Valid values for Co and Cg are from -0.5 to 0.5 at the widest part of the range (it shrinks as Y approaches 0 or 1), but there aren't really invalid values here because this filter will clamp results with higher or lower channel values than a color can have. Each of yMul, coMul, and cgMul can have any float value, but yMul should be positive (unless you want this to only produce solid black). Similarly, coMul and cgMul will not produce meaningful results if they are very large (either positive or negative); it's recommended to use values between 0.0 and 1.0 for both if you want to desaturate colors or values somewhat greater than 1.0 to oversaturate them.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    float cgMul  
    float coMul  
    float yMul  
  • Constructor Summary

    Constructors 
    Constructor Description
    YCoCgFilter​(float luminanceMul, float orangeMul, float greenMul)  
  • 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

  • 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()