public static enum Image.ArrayComponentOrder extends java.lang.Enum<Image.ArrayComponentOrder>
ArrayComponentOrder
is used to tell us what order the R-, G-, B- and A-components are stored in arrays.
This class has nothing to do with the way the R-, G-, B- and A-components are stored in an int
, in packed form.
The names of the constants in this class should not be confused with the names of similar things in other libraries. They only reflect the way the components are stored in an array. The order of the letters signify the order in which they
are stored in the array, starting from some offset. An example would be ARGB
, where A
denotes offset + 0
, R
denotes offset + 1
, G
denotes offset + 2
and B
denotes
offset + 3
.
Enum Constant and Description |
---|
ARGB
The components are stored as A, R, G and B.
|
BGR
The components are stored as B, G and R.
|
BGRA
The components are stored as B, G, R and A.
|
RGB
The components are stored as R, G and B.
|
RGBA
The components are stored as R, G, B and A.
|
Modifier and Type | Method and Description |
---|---|
int |
getComponentCount()
Returns the component count of this
ArrayComponentOrder instance. |
int |
getOffsetA()
Returns the offset for the A-component, or
-1 if it does not have one. |
int |
getOffsetB()
Returns the offset for the B-component, or
-1 if it does not have one. |
int |
getOffsetG()
Returns the offset for the G-component, or
-1 if it does not have one. |
int |
getOffsetR()
Returns the offset for the R-component, or
-1 if it does not have one. |
boolean |
hasOffsetA()
Returns
true if, and only if, this ArrayComponentOrder has an offset for the A-component, false otherwise. |
boolean |
hasOffsetB()
Returns
true if, and only if, this ArrayComponentOrder has an offset for the B-component, false otherwise. |
boolean |
hasOffsetG()
Returns
true if, and only if, this ArrayComponentOrder has an offset for the G-component, false otherwise. |
boolean |
hasOffsetR()
Returns
true if, and only if, this ArrayComponentOrder has an offset for the R-component, false otherwise. |
int |
readA(byte[] array,
int offset)
Returns an
int with the A-component, or 255 if it does not have an offset for the A-component. |
int |
readA(int[] array,
int offset)
Returns an
int with the A-component, or 255 if it does not have an offset for the A-component. |
int |
readB(byte[] array,
int offset)
Returns an
int with the B-component, or 0 if it does not have an offset for the B-component. |
int |
readB(int[] array,
int offset)
Returns an
int with the B-component, or 0 if it does not have an offset for the B-component. |
int |
readG(byte[] array,
int offset)
Returns an
int with the G-component, or 0 if it does not have an offset for the G-component. |
int |
readG(int[] array,
int offset)
Returns an
int with the G-component, or 0 if it does not have an offset for the G-component. |
int |
readR(byte[] array,
int offset)
Returns an
int with the R-component, or 0 if it does not have an offset for the R-component. |
int |
readR(int[] array,
int offset)
Returns an
int with the R-component, or 0 if it does not have an offset for the R-component. |
static Image.ArrayComponentOrder |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Image.ArrayComponentOrder[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Image.ArrayComponentOrder ARGB
The following code demonstrates the way it is stored in an array:
array = new int[4];
array[0] = a;
array[1] = r;
array[2] = g;
array[3] = b;
public static final Image.ArrayComponentOrder BGR
The following code demonstrates the way it is stored in an array:
array = new int[3];
array[0] = b;
array[1] = g;
array[2] = r;
public static final Image.ArrayComponentOrder BGRA
The following code demonstrates the way it is stored in an array:
array = new int[4];
array[0] = b;
array[1] = g;
array[2] = r;
array[3] = a;
public static final Image.ArrayComponentOrder RGB
The following code demonstrates the way it is stored in an array:
array = new int[3];
array[0] = r;
array[1] = g;
array[2] = b;
public static final Image.ArrayComponentOrder RGBA
The following code demonstrates the way it is stored in an array:
array = new int[4];
array[0] = r;
array[1] = g;
array[2] = b;
array[3] = a;
public static Image.ArrayComponentOrder[] values()
for (Image.ArrayComponentOrder c : Image.ArrayComponentOrder.values()) System.out.println(c);
public static Image.ArrayComponentOrder valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic boolean hasOffsetA()
true
if, and only if, this ArrayComponentOrder
has an offset for the A-component, false
otherwise.true
if, and only if, this ArrayComponentOrder
has an offset for the A-component, false
otherwisepublic boolean hasOffsetB()
true
if, and only if, this ArrayComponentOrder
has an offset for the B-component, false
otherwise.true
if, and only if, this ArrayComponentOrder
has an offset for the B-component, false
otherwisepublic boolean hasOffsetG()
true
if, and only if, this ArrayComponentOrder
has an offset for the G-component, false
otherwise.true
if, and only if, this ArrayComponentOrder
has an offset for the G-component, false
otherwisepublic boolean hasOffsetR()
true
if, and only if, this ArrayComponentOrder
has an offset for the R-component, false
otherwise.true
if, and only if, this ArrayComponentOrder
has an offset for the R-component, false
otherwisepublic int getComponentCount()
ArrayComponentOrder
instance.ArrayComponentOrder
instancepublic int getOffsetA()
-1
if it does not have one.-1
if it does not have onepublic int getOffsetB()
-1
if it does not have one.-1
if it does not have onepublic int getOffsetG()
-1
if it does not have one.-1
if it does not have onepublic int getOffsetR()
-1
if it does not have one.-1
if it does not have onepublic int readA(byte[] array, int offset)
int
with the A-component, or 255
if it does not have an offset for the A-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetA()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the A-component, or 255
if it does not have an offset for the A-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetA()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readA(int[] array, int offset)
int
with the A-component, or 255
if it does not have an offset for the A-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetA()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the A-component, or 255
if it does not have an offset for the A-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetA()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readB(byte[] array, int offset)
int
with the B-component, or 0
if it does not have an offset for the B-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetB()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the B-component, or 0
if it does not have an offset for the B-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetB()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readB(int[] array, int offset)
int
with the B-component, or 0
if it does not have an offset for the B-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetB()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the B-component, or 0
if it does not have an offset for the B-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetB()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readG(byte[] array, int offset)
int
with the G-component, or 0
if it does not have an offset for the G-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetG()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the G-component, or 0
if it does not have an offset for the G-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetG()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readG(int[] array, int offset)
int
with the G-component, or 0
if it does not have an offset for the G-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetG()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the G-component, or 0
if it does not have an offset for the G-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetG()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readR(byte[] array, int offset)
int
with the R-component, or 0
if it does not have an offset for the R-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetR()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the R-component, or 0
if it does not have an offset for the R-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetR()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null
public int readR(int[] array, int offset)
int
with the R-component, or 0
if it does not have an offset for the R-component.
If array
is null
, a NullPointerException
will be thrown.
If offset + getOffsetR()
is less than 0
, or greater than or equal to array.length
, an ArrayIndexOutOfBoundsException
will be thrown.
array
- the array to read fromoffset
- the absolute offset in the array to read fromint
with the R-component, or 0
if it does not have an offset for the R-componentjava.lang.ArrayIndexOutOfBoundsException
- thrown if, and only if, offset + getOffsetR()
is less than 0
, or greater than or equal to array.length
java.lang.NullPointerException
- thrown if, and only if, array
is null