Android APIs
public final class

TonemapCurve

extends Object
java.lang.Object
   ↳ android.hardware.camera2.params.TonemapCurve

Class Overview

Immutable class for describing a 2 x M x 3 tonemap curve of floats.

This defines red, green, and blue curves that the CameraDevice will use as the tonemapping/contrast/gamma curve when TONEMAP_MODE is set to TONEMAP_MODE_CONTRAST_CURVE.

The total number of points (Pin, Pout) for each color channel can be no more than TONEMAP_MAX_CURVE_POINTS.

The coordinate system for each point is within the inclusive range [.LEVEL_BLACK, .LEVEL_WHITE].

Summary

Constants
int CHANNEL_BLUE Index of the blue color channel curve.
int CHANNEL_GREEN Index of the green color channel curve.
int CHANNEL_RED Index of the red color channel curve.
float LEVEL_BLACK Lower bound tonemap value corresponding to pure black for a single color channel.
float LEVEL_WHITE Upper bound tonemap value corresponding to a pure white for a single color channel.
int POINT_SIZE Number of elements in a (Pin, Pout) point;
Public Constructors
TonemapCurve(float[] red, float[] green, float[] blue)
Create a new immutable TonemapCurve instance.
Public Methods
void copyColorCurve(int colorChannel, float[] destination, int offset)
Copy the color curve for a single color channel from this tonemap curve into the destination.
boolean equals(Object obj)
Check if this TonemapCurve is equal to another TonemapCurve.
PointF getPoint(int colorChannel, int index)
Get the point for a color channel at a specified index.
int getPointCount(int colorChannel)
Get the number of points stored in this tonemap curve for the specified color channel.
int hashCode()
Returns an integer hash code for this object.
String toString()
Return the TonemapCurve as a string representation.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CHANNEL_BLUE

Added in API level 21

Index of the blue color channel curve.

Constant Value: 2 (0x00000002)

public static final int CHANNEL_GREEN

Added in API level 21

Index of the green color channel curve.

Constant Value: 1 (0x00000001)

public static final int CHANNEL_RED

Added in API level 21

Index of the red color channel curve.

Constant Value: 0 (0x00000000)

public static final float LEVEL_BLACK

Added in API level 21

Lower bound tonemap value corresponding to pure black for a single color channel.

Constant Value: 0.0

public static final float LEVEL_WHITE

Added in API level 21

Upper bound tonemap value corresponding to a pure white for a single color channel.

Constant Value: 1.0

public static final int POINT_SIZE

Added in API level 21

Number of elements in a (Pin, Pout) point;

Constant Value: 2 (0x00000002)

Public Constructors

public TonemapCurve (float[] red, float[] green, float[] blue)

Added in API level 21

Create a new immutable TonemapCurve instance.

Values are stored as a contiguous array of (Pin, Pout) points.

All parameters may have independent length but should have at most TONEMAP_MAX_CURVE_POINTS * .POINT_SIZE elements and at least 2 * .POINT_SIZE elements.

All sub-elements must be in the inclusive range of [.LEVEL_BLACK, .LEVEL_WHITE].

This constructor copies the array contents and does not retain ownership of the array.

Parameters
red An array of elements whose length is divisible by .POINT_SIZE
green An array of elements whose length is divisible by .POINT_SIZE
blue An array of elements whose length is divisible by .POINT_SIZE
Throws
IllegalArgumentException if any of input array length is invalid, or if any of the elements in the array are not in the range of [.LEVEL_BLACK, .LEVEL_WHITE]
NullPointerException if any of the parameters are null

Public Methods

public void copyColorCurve (int colorChannel, float[] destination, int offset)

Added in API level 21

Copy the color curve for a single color channel from this tonemap curve into the destination.

Values are stored as packed (Pin, Pout) points, and there are a total of getPointCount(int) points for that respective channel.

All returned coordinates are between the range of [.LEVEL_BLACK, .LEVEL_WHITE].

Parameters
destination an array big enough to hold at least getPointCount(int) * POINT_SIZE elements after the offset
offset a non-negative offset into the array
Throws
NullPointerException If destination was null
IllegalArgumentException If offset was negative
ArrayIndexOutOfBoundsException If there's not enough room to write the elements at the specified destination and offset.

public boolean equals (Object obj)

Added in API level 21

Check if this TonemapCurve is equal to another TonemapCurve.

Two matrices are equal if and only if all of their elements are equal.

Parameters
obj the object to compare this instance with.
Returns
  • true if the objects were equal, false otherwise

public PointF getPoint (int colorChannel, int index)

Added in API level 21

Get the point for a color channel at a specified index.

The index must be at least 0 but no greater than getPointCount(int) for that colorChannel.

All returned coordinates in the point are between the range of [.LEVEL_BLACK, .LEVEL_WHITE].

Parameters
colorChannel CHANNEL_RED, CHANNEL_GREEN, or CHANNEL_BLUE
index at least 0 but no greater than getPointCount(colorChannel)
Returns
  • the (Pin, Pout) pair mapping the tone for that index
Throws
IllegalArgumentException if colorChannel or index was out of range

public int getPointCount (int colorChannel)

Added in API level 21

Get the number of points stored in this tonemap curve for the specified color channel.

Parameters
colorChannel one of CHANNEL_RED, CHANNEL_GREEN, CHANNEL_BLUE
Returns
  • number of points stored in this tonemap for that color's curve (>= 0)
Throws
IllegalArgumentException if colorChannel was out of range

public int hashCode ()

Added in API level 21

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public String toString ()

Added in API level 21

Return the TonemapCurve as a string representation.

"TonemapCurve{R:[(%f, %f), (%f, %f) ... (%f, %f)], G:[(%f, %f), (%f, %f) ... (%f, %f)], B:[(%f, %f), (%f, %f) ... (%f, %f)]"}, where each (%f, %f) respectively represents one point of the corresponding tonemap curve.

Returns