Package com.helger.css.decl
Class CSSRGBA
- java.lang.Object
-
- com.helger.css.decl.CSSRGBA
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSRGBA>
,ICSSColor
,ICSSWriteable
@NotThreadSafe public class CSSRGBA extends Object implements ICSSWriteable, ICSSColor, com.helger.commons.lang.ICloneable<CSSRGBA>
Represents a single RGBA color value (red, green, blue, opacity)- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description CSSRGBA(int nRed, int nGreen, int nBlue, float fOpacity)
ConstructorCSSRGBA(CSSRGBA aOther)
Copy constructorCSSRGBA(CSSRGB aOther, float fOpacity)
ConstructorCSSRGBA(CSSRGB aOther, String sOpacity)
ConstructorCSSRGBA(String sRed, String sGreen, String sBlue, String sOpacity)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel)
Get the contents of this object as a serialized CSS string for writing to an output.CSSRGB
getAsRGB()
String
getAsString()
String
getBlue()
CSSRGBA
getClone()
String
getGreen()
String
getOpacity()
String
getRed()
int
hashCode()
CSSRGBA
setBlue(String sBlue)
CSSRGBA
setGreen(String sGreen)
CSSRGBA
setOpacity(String sOpacity)
CSSRGBA
setRed(String sRed)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
-
-
-
Constructor Detail
-
CSSRGBA
public CSSRGBA(@Nonnull CSSRGBA aOther)
Copy constructor- Parameters:
aOther
- The object to copy the data from. May not benull
.
-
CSSRGBA
public CSSRGBA(@Nonnull CSSRGB aOther, float fOpacity)
Constructor- Parameters:
aOther
- The RGB value to use as the basis. May not benull
.fOpacity
- Opacity part. Is fitted to a value between 0 and 1.- Since:
- 3.8.3
-
CSSRGBA
public CSSRGBA(@Nonnull CSSRGB aOther, @Nonnull @Nonempty String sOpacity)
Constructor- Parameters:
aOther
- The RGB value to use as the basis. May not benull
.sOpacity
- Opacity part. May neither benull
nor empty.- Since:
- 3.8.3
-
CSSRGBA
public CSSRGBA(int nRed, int nGreen, int nBlue, float fOpacity)
Constructor- Parameters:
nRed
- Red part. Is fitted to a value between 0 and 255.nGreen
- Green part. Is fitted to a value between 0 and 255.nBlue
- Blue part. Is fitted to a value between 0 and 255.fOpacity
- Opacity part. Is fitted to a value between 0 and 1.
-
CSSRGBA
public CSSRGBA(@Nonnull @Nonempty String sRed, @Nonnull @Nonempty String sGreen, @Nonnull @Nonempty String sBlue, @Nonnull @Nonempty String sOpacity)
Constructor- Parameters:
sRed
- Red part. May neither benull
nor empty.sGreen
- Green part. May neither benull
nor empty.sBlue
- Blue part. May neither benull
nor empty.sOpacity
- Opacity part. May neither benull
nor empty.
-
-
Method Detail
-
getAsRGB
@Nonnull public CSSRGB getAsRGB()
- Returns:
- This value as RGB value without the opacity. Never
null
. - Since:
- 3.8.3
-
getAsString
@Nonnull @Nonempty public String getAsString()
- Specified by:
getAsString
in interfaceICSSColor
- Returns:
- The textual representation of the color.
- Since:
- 3.8.3
-
getAsCSSString
@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
Description copied from interface:ICSSWriteable
Get the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSString
in interfaceICSSWriteable
- Parameters:
aSettings
- The settings to be used to format the output. May not benull
.nIndentLevel
- The current indentation level- Returns:
- The content of this object as CSS string. Never
null
.
-
getClone
@Nonnull public CSSRGBA getClone()
- Specified by:
getClone
in interfacecom.helger.commons.lang.ICloneable<CSSRGBA>
- Since:
- 3.8.3
-
-