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
ConstructorsConstructorDescriptionCSSRGBA(int nRed, int nGreen, int nBlue, float fOpacity) ConstructorCopy constructorConstructorConstructorConstructor -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel) Get the contents of this object as a serialized CSS string for writing to an output.getAsRGB()final StringgetBlue()getClone()final StringgetGreen()final Stringfinal StringgetRed()inthashCode()final CSSRGBAfinal CSSRGBAfinal CSSRGBAsetOpacity(String sOpacity) final CSSRGBAtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
Constructor Details
-
CSSRGBA
Copy constructor- Parameters:
aOther- The object to copy the data from. May not benull.
-
CSSRGBA
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
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 Details
-
getRed
- Returns:
- red part
-
setRed
-
getGreen
- Returns:
- green part
-
setGreen
-
getBlue
- Returns:
- blue part
-
setBlue
-
getOpacity
- Returns:
- opacity part
-
setOpacity
-
getAsRGB
- Returns:
- This value as RGB value without the opacity. Never
null. - Since:
- 3.8.3
-
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
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSRGBA>- Since:
- 3.8.3
-
equals
-
hashCode
public int hashCode() -
toString
-