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
public static class PixelFormat.PackedComposition extends Object implements PixelFormat.Composition
Packed pixel composition, seePixelFormat.Composition
.Components are interleaved, i.e. packed.
-
-
Field Summary
-
Fields inherited from interface com.jogamp.nativewindow.util.PixelFormat.Composition
UNDEF
-
-
Constructor Summary
Constructors Constructor Description PackedComposition(PixelFormat.CType[] componentOrder, int[] componentMask, int[] componentBitShift, int bitStride)
PackedComposition(PixelFormat.CType[] componentOrder, int componentCount, int bpc, int bitStride)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bitsPerPixel()
Number of bits per pixel, e.g.int
bitStride()
Bit distance between pixels.int
bytesPerPixel()
Number of bytes per pixel, i.e.int[]
componentBitCount()
Returns the number of bits of all components, seePixelFormat.Composition.componentBitMask()
.int[]
componentBitMask()
Returns the un-shifted bit-mask of all components.int[]
componentBitShift()
Returns the bit-shift of all components, seePixelFormat.Composition.componentBitMask()
.int
componentCount()
Number of components per pixel, e.g.PixelFormat.CType[]
componentOrder()
Returns theComponent type
order of all components, seePixelFormat.Composition.componentBitMask()
.int
decodeSingleI32(int shifted, int cIdx)
Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 32bit.int
decodeSingleI64(long shifted, int cIdx)
Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()
of up to 64bit.int
defaultValue(int cIdx, boolean shiftResult)
int
encode3CompI32(int c1NormI32, int c2NormI32, int c3NormI32)
int
encode3CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8)
int
encode4CompI32(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32)
int
encode4CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8)
int
encodeSingleI32(int norm, int cIdx)
long
encodeSingleI64(int norm, int cIdx)
int
encodeSingleI8(byte normI8, int cIdx)
boolean
equals(Object obj)
ReturnsObject.equals(Object)
int
find(PixelFormat.CType s)
Returns the index of givenPixelFormat.CType
withinPixelFormat.Composition.componentOrder()
, -1 if not exists.int
fromFloat(float f, int cIdx, boolean shiftResult)
int
hashCode()
Returns cached immutable hash value, seeObject.hashCode()
.boolean
isInterleaved()
Returnstrue
if all components are packed, i.e.boolean
isUniform()
Returnstrue
if all components are of same bit-size, e.g.float
toFloat(int i32, int cIdx, boolean i32Shifted)
String
toString()
ReturnsObject.toString()
.
-
-
-
Constructor Detail
-
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 Detail
-
toString
public final String 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
public final PixelFormat.CType[] componentOrder()
Description copied from interface:PixelFormat.Composition
Returns theComponent type
order of all components, seePixelFormat.Composition.componentBitMask()
.- Specified by:
componentOrder
in interfacePixelFormat.Composition
-
find
public final int find(PixelFormat.CType s)
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
public final boolean equals(Object obj)
Description copied from interface:PixelFormat.Composition
ReturnsObject.equals(Object)
- Specified by:
equals
in interfacePixelFormat.Composition
- Overrides:
equals
in classObject
-
-