Package playn.core
Class Color
java.lang.Object
playn.core.Color
Utility methods for working with packed-integer colors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final int
alpha
(int color) Extracts the alpha, in range [0, 255], from the given packed color.static int
argb
(int a, int r, int g, int b) Creates a packed integer color from four ARGB values in the range [0, 255].static final int
blue
(int color) Extracts the blue component, in range [0, 255], from the given packed color.static float
decodeLower
(float encoded) Decodes and returns the lower color value in a two color value encoded byencode(float, float)
.static float
decodeUpper
(float encoded) Decodes and returns the upper color value in a two color value encoded byencode(float, float)
.static float
encode
(float upper, float lower) Encodes two [0..1] color values into the format used by the standard shader program.static final int
green
(int color) Extracts the green component, in range [0, 255], from the given packed color.static final int
red
(int color) Extracts the red component, in range [0, 255], from the given packed color.static int
rgb
(int r, int g, int b) Creates a packed integer color from three RGB values in the range [0, 255].static int
withAlpha
(int color, int alpha) Returns a new color that's a copy of the given color, but with the new alpha value, in range [0, 255].
-
Constructor Details
-
Color
public Color()
-
-
Method Details
-
argb
public static int argb(int a, int r, int g, int b) Creates a packed integer color from four ARGB values in the range [0, 255]. -
rgb
public static int rgb(int r, int g, int b) Creates a packed integer color from three RGB values in the range [0, 255]. -
alpha
public static final int alpha(int color) Extracts the alpha, in range [0, 255], from the given packed color. -
red
public static final int red(int color) Extracts the red component, in range [0, 255], from the given packed color. -
green
public static final int green(int color) Extracts the green component, in range [0, 255], from the given packed color. -
blue
public static final int blue(int color) Extracts the blue component, in range [0, 255], from the given packed color. -
withAlpha
public static int withAlpha(int color, int alpha) Returns a new color that's a copy of the given color, but with the new alpha value, in range [0, 255]. -
encode
public static float encode(float upper, float lower) Encodes two [0..1] color values into the format used by the standard shader program. The standard shader program delivers tinting information as two floats per vertex (AR and GB). -
decodeUpper
public static float decodeUpper(float encoded) Decodes and returns the upper color value in a two color value encoded byencode(float, float)
. -
decodeLower
public static float decodeLower(float encoded) Decodes and returns the lower color value in a two color value encoded byencode(float, float)
.
-