Added in API level 21

BlackLevelPattern


class BlackLevelPattern
kotlin.Any
   ↳ android.hardware.camera2.params.BlackLevelPattern

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 MONOCHROME capability, all 4 elements of the pattern will have the same value.

Summary

Constants
static Int

The number of offsets in this vector.

Public constructors

Create a new BlackLevelPattern from a given offset array.

Public methods
Unit
copyTo(destination: IntArray!, offset: Int)

Copy the ColorChannel offsets into the destination vector.

Boolean
equals(other: Any?)

Check if this BlackLevelPattern is equal to another BlackLevelPattern.

Int
getOffsetForIndex(column: Int, row: Int)

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

Int

Returns a hash code value for the object.

String

Return this BlackLevelPattern as a string representation.

Constants

COUNT

Added in API level 21
static val COUNT: Int

The number of offsets in this vector.

Value: 4

Public constructors

BlackLevelPattern

Added in API level 34
BlackLevelPattern(offsets: IntArray)

Create a new 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.

Parameters
offsets IntArray: an array containing a 2x2 pattern of offsets. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the given array has an incorrect length.
java.lang.NullPointerException if the given array is null.

Public methods

copyTo

Added in API level 21
fun copyTo(
    destination: IntArray!,
    offset: Int
): Unit

Copy the ColorChannel offsets into the destination vector.

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

Parameters
destination IntArray!: an array big enough to hold at least {@value #COUNT} elements after the offset
offset Int: a non-negative offset into the array
Exceptions
java.lang.IllegalArgumentException if the offset is invalid.
java.lang.ArrayIndexOutOfBoundsException if the destination vector is too small.
java.lang.NullPointerException if the destination is null.

equals

Added in API level 21
fun equals(other: Any?): Boolean

Check if this BlackLevelPattern is equal to another BlackLevelPattern.

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

Parameters
obj This value may be null.
Return
Boolean true if the objects were equal, false otherwise

getOffsetForIndex

Added in API level 21
fun getOffsetForIndex(
    column: Int,
    row: Int
): Int

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

Parameters
column Int: the column index in the the raw pixel array.
row Int: the row index in the raw pixel array.
Return
Int a color channel offset.
Exceptions
java.lang.IllegalArgumentException if a column or row given is negative.

hashCode

Added in API level 21
fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by 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 equals 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 equals 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.
Return
Int a hash code value for this object.

toString

Added in API level 21
fun toString(): String

Return this 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 android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT).

A MONOCHROME camera only has one channel. As a result, the returned string will contain 4 identical values.

Return
String string representation of BlackLevelPattern