FileDocCategorySizeDatePackage
BlackLevelPattern.javaAPI DocAndroid 5.1 API4578Thu Mar 12 22:22:10 GMT 2015android.hardware.camera2.params

BlackLevelPattern

public final class BlackLevelPattern extends Object
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.

Fields Summary
public static final int
COUNT
The number of offsets in this vector.
private final int[]
mCfaOffsets
Constructors Summary
public BlackLevelPattern(int[] offsets)
Create a new {@link 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.

param
offsets an array containing a 2x2 pattern of offsets.
throws
IllegalArgumentException if the given array has an incorrect length.
throws
NullPointerException if the given array is null.
hide


                                                                             
       
        if (offsets == null) {
            throw new NullPointerException("Null offsets array passed to constructor");
        }
        if (offsets.length < COUNT) {
            throw new IllegalArgumentException("Invalid offsets array length");
        }
        mCfaOffsets = Arrays.copyOf(offsets, COUNT);
    
Methods Summary
public voidcopyTo(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.

param
destination an array big enough to hold at least {@value #COUNT} elements after the {@code offset}
param
offset a non-negative offset into the array
throws
IllegalArgumentException if the offset is invalid.
throws
ArrayIndexOutOfBoundsException if the destination vector is too small.
throws
NullPointerException if the destination is null.

        checkNotNull(destination, "destination must not be null");
        if (offset < 0) {
            throw new IllegalArgumentException("Null offset passed to copyTo");
        }
        if (destination.length - offset < COUNT) {
            throw new ArrayIndexOutOfBoundsException("destination too small to fit elements");
        }
        for (int i = 0; i < COUNT; ++i) {
            destination[offset + i] = mCfaOffsets[i];
        }
    
public booleanequals(java.lang.Object obj)
Check if this {@link BlackLevelPattern} is equal to another {@link BlackLevelPattern}.

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

return
{@code true} if the objects were equal, {@code false} otherwise

        if (obj == null) {
            return false;
        } else if (this == obj) {
            return true;
        } else if (obj instanceof BlackLevelPattern) {
            final BlackLevelPattern other = (BlackLevelPattern) obj;
            return Arrays.equals(other.mCfaOffsets, mCfaOffsets);
        }
        return false;
    
public intgetOffsetForIndex(int column, int row)
Return the color channel offset for a given index into the array of raw pixel values.

param
column the column index in the the raw pixel array.
param
row the row index in the raw pixel array.
return
a color channel offset.
throws
IllegalArgumentException if a column or row given is negative.

        if (row < 0 || column < 0) {
            throw new IllegalArgumentException("column, row arguments must be positive");
        }
        return mCfaOffsets[((row & 1) << 1) | (column & 1)];
    
public inthashCode()
{@inheritDoc}

        return Arrays.hashCode(mCfaOffsets);