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 booleanequals(Object o)StringgetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel)Get the contents of this object as a serialized CSS string for writing to an output.CSSRGBgetAsRGB()StringgetAsString()StringgetBlue()CSSRGBAgetClone()StringgetGreen()StringgetOpacity()StringgetRed()inthashCode()CSSRGBAsetBlue(String sBlue)CSSRGBAsetGreen(String sGreen)CSSRGBAsetOpacity(String sOpacity)CSSRGBAsetRed(String sRed)StringtoString()-
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 benullnor 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 benullnor empty.sGreen- Green part. May neither benullnor empty.sBlue- Blue part. May neither benullnor empty.sOpacity- Opacity part. May neither benullnor 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:
getAsStringin 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:ICSSWriteableGet the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSStringin 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:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSRGBA>- Since:
- 3.8.3
-
-