public static enum Image.PackedIntComponentOrder extends java.lang.Enum<Image.PackedIntComponentOrder>
PackedIntComponentOrder
is used to tell us what order the R-, G-, B- and A-components are stored in an int
, in a packed form.
The names of the constants in this class signifies the order of the components, from most significant byte to least significant byte.
Enum Constant and Description |
---|
ABGR
A
PackedIntComponentOrder that stores the A-, B-, G- and R-components, in that order, from most significant byte to least significant byte. |
ARGB
A
PackedIntComponentOrder that stores the A-, R-, G- and B-components, in that order, from most significant byte to least significant byte. |
BGR
A
PackedIntComponentOrder that stores the B-, G- and R-components, in that order, from most significant byte to least significant byte. |
RGB
A
PackedIntComponentOrder that stores the R-, G- and B-components, in that order, from most significant byte to least significant byte. |
Modifier and Type | Method and Description |
---|---|
int |
getComponentCount()
Returns the component count of this
PackedIntComponentOrder instance. |
int |
getShiftA()
Returns the shift for the A-component, or
-1 if it does not have one. |
int |
getShiftB()
Returns the shift for the B-component, or
-1 if it does not have one. |
int |
getShiftG()
Returns the shift for the G-component, or
-1 if it does not have one. |
int |
getShiftR()
Returns the shift for the R-component, or
-1 if it does not have one. |
boolean |
hasShiftA()
Returns
true if, and only if, this PackedIntComponentOrder has a shift for the A-component, false otherwise. |
boolean |
hasShiftB()
Returns
true if, and only if, this PackedIntComponentOrder has a shift for the B-component, false otherwise. |
boolean |
hasShiftG()
Returns
true if, and only if, this PackedIntComponentOrder has a shift for the G-component, false otherwise. |
boolean |
hasShiftR()
Returns
true if, and only if, this PackedIntComponentOrder has a shift for the R-component, false otherwise. |
int |
pack(int r,
int g,
int b)
Returns an
int with r , g and b in a packed form. |
int |
pack(int r,
int g,
int b,
int a)
Returns an
int with r , g , b and a in a packed form. |
int |
unpackA(int color)
Returns an
int with the unpacked A-component, or 255 if it could not unpack. |
int |
unpackB(int color)
Returns an
int with the unpacked B-component, or 0 if it could not unpack. |
int |
unpackG(int color)
Returns an
int with the unpacked G-component, or 0 if it could not unpack. |
int |
unpackR(int color)
Returns an
int with the unpacked R-component, or 0 if it could not unpack. |
static Image.PackedIntComponentOrder |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Image.PackedIntComponentOrder[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Image.PackedIntComponentOrder ABGR
PackedIntComponentOrder
that stores the A-, B-, G- and R-components, in that order, from most significant byte to least significant byte.
The components are stored in the following way:
int a = (colorABGR >> 24) & 0xFF;
int b = (colorABGR >> 16) & 0xFF;
int g = (colorABGR >> 8) & 0xFF;
int r = (colorABGR >> 0) & 0xFF;
public static final Image.PackedIntComponentOrder ARGB
PackedIntComponentOrder
that stores the A-, R-, G- and B-components, in that order, from most significant byte to least significant byte.
The components are stored in the following way:
int a = (colorARGB >> 24) & 0xFF;
int r = (colorARGB >> 16) & 0xFF;
int g = (colorARGB >> 8) & 0xFF;
int b = (colorARGB >> 0) & 0xFF;
public static final Image.PackedIntComponentOrder BGR
PackedIntComponentOrder
that stores the B-, G- and R-components, in that order, from most significant byte to least significant byte.
The components are stored in the following way:
int b = (colorBGR >> 16) & 0xFF;
int g = (colorBGR >> 8) & 0xFF;
int r = (colorBGR >> 0) & 0xFF;
public static final Image.PackedIntComponentOrder RGB
PackedIntComponentOrder
that stores the R-, G- and B-components, in that order, from most significant byte to least significant byte.
The components are stored in the following way:
int r = (colorRGB >> 16) & 0xFF;
int g = (colorRGB >> 8) & 0xFF;
int b = (colorRGB >> 0) & 0xFF;
public static Image.PackedIntComponentOrder[] values()
for (Image.PackedIntComponentOrder c : Image.PackedIntComponentOrder.values()) System.out.println(c);
public static Image.PackedIntComponentOrder 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 hasShiftA()
true
if, and only if, this PackedIntComponentOrder
has a shift for the A-component, false
otherwise.true
if, and only if, this PackedIntComponentOrder
has a shift for the A-component, false
otherwisepublic boolean hasShiftB()
true
if, and only if, this PackedIntComponentOrder
has a shift for the B-component, false
otherwise.true
if, and only if, this PackedIntComponentOrder
has a shift for the B-component, false
otherwisepublic boolean hasShiftG()
true
if, and only if, this PackedIntComponentOrder
has a shift for the G-component, false
otherwise.true
if, and only if, this PackedIntComponentOrder
has a shift for the G-component, false
otherwisepublic boolean hasShiftR()
true
if, and only if, this PackedIntComponentOrder
has a shift for the R-component, false
otherwise.true
if, and only if, this PackedIntComponentOrder
has a shift for the R-component, false
otherwisepublic int getComponentCount()
PackedIntComponentOrder
instance.PackedIntComponentOrder
instancepublic int getShiftA()
-1
if it does not have one.-1
if it does not have onepublic int getShiftB()
-1
if it does not have one.-1
if it does not have onepublic int getShiftG()
-1
if it does not have one.-1
if it does not have onepublic int getShiftR()
-1
if it does not have one.-1
if it does not have onepublic int pack(int r, int g, int b)
int
with r
, g
and b
in a packed form.r
- the R-componentg
- the G-componentb
- the B-componentint
with r
, g
and b
in a packed formpublic int pack(int r, int g, int b, int a)
int
with r
, g
, b
and a
in a packed form.r
- the R-componentg
- the G-componentb
- the B-componenta
- the A-componentint
with r
, g
, b
and a
in a packed formpublic int unpackA(int color)
int
with the unpacked A-component, or 255
if it could not unpack.color
- an int
with the components in packed formint
with the unpacked A-component, or 255
if it could not unpackpublic int unpackB(int color)
int
with the unpacked B-component, or 0
if it could not unpack.color
- an int
with the components in packed formint
with the unpacked B-component, or 0
if it could not unpackpublic int unpackG(int color)
int
with the unpacked G-component, or 0
if it could not unpack.color
- an int
with the components in packed formint
with the unpacked G-component, or 0
if it could not unpackpublic int unpackR(int color)
int
with the unpacked R-component, or 0
if it could not unpack.color
- an int
with the components in packed formint
with the unpacked R-component, or 0
if it could not unpack