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/BlackLevelPattern#constants) \| [Ctors](https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#inhmethods)

# BlackLevelPattern

*** ** * ** ***

` public final class BlackLevelPattern `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Immutable class to store a 4-element vector of integers corresponding to a 2x2 pattern of color channel offsets used for the black level offsets of each color channel. For a camera device with `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME` capability, all 4 elements of the pattern will have the same value.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#COUNT` The number of offsets in this vector. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#BlackLevelPattern(int[])(int[] offsets) ` Create a new `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` from a given offset array. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#copyTo(int[],%20int)(int[] destination, int offset) ` Copy the ColorChannel offsets into the destination vector. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Check if this `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` is equal to another `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#getOffsetForIndex(int,%20int)(int column, int row) ` Return the color channel offset for a given index into the array of raw pixel values. |
| ` int` | ` https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#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/BlackLevelPattern#toString()() ` Return this `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` 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

### COUNT

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

```
public static final int COUNT
```

The number of offsets in this vector.

<br />

Constant Value: 4 (0x00000004)

## Public constructors

### BlackLevelPattern

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

```
public BlackLevelPattern (int[] offsets)
```

Create a new `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` from a given offset array.

The given offset array must contain offsets for each color channel in a 2x2 pattern corresponding to the color filter arrangement. Offsets are given in row-column scan order.

This constructor is public to allow for easier application testing by creating custom object instances. It's not necessary to construct these objects during normal use of the camera API.

<br />

<br />

| Parameters ||
|---|---|
| `offsets` | `int`: an array containing a 2x2 pattern of offsets. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the given array has an incorrect length. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the given array is null. |

## Public methods

### copyTo

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

```
public void copyTo (int[] destination, 
                int offset)
```

Copy the ColorChannel offsets into the destination vector.

Offsets are given in row-column scan order for a given 2x2 color pattern.

<br />

<br />

| Parameters ||
|---|---|
| `destination` | `int`: an array big enough to hold at least `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern#COUNT` 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 the destination vector is too small. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the offset is invalid. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the destination is null. |

### 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 `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` is equal to another `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern`.

Two vectors are only equal if and only if each of the respective elements is equal.

<br />

<br />

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

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

### getOffsetForIndex

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

```
public int getOffsetForIndex (int column, 
                int row)
```

Return the color channel offset for a given index into the array of raw pixel values.

<br />

| Parameters ||
|---|---|
| `column` | `int`: the column index in the the raw pixel array. <br /> |
| `row` | `int`: the row index in the raw pixel array. <br /> |

| Returns ||
|---|---|
| `int` | a color channel offset. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if a column or row given is negative. |

### 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 this `https://developer.android.com/reference/android/hardware/camera2/params/BlackLevelPattern` as a string representation.

`"BlackLevelPattern([%d, %d], [%d, %d])"`, where each `%d` represents one black level offset of a color channel. The values are in the same order as channels listed for the CFA layout key (see `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT`).

A `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME` camera only has one channel. As a result, the returned string will contain 4 identical values.

<br />

<br />

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

**See also:**

- `https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT`