Class FloatFilters.YCbCrFilter

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

public static class FloatFilters.YCbCrFilter
extends FloatFilter
Like FloatFilters.HSVFilter, but edits its input colors in YCbCr color space, and multiplies rather than adds. Y is luma, and affects how bright the color is (luma 1 is white, luma 0 is black). Cb is Chroma(blue) amd Cr is Chroma(red), two inter-related channels that determine the hue and vividness of a specific color. When Cb and Cr are both 0, the color is grayscale. When Cb is 0.5 and Cr is -0.5, the color is blue unless Y is very high or low. When Cb is -0.5 and Cr is 0.5, the color is red with the same caveats re: Y. When Cb and Cr are both -0.5, the color is green (same caveats), and when both are 0.5, the color is purple. When Y is 0.5, Cb and Cr form a graph like this:

Valid values for Cb and Cr 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, cbMul, and crMul can have any float value, but yMul should be positive (unless you want this to only produce solid black). Similarly, cbMul and crMul 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 cbMul  
    float crMul  
    float yMul  
  • Constructor Summary

    Constructors 
    Constructor Description
    YCbCrFilter​(float yMul)  
    YCbCrFilter​(float yMul, float cbMul, float crMul)  
  • 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()