/** * Set the component values of this color attribute. The alpha component will be set to 1.0 (fully * opaque). * * <p>All color component values should be between 0.0 (none) and 1.0 (full). * * @param red The red component value which the color is to have. * @param green The green component value which the color is to have. * @param blue The blue component value which the color is to have. * @throws IllegalArgumentException If the specified red, green, blue or alpha values are outside * the supported range from 0.0 to 1.0. */ @XmlTransient public void set(float red, float green, float blue, float alpha) throws IllegalArgumentException { components.setRed(red); components.setGreen(green); components.setBlue(blue); components.setAlpha(alpha); }
/** {@inheritDoc} */ @XmlTransient @Override public boolean setFrom(StyleAttribute otherAttribute) { if (otherAttribute instanceof ColorStyleAttribute) { ColorStyleAttribute otherColorAttribute = (ColorStyleAttribute) otherAttribute; components.setRed(otherColorAttribute.getRed()); components.setGreen(otherColorAttribute.getGreen()); components.setBlue(otherColorAttribute.getBlue()); components.setAlpha(otherColorAttribute.getAlpha()); return true; } return false; }
/** * Set the red portion of the color value. Values should be between 0.0 and 1.0. * * @param red The red portion of the color value. * @throws IllegalArgumentException If the specified red value was outside the valid range from * 0.0 to 1.0. */ @Override public void setRed(float red) throws IllegalArgumentException { components.setRed(red); }