|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package org.w3c.dom.svg; |
|
18 |
|
19 import org.w3c.dom.DOMException; |
|
20 |
|
21 /** |
|
22 * <p>This interface represents <svg> element in (SVG) document tree.</p> |
|
23 * <h4>User Agent Transforms</h4> |
|
24 * <p> |
|
25 * The DOM attributes currentScale, currentRotate and currentTranslate are combined to form user agent transformation |
|
26 * which is applied at the outermost level on the SVG document (i.e., outside the outermost 'svg' element) if "magnification" |
|
27 * is enabled (i.e., zoomAndPan attribute is set to "magnify"). Their values |
|
28 * can potentialy be modified through user-agent specific UI. User agent transformation can be obtained |
|
29 * by multiplying matrix |
|
30 * <p> |
|
31 * <pre> |
|
32 * [currentScale 0 currentTranslate.x] [cos(currentRotate) -sin(currentRotate 0] |
|
33 * [ 0 currentScale currentTranslate.y] by [sin(currentRotate) cos(currentRotate) 0] |
|
34 * [ 0 0 1 ] [ 0 0 1] |
|
35 * </pre> |
|
36 * </p> |
|
37 * |
|
38 * i.e. (translate, then scale, then rotate the coordinate system). The reference point for scale and rotate operations is the origin (0, 0). |
|
39 * </p> |
|
40 * |
|
41 * <p><b>Note:</b> If the application does not have the necessary privilege rights to access this (SVG) |
|
42 * content, a SecurityException may be thrown by the underlying implementation. This is applicable |
|
43 * to all the Tree navigation and Trait acessor methods. Features such as zooming, panning and |
|
44 * playing of animations will not be affected. |
|
45 * </p> |
|
46 */ |
|
47 public interface SVGSVGElement extends SVGLocatableElement |
|
48 { |
|
49 /** |
|
50 * Sets current user agent scale (zoom) coefficient. |
|
51 * |
|
52 * @param value the value of user agent scale coefficient to be set. |
|
53 * @throws DOMException with error code INVALID_ACCESS_ERR if the scale value is set to zero. |
|
54 */ |
|
55 public void setCurrentScale(float value) |
|
56 throws DOMException; |
|
57 |
|
58 /** |
|
59 * Returns current user agent scale (zoom) coefficient. The initial value for currentScale is 1. |
|
60 * |
|
61 * @return the current user agent scale coefficient. |
|
62 */ |
|
63 public float getCurrentScale(); |
|
64 |
|
65 /** |
|
66 * Sets current user agent rotate coefficient in degrees. |
|
67 * |
|
68 * @param value the value of user agent rotate coefficient to be set. |
|
69 */ |
|
70 public void setCurrentRotate(float value); |
|
71 |
|
72 /** |
|
73 * Returns current user agent rotation angle in degrees. The initial value for currentRotate is 0. |
|
74 * |
|
75 * @return the current user agent rotation coefficient in degrees. |
|
76 */ |
|
77 public float getCurrentRotate(); |
|
78 |
|
79 /** |
|
80 * Current user agent translation used for scrolling or panning (The returned {@link org.w3c.dom.svg.SVGPoint SVGPoint} object is "live" and setting its |
|
81 * x and y components will change user agent's translation). The initial values for currentTranslate is SVGPoint(0,0). |
|
82 * |
|
83 * @return returns the current user agent translation. |
|
84 */ |
|
85 public SVGPoint getCurrentTranslate(); |
|
86 |
|
87 /** |
|
88 * Returns current animation timeline time in seconds. |
|
89 * |
|
90 * @return the current animation timeline time in seconds. |
|
91 */ |
|
92 public float getCurrentTime(); |
|
93 |
|
94 /** |
|
95 * Sets current animation timeline time (in seconds). This API is required to support moving |
|
96 * forwards in timeline. The underlying implementations are normally designed to seek |
|
97 * forward in time and setting the time backwards is not meant to play the animation backwards. |
|
98 * Note: Moving backwards in time is a costly feature for the implementations to support. |
|
99 * |
|
100 * @param seconds the value of time to be set in seconds. |
|
101 */ |
|
102 |
|
103 public void setCurrentTime(float seconds); |
|
104 |
|
105 /** |
|
106 * Creates new {@link org.w3c.dom.svg.SVGMatrix SVGMatrix} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGMatrix SVGMatrix} |
|
107 * type using {@link org.w3c.dom.svg.SVGElement#setMatrixTrait setMatrixTrait} method. The internal representation of the matrix is as follows: |
|
108 * <p> |
|
109 * <pre> |
|
110 * [ a c e ] |
|
111 * [ b d f ] |
|
112 * [ 0 0 1 ] |
|
113 * </pre> |
|
114 * </p> |
|
115 * |
|
116 * @param a the 'a' component of the matrix to be set. |
|
117 * @param b the 'b' component of the matrix to be set. |
|
118 * @param c the 'c' component of the matrix to be set. |
|
119 * @param d the 'd' component of the matrix to be set. |
|
120 * @param e the 'e' component of the matrix to be set. |
|
121 * @param f the 'f' component of the matrix to be set. |
|
122 * |
|
123 * @return the newly created SVGMatrix object. |
|
124 * |
|
125 * @see org.w3c.dom.svg.SVGMatrix |
|
126 */ |
|
127 |
|
128 public SVGMatrix createSVGMatrixComponents(float a, float b, float c, float d, float e, float f); |
|
129 |
|
130 /** |
|
131 * Creates new {@link org.w3c.dom.svg.SVGRect SVGRect} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRect SVGRect} |
|
132 * type using {@link org.w3c.dom.svg.SVGElement#setRectTrait setRectTrait} method. The intial values for x, y, width, height of this new SVGRect are zero. |
|
133 * |
|
134 * @return the newly created SVGRect object. |
|
135 */ |
|
136 |
|
137 public SVGRect createSVGRect(); |
|
138 |
|
139 /** |
|
140 * Creates new {@link org.w3c.dom.svg.SVGPath SVGPath} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGPath SVGPath} |
|
141 * type using {@link org.w3c.dom.svg.SVGElement#setPathTrait setPathTrait} method. |
|
142 * |
|
143 * @return the newly created SVGPath object with empty path commands. |
|
144 */ |
|
145 |
|
146 public SVGPath createSVGPath(); |
|
147 |
|
148 /** |
|
149 * Creates new {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor} object. This object can be used to modify value of traits which are compatible with {@link org.w3c.dom.svg.SVGRGBColor SVGRGBColor} |
|
150 * type using {@link org.w3c.dom.svg.SVGElement#setRGBColorTrait setRGBColorTrait} method. |
|
151 * |
|
152 * @param red the red component of SVGRGBColor object. |
|
153 * @param green the green component of SVGRGBColor object. |
|
154 * @param blue the blue component of SVGRGBColor object. |
|
155 * |
|
156 * @return the newly created SVGRGBColor object with specified (r,g,b) values. |
|
157 * |
|
158 * @throws SVGException with error code SVG_INVALID_VALUE_ERR: if any of the parameters is not in the 0..255 range.</li> |
|
159 */ |
|
160 public SVGRGBColor createSVGRGBColor(int red, int green, int blue) |
|
161 throws SVGException; |
|
162 } |