Class Rgba
- Since:
- 2.0.0
-
Field Summary
Fields inherited from class dev.jaxydog.astral.utility.color.Rgb
ALPHA_MASK, BLUE_MASK, GREEN_MASK, RED_MASK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintalpha()Returns the color's alpha component.doubleReturns the color's alpha component, scaled between the range[0, 1].intinteger()Returns the color as an integer.map(IntUnaryOperator map) Maps each RGB color component using the given method.mix(Rgba other, IntBinaryOperator mix) Mixes two colors together by combining their color components.withAlpha(double alpha) Sets the color's alpha component.withAlpha(int alpha) Sets the color's alpha component.withBlue(double blue) Sets the color's blue component.withBlue(int blue) Sets the color's blue component.withBrightness(float brightness) Sets the color's brightness.withGreen(double green) Sets the color's green component.withGreen(int green) Sets the color's green component.withHue(float hue) Sets the color's hue.withRed(double red) Sets the color's red component.withRed(int red) Sets the color's red component.withSaturation(float saturation) Sets the color's saturation.Methods inherited from class dev.jaxydog.astral.utility.color.Rgb
blue, blueScaled, brightness, green, greenScaled, hue, mix, red, redScaled, saturation
-
Constructor Details
-
Rgba
public Rgba(int red, int green, int blue, int alpha) Creates a new RGBA value.The provided values are expected to be within a range of
[0, 255]. If a value exceeds this, it will be clamped.- Parameters:
red- The red component.green- The green component.blue- The blue component.alpha- The alpha component.- Since:
- 2.0.0
-
Rgba
public Rgba(double red, double green, double blue, double alpha) Creates a new RGBA value.The provided values are expected to be within a range of
[0, 1]. If a value exceed this, it will be clamped.- Parameters:
red- The red component.green- The green component.blue- The blue component.alpha- The alpha component.- Since:
- 2.0.0
-
Rgba
public Rgba(int rgba) Creates a new RGBA value.- Parameters:
rgba- The color as an integer.- Since:
- 2.0.0
-
Rgba
Creates a new RGBA value.- Parameters:
rgb- The RBG value.alpha- The alpha component.- Since:
- 2.0.0
-
Rgba
Creates a new RGBA value.- Parameters:
rgb- The RBG value.alpha- The alpha component.- Since:
- 2.0.0
-
-
Method Details
-
alpha
public int alpha()Returns the color's alpha component.- Returns:
- The alpha component.
- Since:
- 2.0.0
-
alphaScaled
public double alphaScaled()Returns the color's alpha component, scaled between the range[0, 1].- Returns:
- The alpha component.
- Since:
- 2.0.0
-
withAlpha
Sets the color's alpha component.The given hue should be within a range of
[0, 255]. If the value exceeds this, it will be clamped.- Parameters:
alpha- The new alpha component.- Returns:
- A new color.
- Since:
- 2.0.0
-
withAlpha
Sets the color's alpha component.The given hue should be within a range of
[0, 1]. If the value exceeds this, it will be clamped.- Parameters:
alpha- The new alpha component.- Returns:
- A new color.
- Since:
- 2.0.0
-
mix
Mixes two colors together by combining their color components.- Parameters:
other- The other color.mix- The mixing method.- Returns:
- A new, mixed color.
- Since:
- 2.0.0
-
integer
public int integer()Description copied from class:RgbReturns the color as an integer. -
withRed
Description copied from class:RgbSets the color's red component.The given hue should be within a range of
[0, 255]. If the value exceeds this, it will be clamped. -
withRed
Description copied from class:RgbSets the color's red component.The given hue should be within a range of
[0, 1]. If the value exceeds this, it will be clamped. -
withGreen
Description copied from class:RgbSets the color's green component.The given hue should be within a range of
[0, 255]. If the value exceeds this, it will be clamped. -
withGreen
Description copied from class:RgbSets the color's green component.The given hue should be within a range of
[0, 1]. If the value exceeds this, it will be clamped. -
withBlue
Description copied from class:RgbSets the color's blue component.The given hue should be within a range of
[0, 255]. If the value exceeds this, it will be clamped. -
withBlue
Description copied from class:RgbSets the color's blue component.The given hue should be within a range of
[0, 1]. If the value exceeds this, it will be clamped. -
withHue
Description copied from class:RgbSets the color's hue.The given hue should be within a range of
[0, 1]. If the value exceeds this, it will be wrapped. -
withSaturation
Description copied from class:RgbSets the color's saturation.The given saturation should be within a range of
[0, 1]. If the value exceeds this, it will be wrapped.- Overrides:
withSaturationin classRgb- Parameters:
saturation- The new saturation.- Returns:
- A new color.
-
withBrightness
Description copied from class:RgbSets the color's brightness.The given brightness should be within a range of
[0, 1]. If the value exceeds this, it will be wrapped.- Overrides:
withBrightnessin classRgb- Parameters:
brightness- The new brightness.- Returns:
- A new color.
-
map
Description copied from class:RgbMaps each RGB color component using the given method.
-