ArgbColor
Inheritance: java.lang.Object, com.aspose.ms.System.ValueType, com.aspose.ms.lang.Struct
All Implemented Interfaces: com.groupdocs.editor.htmlcss.css.datatypes.ICssDataType
public class ArgbColor extends Struct<ArgbColor> implements ICssDataType
Represents one color value in ARGB format with converters and serializers
This type is designed to be useful for (but not limited to) CSS operations. See more: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
Constructors
Constructor | Description |
---|---|
ArgbColor() |
Methods
Method | Description |
---|---|
fromRgba(int red, int green, int blue, int alpha) | Creates one ArgbColor value from specified Red, Green, Blue, and Alpha channels |
fromRgb(int red, int green, int blue) | Creates one ArgbColor value from specified Red, Green, Blue channels, while Alpha channel is fully opaque |
fromSingleValueRgb(byte value) | Creates a fully opaque (A=255) color from single value, which will be applied to all channels |
fromColor(Color color) | Creates one ArgbColor value from specified Color |
getValue() | Gets the Int32 value of the color. |
getA() | Gets the alpha part of the color. |
getAlpha() | Gets the alpha part of the color in percent (0..1). |
getR() | Gets the red part of the color. |
getG() | Gets the green part of the color. |
getB() | Gets the blue part of the color. |
isEmpty() | Uninitialized color - all 4 channels are set to 0. |
isDefault() | Indicates whether this ArgbColor instance is default (Transparent) - all 4 channels are set to 0 |
isFullyTransparent() | Indicates whether this ArgbColor instance is fully transparent - its Alpha channel has the min (0) value, so other R, G, and B channels has no visible effect. |
isTranslucent() | Indicates whether this ArgbColor instance is translucent (not fully transparent, but also not fully opaque) |
isFullyOpaque() | Indicates whether this ArgbColor instance is fully opaque, without transparency (its Alpha channel has max value) |
toSystemColor() | Converts a value of this ArgbColor instance to the Color instance and returns it |
toRGBA() | Serializes this ArgbColor instance to the ‘rgba’ CSS function notation |
toRGB() | Serializes this ArgbColor instance to the ‘rgb’ CSS function notation |
serializeDefault() | Serializes this ArgbColor instance to the most appropriate CSS function notation depending on translucency |
toString() | Same as #serializeDefault.serializeDefault |
op_Equality(ArgbColor left, ArgbColor right) | Compares two colors and returns a boolean indicating if the two do match. |
op_Inequality(ArgbColor left, ArgbColor right) | Compares two colors and returns a boolean indicating if the two do not match. |
equals(ArgbColor other) | Checks two ArgbColor colors for equality |
equals(ICssDataType other) | Checks two ArgbColor colors for equality |
equals(Object other) | Tests if another object is equal to this ArgbColor instance. |
hashCode() | Returns a hash code that defines the current color. |
ArgbColor()
public ArgbColor()
fromRgba(int red, int green, int blue, int alpha)
public static ArgbColor fromRgba(int red, int green, int blue, int alpha)
Creates one ArgbColor value from specified Red, Green, Blue, and Alpha channels
Parameters:
Parameter | Type | Description |
---|---|---|
red | int | Red channel value |
green | int | Green channel value |
blue | int | Blue channel value |
alpha | int | Alpha channel value |
Returns: ArgbColor - New ArgbColor value
fromRgb(int red, int green, int blue)
public static ArgbColor fromRgb(int red, int green, int blue)
Creates one ArgbColor value from specified Red, Green, Blue channels, while Alpha channel is fully opaque
Parameters:
Parameter | Type | Description |
---|---|---|
red | int | Red channel value |
green | int | Green channel value |
blue | int | Blue channel value |
Returns: ArgbColor - New ArgbColor value
fromSingleValueRgb(byte value)
public static ArgbColor fromSingleValueRgb(byte value)
Creates a fully opaque (A=255) color from single value, which will be applied to all channels
Parameters:
Parameter | Type | Description |
---|---|---|
value | byte | A byte value, same for Red, Green, and Blue channels |
Returns: ArgbColor - New ArgbColor instance
fromColor(Color color)
public static ArgbColor fromColor(Color color)
Creates one ArgbColor value from specified Color
Parameters:
Parameter | Type | Description |
---|---|---|
color | java.awt.Color |
Returns: ArgbColor -
getValue()
public final int getValue()
Gets the Int32 value of the color.
Returns: int
getA()
public final int getA()
Gets the alpha part of the color.
Returns: int
getAlpha()
public final double getAlpha()
Gets the alpha part of the color in percent (0..1).
Returns: double
getR()
public final int getR()
Gets the red part of the color.
Returns: int
getG()
public final int getG()
Gets the green part of the color.
Returns: int
getB()
public final int getB()
Gets the blue part of the color.
Returns: int
isEmpty()
public final boolean isEmpty()
Uninitialized color - all 4 channels are set to 0. Same as Default and Transparent.
Returns: boolean
isDefault()
public final boolean isDefault()
Indicates whether this ArgbColor instance is default (Transparent) - all 4 channels are set to 0
Returns: boolean
isFullyTransparent()
public final boolean isFullyTransparent()
Indicates whether this ArgbColor instance is fully transparent - its Alpha channel has the min (0) value, so other R, G, and B channels has no visible effect.
Returns: boolean
isTranslucent()
public final boolean isTranslucent()
Indicates whether this ArgbColor instance is translucent (not fully transparent, but also not fully opaque)
Returns: boolean
isFullyOpaque()
public final boolean isFullyOpaque()
Indicates whether this ArgbColor instance is fully opaque, without transparency (its Alpha channel has max value)
Returns: boolean
toSystemColor()
public final Color toSystemColor()
Converts a value of this ArgbColor instance to the Color instance and returns it
Returns: Color - New Color instance
toRGBA()
public final String toRGBA()
Serializes this ArgbColor instance to the ‘rgba’ CSS function notation
Returns: java.lang.String - A string with ‘rgba(r, g, b, a)’ format
toRGB()
public final String toRGB()
Serializes this ArgbColor instance to the ‘rgb’ CSS function notation
Returns: java.lang.String - A string with ‘rgb(r, g, b)’ format
serializeDefault()
public final String serializeDefault()
Serializes this ArgbColor instance to the most appropriate CSS function notation depending on translucency
Returns: java.lang.String - A string with ‘rgba(r, g, b, a)’ or ‘rgb(r, g, b)’ format
toString()
public String toString()
Same as #serializeDefault.serializeDefault
Returns: java.lang.String - Same return value as in #serializeDefault.serializeDefault
op_Equality(ArgbColor left, ArgbColor right)
public static boolean op_Equality(ArgbColor left, ArgbColor right)
Compares two colors and returns a boolean indicating if the two do match.
Parameters:
Parameter | Type | Description |
---|---|---|
left | ArgbColor | The first color to use. |
right | ArgbColor | The second color to use. |
Returns: boolean - True if both colors are equal, otherwise false.
op_Inequality(ArgbColor left, ArgbColor right)
public static boolean op_Inequality(ArgbColor left, ArgbColor right)
Compares two colors and returns a boolean indicating if the two do not match.
Parameters:
Parameter | Type | Description |
---|---|---|
left | ArgbColor | The first color to use. |
right | ArgbColor | The second color to use. |
Returns: boolean - True if both colors are not equal, otherwise false.
equals(ArgbColor other)
public final boolean equals(ArgbColor other)
Checks two ArgbColor colors for equality
Parameters:
Parameter | Type | Description |
---|---|---|
other | ArgbColor | The other ArgbColor color |
Returns: boolean - True if both colors or equal, otherwise false.
equals(ICssDataType other)
public final boolean equals(ICssDataType other)
Checks two ArgbColor colors for equality
Parameters:
Parameter | Type | Description |
---|---|---|
other | ICssDataType | The other ArgbColor color, casted to the ICssDataType |
Returns: boolean - True if both colors or equal, otherwise false.
equals(Object other)
public boolean equals(Object other)
Tests if another object is equal to this ArgbColor instance.
Parameters:
Parameter | Type | Description |
---|---|---|
other | java.lang.Object | The object to test with. |
Returns: boolean - True if the two objects are equal, otherwise false.
hashCode()
public int hashCode()
Returns a hash code that defines the current color.
Returns: int - The integer value of the hashcode.