From 0a6e8741cf6038c294c434ecc92f054932a608f6 Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Sat, 24 Mar 2018 14:44:15 -0400 Subject: [PATCH] Added ColorRGBA.fromIntABGR() as reciprocal to asIntABGR(). --- .../src/main/java/com/jme3/math/ColorRGBA.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java b/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java index 9180c69a6..f403bbaa6 100644 --- a/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java +++ b/jme3-core/src/main/java/com/jme3/math/ColorRGBA.java @@ -558,6 +558,19 @@ public final class ColorRGBA implements Savable, Cloneable, java.io.Serializable a = ((byte) (color) & 0xFF) / 255f; return this; } + /** + * Sets the RGBA values of this ColorRGBA with the given combined ABGR value + * Bits 24-31 are alpha, bits 16-23 are blue, bits 8-15 are green, bits 0-7 are red. + * @param color The integer ABGR value used to set this object. + * @return this + */ + public ColorRGBA fromIntABGR(int color) { + a = ((byte) (color >> 24) & 0xFF) / 255f; + b = ((byte) (color >> 16) & 0xFF) / 255f; + g = ((byte) (color >> 8) & 0xFF) / 255f; + r = ((byte) (color) & 0xFF) / 255f; + return this; + } /** * Transform this ColorRGBA to a Vector3f using