summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/salamander/svg/basic/SVGColor.java
blob: 13eed11537dcd7fcee6dc491fee615a876a2c270 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * SVGColor.java
 *
 * Created on April 12, 2007, 2:02 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.kitfox.salamander.svg.basic;

import com.kitfox.salamander.svg.DOMString;
import com.kitfox.salamander.svg.SVGException;
import org.w3c.dom.css.CSSValue;
import org.w3c.dom.css.RGBColor;

/**
 * 
 * The SVGColor interface corresponds to color value definition for properties 'stop-color', 'flood-color' and 'lighting-color' and is a base class for interface SVGPaint. It incorporates SVG's extended notion of color, which incorporates ICC-based color specifications.
 * 
 * Interface SVGColor does not correspond to the <color> basic data type. For the <color> basic data type, the applicable DOM interfaces are defined in [DOM2-CSS]; in particular, see the [DOM2-CSS-RGBCOLOR].
 * @author kitfox
 */
public interface SVGColor extends SVGDataType, CSSValue
{
    public static enum Type {
        /**
         * The color type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
         */
        UNKNOWN, 
        /**
         * An sRGB color has been specified without an alternative ICC color specification.
         */
        RGBCOLOR, 
        /**
         * An sRGB color has been specified along with an alternative ICC color specification.
         */
        RGBCOLOR_ICCCOLOR, 
        /**
         * Corresponds to when keyword 'currentColor' has been specified.
         */
        CURRENTCOLOR};
    
    /**
     * The type of the value as specified by one of the constants specified above.
     */
    public Type getColorType();
    /**
     * The color specified in the sRGB color space.
     */
    public RGBColor getRGBColor();
    /**
     * The alternate ICC color specification.
     */
    public SVGICCColor getICCColor();
    
    /**
     * Modifies the color value to be the specified sRGB color without an alternate ICC color specification.
     * @param rgbColor The new color value.
     * @throws com.kitfox.salamander.svg.SVGException SVG_INVALID_VALUE_ERR: Raised if one of the parameters has an invalid value.
     */
    public void setRGBColor(DOMString rgbColor) throws SVGException;
    /**
     * Modifies the color value to be the specified sRGB color with an alternate ICC color specification.
     * @param rgbColor The new color value.
     * @param iccColor The alternate ICC color specification.
     * @throws com.kitfox.salamander.svg.SVGException SVG_INVALID_VALUE_ERR: Raised if one of the parameters has an invalid value.
     */
    public void setRGBColorICCCOlor(DOMString rgbColor, DOMString iccColor) throws SVGException;
    /**
     * Sets the colorType as specified by the parameters. If colorType requires an RGBColor, then rgbColor must be a valid RGBColor object; otherwise, rgbColor must be null. If colorType requires an SVGICCColor, then iccColor must be a valid SVGICCColor object; otherwise, iccColor must be null.
     * @param colorType One of the defined constants for colorType.
     * @param rgbColor The specification of an sRGB color, or null.
     * @param iccColor The specification of an ICC color, or null.
     * @throws com.kitfox.salamander.svg.SVGException SVG_INVALID_VALUE_ERR: Raised if one of the parameters has an invalid value.
     */
    public void setColor(Type colorType, DOMString rgbColor, DOMString iccColor) throws SVGException;
    
}