public final class RggbChannelVector extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BLUE
Blue color channel in a bayer Raw pattern.
|
static int |
COUNT
The number of color channels in this vector.
|
static int |
GREEN_EVEN
Green color channel in a bayer Raw pattern used by the even rows.
|
static int |
GREEN_ODD
Green color channel in a bayer Raw pattern used by the odd rows.
|
static int |
RED
Red color channel in a bayer Raw pattern.
|
Constructor and Description |
---|
RggbChannelVector(float red,
float greenEven,
float greenOdd,
float blue)
Create a new
RggbChannelVector from an RGGB 2x2 pixel. |
Modifier and Type | Method and Description |
---|---|
void |
copyTo(float[] destination,
int offset)
Copy the vector into the destination in the order
[R, Geven, Godd, B] . |
boolean |
equals(Object obj)
Check if this
RggbChannelVector is equal to another RggbChannelVector . |
float |
getBlue()
Get the blue component.
|
float |
getComponent(int colorChannel)
Get the component by the color channel index.
|
float |
getGreenEven()
Get the green (even rows) component.
|
float |
getGreenOdd()
Get the green (odd rows) component.
|
float |
getRed()
Get the red component.
|
int |
hashCode()
Returns a hash code value for the object.
|
String |
toString()
Return the RggbChannelVector as a string representation.
|
public static final int COUNT
public static final int RED
public static final int GREEN_EVEN
public static final int GREEN_ODD
public static final int BLUE
public RggbChannelVector(float red, float greenEven, float greenOdd, float blue)
RggbChannelVector
from an RGGB 2x2 pixel.
All pixel values are considered normalized within [0.0f, 1.0f]
(i.e. 1.0f
could be linearized to 255
if converting to a
non-floating point pixel representation).
All arguments must be finite; NaN and infinity is not allowed.
red
- red pixelgreenEven
- green pixel (even row)greenOdd
- green pixel (odd row)blue
- blue pixelIllegalArgumentException
- if any of the arguments were not finitepublic final float getRed()
public float getGreenEven()
public float getGreenOdd()
public float getBlue()
public float getComponent(int colorChannel)
colorChannel
must be one of RED
, GREEN_EVEN
, GREEN_ODD
,
BLUE
.
colorChannel
- greater or equal to 0
and less than COUNT
IllegalArgumentException
- if colorChannel
was out of rangepublic void copyTo(float[] destination, int offset)
[R, Geven, Godd, B]
.destination
- an array big enough to hold at least 4 elements after the
offset
offset
- a non-negative offset into the arrayNullPointerException
- If destination
was null
ArrayIndexOutOfBoundsException
- If there's not enough room to write the elements at the specified destination and
offset.public boolean equals(Object obj)
RggbChannelVector
is equal to another RggbChannelVector
.
Two vectors are only equal if and only if each of the respective elements is equal.
equals
in class Object
obj
- the reference object with which to compare.true
if the objects were equal, false
otherwiseObject.hashCode()
,
HashMap
public int hashCode()
HashMap
.
The general contract of hashCode
is:
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.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
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.
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
JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
"RggbChannelVector{R:%f, G_even:%f, G_odd:%f, B:%f}"
, where each
%f
respectively represents one of the the four color channels.
toString
in class Object
RggbChannelVector