BlackLevelPattern


public final class BlackLevelPattern
extends Object

java.lang.Object
   ↳ 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

int COUNT

The number of offsets in this vector.

Public constructors

BlackLevelPattern(int[] offsets)

Create a new BlackLevelPattern from a given offset array.

Public methods

void copyTo(int[] destination, int offset)

Copy the ColorChannel offsets into the destination vector.

boolean equals(Object obj)

Check if this BlackLevelPattern is equal to another BlackLevelPattern.

int getOffsetForIndex(int column, int row)

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

int hashCode()

Returns a hash code value for the object.

String toString()

Return this BlackLevelPattern as a string representation.

Inherited methods

Constants

COUNT

Added in API level 21
public static final int COUNT

The number of offsets in this vector.

Constant Value: 4 (0x00000004)

Public constructors

BlackLevelPattern

Added in API level 34
public BlackLevelPattern (int[] offsets)

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 int: an array containing a 2x2 pattern of offsets. This value cannot be null.

Throws
IllegalArgumentException if the given array has an incorrect length.
NullPointerException if the given array is null.

Public methods

copyTo

Added in API level 21
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.

Parameters
destination int: an array big enough to hold at least .COUNT elements after the offset

offset int: a non-negative offset into the array

Throws
IllegalArgumentException if the offset is invalid.
ArrayIndexOutOfBoundsException if the destination vector is too small.
NullPointerException if the destination is null.

equals

Added in API level 21
public boolean equals (Object obj)

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 Object: This value may be null.

Returns
boolean true if the objects were equal, false otherwise

getOffsetForIndex

Added in API level 21
public int getOffsetForIndex (int column, 
                int row)

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.

Returns
int a color channel offset.

Throws
IllegalArgumentException if a column or row given is negative.

hashCode

Added in API level 21
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 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.

Returns
int a hash code value for this object.

toString

Added in API level 21
public String toString ()

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 CameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT).

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

Returns
String string representation of BlackLevelPattern