Class ColorLuts

java.lang.Object
com.codename1.gpu.ColorLuts

public final class ColorLuts extends Object

Builds colour lookup strips for PostProcess.setColorLut. Each method returns the 256 by 16 ARGB pixels; upload them with GraphicsDevice.createTexture(ColorLuts.WIDTH, ColorLuts.HEIGHT, pixels).

import com.codename1.gpu.*;

void grade(GraphicsDevice device, PostProcess post) {
    Texture look = device.createTexture(ColorLuts.WIDTH, ColorLuts.HEIGHT,
            ColorLuts.filmic(0.6f, 0.15f));
    post.setColorLut(look, 1f);
}
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The strip's height in pixels.
    static final int
    The strip's width in pixels.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[]
    filmic(float warmth, float fade)
    Returns a film look: warm highlights, cool shadows and lifted blacks.
    static int[]
    Returns the table that changes nothing, a starting point to edit.
    static int[]
    posterize(int levels)
    Returns a table that snaps every channel to a few levels, for a poster or cel look.

    Methods inherited from class Object

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

  • Method Details

    • identity

      public static int[] identity()
      Returns the table that changes nothing, a starting point to edit.
    • filmic

      public static int[] filmic(float warmth, float fade)

      Returns a film look: warm highlights, cool shadows and lifted blacks.

      Parameters
      • warmth: 0 to 1, how far highlights and shadows are split

      • fade: 0 to 0.3, how far black is lifted

    • posterize

      public static int[] posterize(int levels)

      Returns a table that snaps every channel to a few levels, for a poster or cel look.

      Parameters
      • levels: levels per channel, 2 to 16