def applyGamma_video(n, g_r=GFACTOR, g_g=None, g_b=None, inplace=False):
    """ Approximates various invocations of FastLED's many-ways-overloaded
    applyGamma_video() function.

    ACCEPTS: One of three ways:
      1. A single brightness level (0-255) and optional gamma-correction
         factor (float usu. > 1.0, default if unspecified is 2.5).
      2. A single CRGB, CHSV or packed integer type and optional gamma
         factor or separate R, G, B gamma values.
      3. A list of CRGB, CHSV or packed integer types (and optional gamma(s)).

      In the tuple/list cases, the 'inplace' flag determines whether
      a new tuple/list is calculated and returned, or the existing
      value is modified in-place.  By default this is 'False'.
      Can also use the napplyGamma_video() function to more directly
      approximate FastLED syntax/behavior.

    RETURNS: Corresponding to above cases:
      1. Single gamma-corrected brightness level (0-255).
      2. A gamma-corrected CRGB value (even if input is CHSV or packed).
      3. A list of gamma-corrected CRGB values.

      In the tuple/list cases, there is NO return value if 'inplace'
      is true -- the original values are modified.
    """

    # If single gamma value is passed, keep that, otherwise convert
    # gamma values to tuple for gamma_adjust function.
    if g_g is not None and g_b is not None:
        g_r = (g_r, g_g, g_b)

    return fancy.gamma_adjust(n, g_r, inplace=inplace)
예제 #2
0
def applyGamma_video(n, g_r=GFACTOR, g_g=None, g_b=None, inplace=False):
    """ Approximates various invocations of FastLED's many-ways-overloaded
    applyGamma_video() function.

    ACCEPTS: One of three ways:
      1. A single brightness level (0-255) and optional gamma-correction
         factor (float usu. > 1.0, default if unspecified is 2.5).
      2. A single CRGB, CHSV or packed integer type and optional gamma
         factor or separate R, G, B gamma values.
      3. A list of CRGB, CHSV or packed integer types (and optional gamma(s)).

      In the tuple/list cases, the 'inplace' flag determines whether
      a new tuple/list is calculated and returned, or the existing
      value is modified in-place.  By default this is 'False'.
      Can also use the napplyGamma_video() function to more directly
      approximate FastLED syntax/behavior.

    RETURNS: Corresponding to above cases:
      1. Single gamma-corrected brightness level (0-255).
      2. A gamma-corrected CRGB value (even if input is CHSV or packed).
      3. A list of gamma-corrected CRGB values.

      In the tuple/list cases, there is NO return value if 'inplace'
      is true -- the original values are modified.
    """

    # If single gamma value is passed, keep that, otherwise convert
    # gamma values to tuple for gamma_adjust function.
    if g_g is not None and g_b is not None:
        g_r = (g_r, g_g, g_b)

    return fancy.gamma_adjust(n, g_r, inplace=inplace)