Package com.jogamp.nativewindow.util
Class PixelFormat.PackedComposition
java.lang.Object
com.jogamp.nativewindow.util.PixelFormat.PackedComposition
- All Implemented Interfaces:
PixelFormat.Composition
- Enclosing class:
- PixelFormat
Packed pixel composition, see
PixelFormat.Composition
.
Components are interleaved, i.e. packed.
-
Field Summary
Fields inherited from interface com.jogamp.nativewindow.util.PixelFormat.Composition
UNDEF
-
Constructor Summary
ConstructorsConstructorDescriptionPackedComposition
(PixelFormat.CType[] componentOrder, int[] componentMask, int[] componentBitShift, int bitStride) PackedComposition
(PixelFormat.CType[] componentOrder, int componentCount, int bpc, int bitStride) -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Number of bits per pixel, e.g.final int
Bit distance between pixels.final int
Number of bytes per pixel, i.e.final int[]
Returns the number of bits of all components, seePixelFormat.Composition.componentBitMask()
.final int[]
Returns the un-shifted bit-mask of all components.final int[]
Returns the bit-shift of all components, seePixelFormat.Composition.componentBitMask()
.final int
Number of components per pixel, e.g.final PixelFormat.CType[]
Returns theComponent type
order of all components, seePixelFormat.Composition.componentBitMask()
.final int
decodeSingleI32
(int shifted, int cIdx) Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 32bit.final int
decodeSingleI64
(long shifted, int cIdx) Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 64bit.final int
defaultValue
(int cIdx, boolean shiftResult) final int
encode3CompI32
(int c1NormI32, int c2NormI32, int c3NormI32) final int
encode3CompI8
(byte c1NormI8, byte c2NormI8, byte c3NormI8) final int
encode4CompI32
(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32) final int
encode4CompI8
(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8) final int
encodeSingleI32
(int norm, int cIdx) final long
encodeSingleI64
(int norm, int cIdx) final int
encodeSingleI8
(byte normI8, int cIdx) final boolean
ReturnsObject.equals(Object)
final int
Returns the index of givenPixelFormat.CType
withinPixelFormat.Composition.componentOrder()
, -1 if not exists.final int
fromFloat
(float f, int cIdx, boolean shiftResult) final int
hashCode()
Returns cached immutable hash value, seeObject.hashCode()
.final boolean
Returnstrue
if all components are packed, i.e.final boolean
Returnstrue
if all components are of same bit-size, e.g.final float
toFloat
(int i32, int cIdx, boolean i32Shifted) final String
toString()
ReturnsObject.toString()
.
-
Constructor Details
-
PackedComposition
public PackedComposition(PixelFormat.CType[] componentOrder, int componentCount, int bpc, int bitStride) - Parameters:
componentOrder
-Component type
order of all components, seecomponentBitMask()
.componentCount
- number of componentsbpc
- bits per componentbitStride
- stride bits to next pixel
-
PackedComposition
public PackedComposition(PixelFormat.CType[] componentOrder, int[] componentMask, int[] componentBitShift, int bitStride) - Parameters:
componentOrder
-Component type
order of all components, seecomponentBitMask()
.componentMask
- bit-mask of of all components, seecomponentBitMask()
.componentBitShift
- bit-shift of all components, seecomponentBitMask()
.bitStride
- stride bits to next pixel
-
-
Method Details
-
toString
Description copied from interface:PixelFormat.Composition
ReturnsObject.toString()
.- Specified by:
toString
in interfacePixelFormat.Composition
- Overrides:
toString
in classObject
-
isUniform
public final boolean isUniform()Description copied from interface:PixelFormat.Composition
- Specified by:
isUniform
in interfacePixelFormat.Composition
-
isInterleaved
public final boolean isInterleaved()Returnstrue
if all components are packed, i.e. interleaved, e.g.RGBA8888
, otherwisefalse
.Instances of
PixelFormat.PackedComposition
returnstrue
.- Specified by:
isInterleaved
in interfacePixelFormat.Composition
-
componentCount
public final int componentCount()Description copied from interface:PixelFormat.Composition
Number of components per pixel, e.g. 3 forRGBx8888
.- Specified by:
componentCount
in interfacePixelFormat.Composition
-
bitsPerPixel
public final int bitsPerPixel()Description copied from interface:PixelFormat.Composition
Number of bits per pixel, e.g. 24 bits forRGBx8888
.- Specified by:
bitsPerPixel
in interfacePixelFormat.Composition
-
bitStride
public final int bitStride()Description copied from interface:PixelFormat.Composition
Bit distance between pixels.For packed pixels e.g. 32 bits for
RGBx8888
.- Specified by:
bitStride
in interfacePixelFormat.Composition
-
bytesPerPixel
public final int bytesPerPixel()Description copied from interface:PixelFormat.Composition
Number of bytes per pixel, i.e. packedPixelFormat.Composition.bitStride()
in bytes, e.g. 4 forRGBx8888
.- Specified by:
bytesPerPixel
in interfacePixelFormat.Composition
-
componentOrder
Description copied from interface:PixelFormat.Composition
Returns theComponent type
order of all components, seePixelFormat.Composition.componentBitMask()
.- Specified by:
componentOrder
in interfacePixelFormat.Composition
-
find
Description copied from interface:PixelFormat.Composition
Returns the index of givenPixelFormat.CType
withinPixelFormat.Composition.componentOrder()
, -1 if not exists.- Specified by:
find
in interfacePixelFormat.Composition
-
componentBitMask
public final int[] componentBitMask()Description copied from interface:PixelFormat.Composition
Returns the un-shifted bit-mask of all components.Components mask is returned in the order Low-Index to High-Index, e.g.:
- Specified by:
componentBitMask
in interfacePixelFormat.Composition
-
componentBitCount
public final int[] componentBitCount()Description copied from interface:PixelFormat.Composition
Returns the number of bits of all components, seePixelFormat.Composition.componentBitMask()
.- Specified by:
componentBitCount
in interfacePixelFormat.Composition
-
componentBitShift
public final int[] componentBitShift()Description copied from interface:PixelFormat.Composition
Returns the bit-shift of all components, seePixelFormat.Composition.componentBitMask()
.- Specified by:
componentBitShift
in interfacePixelFormat.Composition
-
decodeSingleI32
public final int decodeSingleI32(int shifted, int cIdx) Description copied from interface:PixelFormat.Composition
Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 32bit.- Specified by:
decodeSingleI32
in interfacePixelFormat.Composition
- Parameters:
shifted
- complete pixel encoded into on 32bit integercIdx
- the desired component index- Returns:
- the decoded component value
-
decodeSingleI64
public final int decodeSingleI64(long shifted, int cIdx) Description copied from interface:PixelFormat.Composition
Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 64bit.- Specified by:
decodeSingleI64
in interfacePixelFormat.Composition
- Parameters:
shifted
- complete pixel encoded into on 64bit integercIdx
- the desired component index- Returns:
- the decoded component value
-
encodeSingleI32
public final int encodeSingleI32(int norm, int cIdx) - Specified by:
encodeSingleI32
in interfacePixelFormat.Composition
-
encodeSingleI64
public final long encodeSingleI64(int norm, int cIdx) - Specified by:
encodeSingleI64
in interfacePixelFormat.Composition
-
encode3CompI32
public final int encode3CompI32(int c1NormI32, int c2NormI32, int c3NormI32) - Specified by:
encode3CompI32
in interfacePixelFormat.Composition
-
encode4CompI32
public final int encode4CompI32(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32) - Specified by:
encode4CompI32
in interfacePixelFormat.Composition
-
encodeSingleI8
public final int encodeSingleI8(byte normI8, int cIdx) - Specified by:
encodeSingleI8
in interfacePixelFormat.Composition
-
encode3CompI8
public final int encode3CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8) - Specified by:
encode3CompI8
in interfacePixelFormat.Composition
-
encode4CompI8
public final int encode4CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8) - Specified by:
encode4CompI8
in interfacePixelFormat.Composition
-
toFloat
public final float toFloat(int i32, int cIdx, boolean i32Shifted) - Specified by:
toFloat
in interfacePixelFormat.Composition
-
fromFloat
public final int fromFloat(float f, int cIdx, boolean shiftResult) - Specified by:
fromFloat
in interfacePixelFormat.Composition
-
defaultValue
public final int defaultValue(int cIdx, boolean shiftResult) - Specified by:
defaultValue
in interfacePixelFormat.Composition
-
hashCode
public final int hashCode()Description copied from interface:PixelFormat.Composition
Returns cached immutable hash value, seeObject.hashCode()
.- Specified by:
hashCode
in interfacePixelFormat.Composition
- Overrides:
hashCode
in classObject
-
equals
Description copied from interface:PixelFormat.Composition
ReturnsObject.equals(Object)
- Specified by:
equals
in interfacePixelFormat.Composition
- Overrides:
equals
in classObject
-