Color (API Reference)
Package com.here.sdk.core
Class Color
java.lang.Object
com.here.sdk.core.Color
Represents a color value.
The class is compatible with the native package android.graphics and
replaces native class Color.
Usage example:
import com.here.sdk.core.Color; import static android.graphics.Color.BLUE; import static android.graphics.Color.green; // Convert native colors to HERE color. Color blue = Color.valueOf(android.graphics.Color.BLUE); Color anotherColor = Color.valueOf(0.25f, 0.5f, 0.75f, 0.9f); //ARGB // Retrieve the blue color component. float blueColorValue = anotherColor.blue(); // = 0.9f // Convert back to a native color component with the range [0,255]. int greenColorValue = android.graphics.Color.green(anotherColor.toArgb()); // = 230
-
Method Summary
Modifier and TypeMethodDescriptionfloatalpha()floatblue()booleanfloatgreen()inthashCode()floatred()inttoArgb()Converts this color to an ARGB color int.toString()static ColorvalueOf(float red, float green, float blue) Creates a new opaque color from individual RGB components.static ColorvalueOf(float red, float green, float blue, float alpha) Creates a new color from individual RGBA components.static ColorvalueOf(int color)
-
Method Details
-
valueOf
Creates a new opaque color from individual RGB components.- Parameters:
red-the value of red component [0,1]
green-the value of green component [0,1]
blue-the value of blue component [0,1]
- Returns:
- a new Color instance from given components.
-
valueOf
Creates a new color from individual RGBA components.- Parameters:
red-the value of red component [0,1]
green-the value of green component [0,1]
blue-the value of blue component [0,1]
alpha-the value of alpha component [0,1]
- Returns:
- a new Color instance from given components.
-
valueOf
- Parameters:
color- ARGB color int- Returns:
- a new Color instance from color int.
-
red
public float red()- Returns:
- value of red component in range [0,1]
-
green
public float green()- Returns:
- value of green component in range [0,1]
-
blue
public float blue()- Returns:
- value of blue component in range [0,1]
-
alpha
public float alpha()- Returns:
- value of alpha component in range [0,1]
-
toArgb
@ColorInt public int toArgb()Converts this color to an ARGB color int.- Returns:
- ARGB color int
-
toString
-
equals
-
hashCode
public int hashCode()
-