C# Class Axiom.Media.Bitwise

Class for manipulating bit patterns.
Afficher le fichier Open project: WolfgangSt/axiom Class Usage Examples

Méthodes publiques

Méthode Description
FirstPO2From ( uint n ) : uint

Returns the closest power-of-two number greater or equal to value.

0 and 1 are powers of two, so firstPO2From(0)==0 and firstPO2From(1)==1.

FixedToByteFixed ( uint value, int p ) : byte

Convert N bit colour channel value to 8 bits, and return as a byte. It fills P bits with thebit pattern repeated. (this is /((1<<n)-1) in fixed point)

FixedToFixed ( uint value, int n, int p ) : uint

Convert N bit colour channel value to P bits. It fills P bits with the bit pattern repeated. (this is /((1<<n)-1) in fixed point)

FixedToFloat ( uint value, int bits ) : float

Fixed point to float

FloatToByteFixed ( float value ) : byte

Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to an 8-bit integer, and return as a byte.

FloatToFixed ( float value, int bits ) : uint

Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to integer of a certain number of bits. Works for any value of bits between 0 and 31.

FloatToHalf ( float f ) : ushort

Convert a float32 to a float16 (NV_half_float) Courtesy of OpenEXR

FloatToHalfI ( uint i ) : ushort

Converts float in uint format to a a half in ushort format

HalfToFloat ( ushort y ) : float

Convert a float16 (NV_half_float) to a float32 Courtesy of OpenEXR

HalfToFloatI ( ushort y ) : uint

Converts a half in ushort format to a float in uint format

IntRead ( IntPtr src, int n ) : uint

Read a n*8 bits integer value to memory in native endian.

IntWrite ( IntPtr dest, int n, uint value ) : void
IsPow2 ( int number ) : bool

checks if a number is a power of 2

MostSignificantBitSet ( uint value ) : uint

Returns the most significant bit set in a value.

Method Details

FirstPO2From() public static méthode

Returns the closest power-of-two number greater or equal to value.
0 and 1 are powers of two, so firstPO2From(0)==0 and firstPO2From(1)==1.
public static FirstPO2From ( uint n ) : uint
n uint
Résultat uint

FixedToByteFixed() public static méthode

Convert N bit colour channel value to 8 bits, and return as a byte. It fills P bits with thebit pattern repeated. (this is /((1<<n)-1) in fixed point)
public static FixedToByteFixed ( uint value, int p ) : byte
value uint
p int
Résultat byte

FixedToFixed() public static méthode

Convert N bit colour channel value to P bits. It fills P bits with the bit pattern repeated. (this is /((1<<n)-1) in fixed point)
public static FixedToFixed ( uint value, int n, int p ) : uint
value uint
n int
p int
Résultat uint

FixedToFloat() public static méthode

Fixed point to float
public static FixedToFloat ( uint value, int bits ) : float
value uint
bits int
Résultat float

FloatToByteFixed() public static méthode

Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to an 8-bit integer, and return as a byte.
public static FloatToByteFixed ( float value ) : byte
value float
Résultat byte

FloatToFixed() public static méthode

Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to integer of a certain number of bits. Works for any value of bits between 0 and 31.
public static FloatToFixed ( float value, int bits ) : uint
value float
bits int
Résultat uint

FloatToHalf() public static méthode

Convert a float32 to a float16 (NV_half_float) Courtesy of OpenEXR
public static FloatToHalf ( float f ) : ushort
f float
Résultat ushort

FloatToHalfI() public static méthode

Converts float in uint format to a a half in ushort format
public static FloatToHalfI ( uint i ) : ushort
i uint
Résultat ushort

HalfToFloat() public static méthode

Convert a float16 (NV_half_float) to a float32 Courtesy of OpenEXR
public static HalfToFloat ( ushort y ) : float
y ushort
Résultat float

HalfToFloatI() public static méthode

Converts a half in ushort format to a float in uint format
public static HalfToFloatI ( ushort y ) : uint
y ushort
Résultat uint

IntRead() public static méthode

Read a n*8 bits integer value to memory in native endian.
public static IntRead ( IntPtr src, int n ) : uint
src System.IntPtr
n int
Résultat uint

IntWrite() public static méthode

public static IntWrite ( IntPtr dest, int n, uint value ) : void
dest System.IntPtr
n int
value uint
Résultat void

IsPow2() public static méthode

checks if a number is a power of 2
public static IsPow2 ( int number ) : bool
number int
Résultat bool

MostSignificantBitSet() public static méthode

Returns the most significant bit set in a value.
public static MostSignificantBitSet ( uint value ) : uint
value uint
Résultat uint