Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class ColorLuts

  1. Object
  2. ColorLuts

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);
}

Fields

public static final int WIDTH = 256The strip’s width in pixels.
public static final int HEIGHT = 16The strip’s height in pixels.

Methods

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

Inherited methods

Field details

WIDTH

public static final int WIDTH = 256
The strip’s width in pixels.

HEIGHT

public static final int HEIGHT = 16
The strip’s height in pixels.

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 float
0 to 1, how far highlights and shadows are split
fade float
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 int
levels per channel, 2 to 16