# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# ColorSpaceTransform

`public final class ColorSpaceTransform`
`extends Object` ``

java.lang.Object
↳ | android.hardware.camera2.params.ColorSpaceTransform

Immutable class for describing a 3x3 matrix of `Rational` values in row-major order.

This matrix maps a transform from one color space to another. For the particular color space source and target, see the appropriate camera metadata documentation for the key that provides this value.

See also:

- `CameraMetadata`

## Summary

### Public constructors
`ColorSpaceTransform(Rational[] elements)` Create a new immutable `ColorSpaceTransform` instance from a `Rational` array.
`ColorSpaceTransform(int[] elements)` Create a new immutable `ColorSpaceTransform` instance from an `int` array.

### Public methods
`void` | `copyElements(int[] destination, int offset)` Copy the `Rational` elements in row-major order from this matrix into the destination.
`void` | `copyElements(Rational[] destination, int offset)` Copy the `Rational` elements in row-major order from this matrix into the destination.
`boolean` | `equals(Object obj)` Check if this `ColorSpaceTransform` is equal to another `ColorSpaceTransform`.
`Rational` | `getElement(int column, int row)` Get an element of this matrix by its row and column.
`int` | `hashCode()` Returns a hash code value for the object.
`String` | `toString()` Return the color space transform as a string representation.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### ColorSpaceTransform

    public ColorSpaceTransform (Rational[] elements)

Create a new immutable `ColorSpaceTransform` instance from a `Rational` array.

The elements must be stored in a row-major order.

Parameters
`elements` | `Rational`: An array of `9` elements

Throws
`IllegalArgumentException` | if the count of `elements` is not `9`
`NullPointerException` | if `elements` or any sub-element is `null`

### ColorSpaceTransform

    public ColorSpaceTransform (int[] elements)

Create a new immutable `ColorSpaceTransform` instance from an `int` array.

The elements must be stored in a row-major order. Each rational is stored contiguously as a `(numerator, denominator)` pair.

In particular:

    int[] elements = new int[
         N11, D11, N12, D12, N13, D13,
         N21, D21, N22, D22, N23, D23,
         N31, D31, N32, D32, N33, D33
     ];

     new ColorSpaceTransform(elements)

where `Nij` and `Dij` is the numerator and denominator for row `i` and column `j`.

Parameters
`elements` | `int`: An array of `18` elements

Throws
`IllegalArgumentException` | if the count of `elements` is not `18`
`NullPointerException` | if `elements` is `null`

## Public methods

### copyElements

    public void copyElements (int[] destination,
                    int offset)

Copy the `Rational` elements in row-major order from this matrix into the destination.

Each element is stored as a contiguous rational packed as a `(numerator, denominator)` pair of ints, identical to the `ColorSpaceTransform#ColorSpaceTransform(int[])`.

Parameters
`destination` | `int`: an array big enough to hold at least `18` elements after the `offset`
`offset` | `int`: a non-negative offset into the array

Throws
`NullPointerException` | If `destination` was `null`
`ArrayIndexOutOfBoundsException` | If there's not enough room to write the elements at the specified destination and offset.

See also:

- `ColorSpaceTransform(int[])`

### copyElements

    public void copyElements (Rational[] destination,
                    int offset)

Copy the `Rational` elements in row-major order from this matrix into the destination.

Parameters
`destination` | `Rational`: an array big enough to hold at least `9` elements after the `offset`
`offset` | `int`: a non-negative offset into the array

Throws
`NullPointerException` | If `destination` was `null`
`ArrayIndexOutOfBoundsException` | If there's not enough room to write the elements at the specified destination and offset.

### equals

    public boolean equals (Object obj)

Check if this `ColorSpaceTransform` is equal to another `ColorSpaceTransform`.

Two color space transforms are equal if and only if all of their elements are `Object#equals`.

Parameters
`obj` | `Object`: the reference object with which to compare.

Returns
`boolean` | `true` if the objects were equal, `false` otherwise

### getElement

    public Rational getElement (int column,
                    int row)

Get an element of this matrix by its row and column.

The rows must be within the range [0, 3), and the column must be within the range [0, 3).

Parameters
`column` | `int`
`row` | `int`

Returns
`Rational` | element (non-`null`)

Throws
`IllegalArgumentException` | if column or row was out of range

### hashCode

    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(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 `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.

As much as is reasonably practical, the hashCode method defined by class `Object` does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
`int` | a hash code value for this object.

### toString

    public String toString ()

Return the color space transform as a string representation.

Example: `"ColorSpaceTransform([1/1, 0/1, 0/1], [0/1, 1/1, 0/1], [0/1, 0/1, 1/1])"` is an identity transform. Elements are printed in row major order.

Returns
`String` | string representation of color space transform

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*