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 intbitsPerPixel()Number of bits per pixel, e.g.intbitStride()Bit distance between pixels.intbytesPerPixel()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().intcomponentCount()Number of components per pixel, e.g.PixelFormat.CType[]componentOrder()Returns theComponent typeorder of all components, seePixelFormat.Composition.componentBitMask().intdecodeSingleI32(int shifted, int cIdx)Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()of up to 32bit.intdecodeSingleI64(long shifted, int cIdx)Decodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()of up to 64bit.intdefaultValue(int cIdx, boolean shiftResult)intencode3CompI32(int c1NormI32, int c2NormI32, int c3NormI32)intencode3CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8)intencode4CompI32(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32)intencode4CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8)intencodeSingleI32(int norm, int cIdx)longencodeSingleI64(int norm, int cIdx)intencodeSingleI8(byte normI8, int cIdx)booleanequals(Object obj)ReturnsObject.equals(Object)intfind(PixelFormat.CType s)Returns the index of givenPixelFormat.CTypewithinPixelFormat.Composition.componentOrder(), -1 if not exists.intfromFloat(float f, int cIdx, boolean shiftResult)inthashCode()Returns cached immutable hash value, seeObject.hashCode().booleanisInterleaved()Returnstrueif all components are packed, i.e.booleanisUniform()Returnstrueif all components are of same bit-size, e.g.floattoFloat(int i32, int cIdx, boolean i32Shifted)StringtoString()ReturnsObject.toString().
-
-
-
Constructor Detail
-
PackedComposition
public PackedComposition(PixelFormat.CType[] componentOrder, int componentCount, int bpc, int bitStride)
- Parameters:
componentOrder-Component typeorder 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 typeorder 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.CompositionReturnsObject.toString().- Specified by:
toStringin interfacePixelFormat.Composition- Overrides:
toStringin classObject
-
isUniform
public final boolean isUniform()
Description copied from interface:PixelFormat.Composition- Specified by:
isUniformin interfacePixelFormat.Composition
-
isInterleaved
public final boolean isInterleaved()
Returnstrueif all components are packed, i.e. interleaved, e.g.RGBA8888, otherwisefalse.Instances of
PixelFormat.PackedCompositionreturnstrue.- Specified by:
isInterleavedin interfacePixelFormat.Composition
-
componentCount
public final int componentCount()
Description copied from interface:PixelFormat.CompositionNumber of components per pixel, e.g. 3 forRGBx8888.- Specified by:
componentCountin interfacePixelFormat.Composition
-
bitsPerPixel
public final int bitsPerPixel()
Description copied from interface:PixelFormat.CompositionNumber of bits per pixel, e.g. 24 bits forRGBx8888.- Specified by:
bitsPerPixelin interfacePixelFormat.Composition
-
bitStride
public final int bitStride()
Description copied from interface:PixelFormat.CompositionBit distance between pixels.For packed pixels e.g. 32 bits for
RGBx8888.- Specified by:
bitStridein interfacePixelFormat.Composition
-
bytesPerPixel
public final int bytesPerPixel()
Description copied from interface:PixelFormat.CompositionNumber of bytes per pixel, i.e. packedPixelFormat.Composition.bitStride()in bytes, e.g. 4 forRGBx8888.- Specified by:
bytesPerPixelin interfacePixelFormat.Composition
-
componentOrder
public final PixelFormat.CType[] componentOrder()
Description copied from interface:PixelFormat.CompositionReturns theComponent typeorder of all components, seePixelFormat.Composition.componentBitMask().- Specified by:
componentOrderin interfacePixelFormat.Composition
-
find
public final int find(PixelFormat.CType s)
Description copied from interface:PixelFormat.CompositionReturns the index of givenPixelFormat.CTypewithinPixelFormat.Composition.componentOrder(), -1 if not exists.- Specified by:
findin interfacePixelFormat.Composition
-
componentBitMask
public final int[] componentBitMask()
Description copied from interface:PixelFormat.CompositionReturns the un-shifted bit-mask of all components.Components mask is returned in the order Low-Index to High-Index, e.g.:
- Specified by:
componentBitMaskin interfacePixelFormat.Composition
-
componentBitCount
public final int[] componentBitCount()
Description copied from interface:PixelFormat.CompositionReturns the number of bits of all components, seePixelFormat.Composition.componentBitMask().- Specified by:
componentBitCountin interfacePixelFormat.Composition
-
componentBitShift
public final int[] componentBitShift()
Description copied from interface:PixelFormat.CompositionReturns the bit-shift of all components, seePixelFormat.Composition.componentBitMask().- Specified by:
componentBitShiftin interfacePixelFormat.Composition
-
decodeSingleI32
public final int decodeSingleI32(int shifted, int cIdx)Description copied from interface:PixelFormat.CompositionDecodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()of up to 32bit.- Specified by:
decodeSingleI32in 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.CompositionDecodes a component from the shifted pixel data with aPixelFormat.Composition.bytesPerPixel()of up to 64bit.- Specified by:
decodeSingleI64in 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:
encodeSingleI32in interfacePixelFormat.Composition
-
encodeSingleI64
public final long encodeSingleI64(int norm, int cIdx)- Specified by:
encodeSingleI64in interfacePixelFormat.Composition
-
encode3CompI32
public final int encode3CompI32(int c1NormI32, int c2NormI32, int c3NormI32)- Specified by:
encode3CompI32in interfacePixelFormat.Composition
-
encode4CompI32
public final int encode4CompI32(int c1NormI32, int c2NormI32, int c3NormI32, int c4NormI32)- Specified by:
encode4CompI32in interfacePixelFormat.Composition
-
encodeSingleI8
public final int encodeSingleI8(byte normI8, int cIdx)- Specified by:
encodeSingleI8in interfacePixelFormat.Composition
-
encode3CompI8
public final int encode3CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8)- Specified by:
encode3CompI8in interfacePixelFormat.Composition
-
encode4CompI8
public final int encode4CompI8(byte c1NormI8, byte c2NormI8, byte c3NormI8, byte c4NormI8)- Specified by:
encode4CompI8in interfacePixelFormat.Composition
-
toFloat
public final float toFloat(int i32, int cIdx, boolean i32Shifted)- Specified by:
toFloatin interfacePixelFormat.Composition
-
fromFloat
public final int fromFloat(float f, int cIdx, boolean shiftResult)- Specified by:
fromFloatin interfacePixelFormat.Composition
-
defaultValue
public final int defaultValue(int cIdx, boolean shiftResult)- Specified by:
defaultValuein interfacePixelFormat.Composition
-
hashCode
public final int hashCode()
Description copied from interface:PixelFormat.CompositionReturns cached immutable hash value, seeObject.hashCode().- Specified by:
hashCodein interfacePixelFormat.Composition- Overrides:
hashCodein classObject
-
equals
public final boolean equals(Object obj)
Description copied from interface:PixelFormat.CompositionReturnsObject.equals(Object)- Specified by:
equalsin interfacePixelFormat.Composition- Overrides:
equalsin classObject
-
-