Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#constants) \| [Ctors](https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#inhmethods)

# TonemapCurve

*** ** * ** ***


`
public

final

class
TonemapCurve
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.camera2.params.TonemapCurve |

<br />

*** ** * ** ***

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

This defines red, green, and blue curves that the `https://developer.android.com/reference/android/hardware/camera2/CameraDevice` will
use as the tonemapping/contrast/gamma curve when `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#TONEMAP_MODE` is
set to `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#TONEMAP_MODE_CONTRAST_CURVE`.

For a camera device with
`https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME` capability, all 3 channels will contain the same set of control points.

The total number of points `(Pin, Pout)` for each color channel can be no more than
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS`.

The coordinate system for each point is within the inclusive range
\[`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`\].

<br />

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#TONEMAP_MODE_CONTRAST_CURVE`
- `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS`

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_BLUE` Index of the blue color channel curve. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_GREEN` Index of the green color channel curve. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_RED` Index of the red color channel curve. |
| `float` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK` Lower bound tonemap value corresponding to pure black for a single color channel. |
| `float` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE` Upper bound tonemap value corresponding to a pure white for a single color channel. |
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` Number of elements in a `(Pin, Pout)` point; |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#TonemapCurve(float[],%20float[],%20float[])(float[] red, float[] green, float[] blue) ` Create a new immutable TonemapCurve instance. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#copyColorCurve(int,%20float[],%20int)(int colorChannel, float[] destination, int offset) ` Copy the color curve for a single color channel from this tonemap curve into the destination. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Check if this TonemapCurve is equal to another TonemapCurve. |
| ` https://developer.android.com/reference/android/graphics/PointF` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#getPoint(int,%20int)(int colorChannel, int index) ` Get the point for a color channel at a specified index. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#getPointCount(int)(int colorChannel) ` Get the number of points stored in this tonemap curve for the specified color channel. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#hashCode()() ` Returns a hash code value for the object. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#toString()() ` Return the TonemapCurve as a string representation. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Constants

### CHANNEL_BLUE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CHANNEL_BLUE
```

Index of the blue color channel curve.

<br />

Constant Value:

2
(0x00000002)


### CHANNEL_GREEN

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CHANNEL_GREEN
```

Index of the green color channel curve.

<br />

Constant Value:

1
(0x00000001)


### CHANNEL_RED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CHANNEL_RED
```

Index of the red color channel curve.

<br />

Constant Value:

0
(0x00000000)


### LEVEL_BLACK

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final float LEVEL_BLACK
```

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

<br />

Constant Value:

0.0


### LEVEL_WHITE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final float LEVEL_WHITE
```

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

<br />

Constant Value:

1.0


### POINT_SIZE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int POINT_SIZE
```

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

<br />

Constant Value:

2
(0x00000002)


## Public constructors

### TonemapCurve

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

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
`https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS` \* `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` elements and
at least 2 \* `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` elements.

All sub-elements must be in the inclusive range of
\[`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`\].

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

<br />

<br />

| Parameters ||
|---|---|
| `red` | `float`: An array of elements whose length is divisible by `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` <br /> |
| `green` | `float`: An array of elements whose length is divisible by `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` <br /> |
| `blue` | `float`: An array of elements whose length is divisible by `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if any of input array length is invalid, or if any of the elements in the array are not in the range of \[`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`\] |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if any of the parameters are `null` |

## Public methods

### copyColorCurve

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

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
`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#getPointCount(int)` points for that respective channel.

All returned coordinates are between the range of
\[`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`\].

<br />

<br />

| Parameters ||
|---|---|
| `colorChannel` | `int` <br /> |
| `destination` | `float`: an array big enough to hold at least `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#getPointCount(int)` `*` `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#POINT_SIZE` elements after the `offset` <br /> |
| `offset` | `int`: a non-negative offset into the array <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If there's not enough room to write the elements at the specified destination and offset. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If offset was negative |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `destination` was `null` |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`
- `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`

### equals

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object obj)
```

Check if this TonemapCurve is equal to another TonemapCurve.

Two matrices are equal if and only if all of their elements are
`https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)`.

<br />

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the objects were equal, `false` otherwise <br /> |

### getPoint

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PointF getPoint (int colorChannel, 
                int index)
```

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

The index must be at least 0 but no greater than `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#getPointCount(int)` for
that `colorChannel`.

All returned coordinates in the point are between the range of
\[`https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`\].

<br />

<br />

| Parameters ||
|---|---|
| `colorChannel` | `int`: `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_RED`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_GREEN`, or `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_BLUE` <br /> |
| `index` | `int`: at least 0 but no greater than `getPointCount(colorChannel)` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/PointF` | the `(Pin, Pout)` pair mapping the tone for that index <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `colorChannel` or `index` was out of range |

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_BLACK`
- `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#LEVEL_WHITE`

### getPointCount

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPointCount (int colorChannel)
```

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

<br />

| Parameters ||
|---|---|
| `colorChannel` | `int`: one of `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_RED`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_GREEN`, `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve#CHANNEL_BLUE` <br /> |

| Returns ||
|---|---|
| `int` | number of points stored in this tonemap for that color's curve (\>= 0) <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `colorChannel` was out of range |

### hashCode

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### toString

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

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.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | string representation of `https://developer.android.com/reference/android/hardware/camera2/params/TonemapCurve` <br /> |