Class RGBAColor
java.lang.Object
software.xdev.chartjs.model.color.RGBAColor
Immutable RGBa color model.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final doublestatic final RGBAColorstatic final RGBAColorstatic final RGBAColorprotected final intstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorprotected final intstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorprotected final intprotected static final Randomstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColorstatic final RGBAColor -
Constructor Summary
ConstructorsConstructorDescriptionRGBAColor(int r, int g, int b) Constructs a new Color instance with alpha set fully opaqueRGBAColor(int r, int g, int b, double alpha) Constructs a new Color instanceConstructs a new Color instance with the RGB values of the Color argument and the alpha transparency of the double argument. -
Method Summary
Modifier and TypeMethodDescriptionbooleandoublegetAlpha()intgetB()intgetG()intgetR()inthashCode()static booleanisAlphaWithinBounds(double alpha) Verify that argument is valid value for the alpha channel.static booleanisChannelWithinBounds(int channel) Verify that argument is valid value for the R, G or B channel.static RGBAColorrandom()Constructs and returns a new fully random Color instance.rgba()toString()
-
Field Details
-
RANDOMIZER
-
TRANSPARENT
-
BLACK
-
WHITE
-
RED
-
LIME
-
BLUE
-
YELLOW
-
CYAN
-
MAGENTA
-
SILVER
-
GRAY
-
MAROON
-
OLIVE
-
GREEN
-
PURPLE
-
TEAL
-
NAVY
-
DARK_RED
-
BROWN
-
CRIMSON
-
DARK_SALMON
-
SALMON
-
LIGHT_SALMON
-
ORANGE_RED
-
DARK_ORANGE
-
ORANGE
-
GOLD
-
DARK_KHAKI
-
KHAKI
-
YELLOW_GREEN
-
DARK_OLIVE_GREEN
-
GREEN_YELLOW
-
DARK_GREEN
-
DARK_CYAN
-
LIGHT_CYAN
-
AQUA
-
DARK_TURQUOISE
-
TURQUOISE
-
MEDIUM_TURQUOISE
-
PALE_TURQUOISE
-
AQUA_MARINE
-
LIGHT_BLUE
-
SKY_BLUE
-
LIGHT_SKY_BLUE
-
MIDNIGHT_BLUE
-
DARK_BLUE
-
MEDIUM_BLUE
-
BLUE_VIOLET
-
VIOLET
-
DEEP_PINK
-
HOT_PINK
-
LIGHT_PINK
-
PINK
-
LIGHT_YELLOW
-
CHOCOLATE
-
TAN
-
LINEN
-
LAVENDER
-
AZURE
-
DIM_GRAY
-
DARK_GRAY
-
LIGHT_GRAY
-
r
protected final int r -
g
protected final int g -
b
protected final int b -
alpha
protected final double alpha
-
-
Constructor Details
-
RGBAColor
public RGBAColor(int r, int g, int b, double alpha) Constructs a new Color instance- Parameters:
r- value for Red color channel. Value between 0 and 255 (inclusive).g- value for Green color channel. Value between 0 and 255 (inclusive).b- value for Blue color channel. Value between 0 and 255 (inclusive).alpha- value for alpha transparency. Value between 0 and 1 (inclusive), with 0 fully transparent and 1 fully opaque.
-
RGBAColor
public RGBAColor(int r, int g, int b) Constructs a new Color instance with alpha set fully opaque- Parameters:
r- value for Red color channel. Value between 0 and 255 (inclusive).g- value for Green color channel. Value between 0 and 255 (inclusive).b- value for Blue color channel. Value between 0 and 255 (inclusive).
-
RGBAColor
Constructs a new Color instance with the RGB values of the Color argument and the alpha transparency of the double argument.
-
-
Method Details
-
random
Constructs and returns a new fully random Color instance.- Returns:
- Color
-
isChannelWithinBounds
public static boolean isChannelWithinBounds(int channel) Verify that argument is valid value for the R, G or B channel.
Any integer between 0 and 255 (inclusive) is valid.
- Returns:
- true if argument is valid R, G or B value
-
isAlphaWithinBounds
public static boolean isAlphaWithinBounds(double alpha) Verify that argument is valid value for the alpha channel.
Any double between 0.0d and 1.0d (inclusive) is valid.
- Returns:
- true if argument is valid alpha value
-
getR
public int getR()- Returns:
- red channel value, between 0 and 255 (inclusive)
-
getG
public int getG()- Returns:
- green channel value, between 0 and 255 (inclusive)
-
getB
public int getB()- Returns:
- blue channel value, between 0 and 255 (inclusive)
-
getAlpha
public double getAlpha()- Returns:
- alpha channel value, between 0.0d and 1.0d (inclusive)
-
rgba
- Returns:
- serialized version of this
Color, as used for JSON.
-
toString
-
equals
-
hashCode
public int hashCode()
-