diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java index 5338fb84f6..a7b42cedf5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java @@ -2397,22 +2397,28 @@ public class PropertyFactory { /** * Converts Android color int to "rbga(r, g, b, a)" String equivalent. + * <p> + * Alpha value will be converted from 0-255 range to 0-1. + * </p> * * @param color Android color int * @return String rgba color */ public static String colorToRgbaString(@ColorInt int color) { - return String.format(Locale.US, "rgba(%d, %d, %d, %d)", - (color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, (color >> 24) & 0xFF); + return String.format(Locale.US, "rgba(%d, %d, %d, %.001f)", + (color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, ((color >> 24) & 0xFF) / 255.0f); } /** - * Converts Android color int to rgba int array. + * Converts Android color int to rgba float array. + * <p> + * Alpha value will be converted from 0-255 range to 0-1. + * </p> * * @param color Android color int * @return int rgba array */ - public static int[] colorToRgbaArray(@ColorInt int color) { - return new int[] {(color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, (color >> 24) & 0xFF}; + public static float[] colorToRgbaArray(@ColorInt int color) { + return new float[] {(color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, ((color >> 24) & 0xFF) / 255.0f}; } } |