summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/salamander/svg/paint/SVGPaint.java
blob: 55ac767114f64c60869a1a0a512b383da06ddd18 (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
80
81
82
83
84
85
86
87
/*
 * SVGPaint.java
 *
 * Created on April 12, 2007, 2:12 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.kitfox.salamander.svg.paint;

import com.kitfox.salamander.svg.SVGException;
import com.kitfox.salamander.svg.basic.SVGDataType;
import com.kitfox.salamander.svg.DOMString;

/**
 * 
 * The SVGPaint interface corresponds to basic type <paint> and represents the values of properties 'fill' and 'stroke'.
 * @author kitfox
 */
public interface SVGPaint extends SVGDataType
{
    public static enum Type {
        /**
         * The paint 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 a 'none' value on a <paint> specification.
         */
        NONE, 
        /**
         * Corresponds to a 'currentColor' value on a <paint> specification.
         */
        CURRENTCOLOR, 
        /**
         * A URI has been specified, along with an explicit 'none' as the backup paint method in case the URI is unavailable or invalid.
         */
        URI_NONE, 
        /**
         * A URI has been specified, along with 'currentColor' as the backup paint method in case the URI is unavailable or invalid.
         */
        URI_CURRENTCOLOR, 
        /**
         * A URI has been specified, along with an sRGB color as the backup paint method in case the URI is unavailable or invalid.
         */
        URI_RGBCOLOR, 
        /**
         * A URI has been specified, along with both an sRGB color and alternate ICC color as the backup paint method in case the URI is unavailable or invalid.
         */
        URI_RGBCOLOR_ICCCOLOR, 
        /**
         * Only a URI has been specified.
         */
        URI};
    
    /**
     * The type of paint, identified by one of the constants above.
     */
    public Type getPaintType();
    /**
     * When the paintType specifies a URI, this attribute holds the URI string. When the paintType does not specify a URI, this attribute is null.
     */
    public DOMString getUri();
    /**
     * Sets the paintType to SVG_PAINTTYPE_URI_NONE and sets uri to the specified value.
     * @param uri The URI for the desired paint server.
     */
    public void setUri(DOMString uri);
    /**
     * Sets the paintType as specified by the parameters. If paintType requires a URI, then uri must be non-null and a valid string; otherwise, uri must be null. If paintType requires an RGBColor, then rgbColor must be a valid RGBColor object; otherwise, rgbColor must be null. If paintType requires an SVGICCColor, then iccColor must be a valid SVGICCColor object; otherwise, iccColor must be null.
     * @param paintType One of the defined constants for paintType.
     * @param uri The URI for the desired paint server, or null.
     * @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 setPaint(Type paintType, String uri, String rgbColor, String iccColor) throws SVGException;
}