Package com.badlogic.gdx.utils
Class NumberUtils
- java.lang.Object
-
- com.badlogic.gdx.utils.NumberUtils
-
public final class NumberUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NumberUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
doubleToLongBits(double value)
static int
floatToIntBits(float value)
static int
floatToIntColor(float value)
Converts the color from a float ABGR encoding to an int ABGR encoding.static int
floatToRawIntBits(float value)
static float
intBitsToFloat(int value)
static float
intToFloatColor(int value)
Encodes the ABGR int color as a float.static double
longBitsToDouble(long value)
-
-
-
Method Detail
-
floatToIntBits
public static int floatToIntBits(float value)
-
floatToRawIntBits
public static int floatToRawIntBits(float value)
-
floatToIntColor
public static int floatToIntColor(float value)
Converts the color from a float ABGR encoding to an int ABGR encoding. The alpha is expanded from 0-254 in the float encoding (seeintToFloatColor(int)
) to 0-255, which means converting from int to float and back to int can be lossy.
-
intToFloatColor
public static float intToFloatColor(int value)
Encodes the ABGR int color as a float. The alpha is compressed to use only even numbers between 0-254 to avoid using bits in the NaN range (seeFloat.intBitsToFloat(int)
javadocs). Rendering which uses colors encoded as floats should expand the 0-254 back to 0-255, else colors cannot be fully opaque.
-
intBitsToFloat
public static float intBitsToFloat(int value)
-
doubleToLongBits
public static long doubleToLongBits(double value)
-
longBitsToDouble
public static double longBitsToDouble(long value)
-
-