1 /**********************************************
2 * Copyright (C) 2010 Lukas Laag
3 * This file is part of lib-gwt-svg.
4 *
5 * libgwtsvg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * libgwtsvg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libgwtsvg. If not, see http://www.gnu.org/licenses/
17 **********************************************/
18 /*
19 * Copyright (c) 2004 World Wide Web Consortium,
20 *
21 * (Massachusetts Institute of Technology, European Research Consortium for
22 * Informatics and Mathematics, Keio University). All Rights Reserved. This
23 * work is distributed under the W3C(r) Software License [1] in the hope that
24 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 *
27 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
28 */
29
30 package org.vectomatic.dom.svg;
31
32 import org.vectomatic.dom.svg.impl.SVGFilterElement;
33 import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
34 import org.vectomatic.dom.svg.itf.ISVGLangSpace;
35 import org.vectomatic.dom.svg.itf.ISVGStylable;
36 import org.vectomatic.dom.svg.itf.ISVGURIReference;
37 import org.vectomatic.dom.svg.itf.ISVGUnitTypes;
38 import org.vectomatic.dom.svg.utils.DOMHelper;
39 import org.vectomatic.dom.svg.utils.SVGConstants;
40
41 import com.google.gwt.core.client.JavaScriptException;
42 import com.google.gwt.dom.client.TagName;
43
44 /**
45 * The {@link org.vectomatic.dom.svg.OMSVGFilterElement} interface corresponds
46 * to the <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
47 * title='filter element specification'>filter</a> element.
48 */
49 @TagName("filter")
50 public class OMSVGFilterElement extends OMSVGElement implements ISVGURIReference, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGUnitTypes {
51 public OMSVGFilterElement() {
52 this((SVGFilterElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FILTER_TAG).cast());
53 }
54
55 protected OMSVGFilterElement(SVGFilterElement ot) {
56 super(ot);
57 }
58
59 // Implementation of the svg::SVGFilterElement W3C IDL interface
60 /**
61 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getFilterUnits()}
62 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
63 * title='filter element specification'>filter</a> element. Takes one of the
64 * constants defined in {@link org.vectomatic.dom.svg.itf.ISVGUnitTypes}.
65 */
66 public final OMSVGAnimatedEnumeration getFilterUnits() {
67 return ((SVGFilterElement)ot).getFilterUnits();
68 }
69 /**
70 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getPrimitiveUnits()}
71 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
72 * title='filter element specification'>filter</a> element. Takes one of the
73 * constants defined in {@link org.vectomatic.dom.svg.itf.ISVGUnitTypes}.
74 */
75 public final OMSVGAnimatedEnumeration getPrimitiveUnits() {
76 return ((SVGFilterElement)ot).getPrimitiveUnits();
77 }
78 /**
79 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getX()}
80 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
81 * title='filter element specification'>filter</a> element.
82 */
83 public final OMSVGAnimatedLength getX() {
84 return ((SVGFilterElement)ot).getX();
85 }
86 /**
87 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getY()}
88 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
89 * title='filter element specification'>filter</a> element.
90 */
91 public final OMSVGAnimatedLength getY() {
92 return ((SVGFilterElement)ot).getY();
93 }
94 /**
95 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getWidth()}
96 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
97 * title='filter element specification'>filter</a> element.
98 */
99 public final OMSVGAnimatedLength getWidth() {
100 return ((SVGFilterElement)ot).getWidth();
101 }
102 /**
103 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGFilterElement#getHeight()}
104 * on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
105 * title='filter element specification'>filter</a> element.
106 */
107 public final OMSVGAnimatedLength getHeight() {
108 return ((SVGFilterElement)ot).getHeight();
109 }
110 /**
111 * Corresponds to attribute <code>filterRes</code> on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
112 * title='filter element specification'>filter</a> element. Contains the
113 * X component of attribute <code>filterRes</code>.
114 */
115 public final OMSVGAnimatedInteger getFilterResX() {
116 return ((SVGFilterElement)ot).getFilterResX();
117 }
118 /**
119 * Corresponds to attribute <code>filterRes</code> on the given <a href='http://www.w3.org/TR/SVG11/filters.html#FilterElement'
120 * title='filter element specification'>filter</a> element. Contains the
121 * Y component (possibly computed automatically) of attribute <code>filterRes</code>.
122 */
123 public final OMSVGAnimatedInteger getFilterResY() {
124 return ((SVGFilterElement)ot).getFilterResY();
125 }
126 /**
127 * Sets the values for attribute <code>filterRes</code>.
128 * @param filterResX The X component of attribute <code>filterRes</code>.
129 * @param filterResY The Y component of attribute <code>filterRes</code>.
130 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
131 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
132 * attribute</a>.
133 */
134 public final void setFilterRes(int filterResX, int filterResY) throws JavaScriptException {
135 ((SVGFilterElement)ot).setFilterRes(filterResX, filterResY);
136 }
137
138 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
139 /**
140 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
141 * on the given element. Note that the SVG DOM defines the attribute {@link
142 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
143 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
144 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
145 * is not animated. Because the SVG language definition states that {@link
146 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
147 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
148 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
149 */
150 public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
151 return ((SVGFilterElement)ot).getExternalResourcesRequired();
152 }
153
154 // Implementation of the svg::SVGLangSpace W3C IDL interface
155 /**
156 * Corresponds to attribute <code>xml:lang</code> on the given element.
157 */
158 public final String getXmllang() {
159 return ((SVGFilterElement)ot).getXmllang();
160 }
161 /**
162 * Corresponds to attribute <code>xml:lang</code> on the given element.
163 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
164 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
165 * attribute</a>.
166 */
167 public final void setXmllang(java.lang.String value) throws JavaScriptException {
168 ((SVGFilterElement)ot).setXmllang(value);
169 }
170 /**
171 * Corresponds to attribute <code>xml:space</code> on the given element.
172 */
173 public final String getXmlspace() {
174 return ((SVGFilterElement)ot).getXmlspace();
175 }
176 /**
177 * Corresponds to attribute <code>xml:space</code> on the given element.
178 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
179 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
180 * attribute</a>.
181 */
182 public final void setXmlspace(java.lang.String value) throws JavaScriptException {
183 ((SVGFilterElement)ot).setXmlspace(value);
184 }
185
186 // Implementation of the svg::SVGURIReference W3C IDL interface
187 /**
188 * Corresponds to attribute <span class='attr-name'>'xlink:href'</span> on
189 * the given element.
190 */
191 public final OMSVGAnimatedString getHref() {
192 return ((SVGFilterElement)ot).getHref();
193 }
194
195 // Implementation of the svg::SVGUnitTypes W3C IDL interface
196
197 /**
198 * This keyword represents the graphics elements that were the original
199 * input into the ‘filter’ element. For raster effects filter primitives,
200 * the graphics elements will be rasterized into an initially clear RGBA
201 * raster in image space. Pixels left untouched by the original graphic
202 * will be left clear. The image is specified to be rendered in linear RGBA pixels.
203 * The alpha channel of this image captures any anti-aliasing specified by SVG.
204 * (Since the raster is linear, the alpha channel of this image will represent
205 * the exact percent coverage of each pixel.)
206 */
207 public static final String IN_SOURCE_GRAPHIC = org.vectomatic.dom.svg.utils.SVGConstants.SVG_SOURCE_GRAPHIC_VALUE;
208 /**
209 * This keyword represents the graphics elements that were the original
210 * input into the ‘filter’ element. SourceAlpha has all of the same rules
211 * as SourceGraphic except that only the alpha channel is used. The input
212 * image is an RGBA image consisting of implicitly black color values for
213 * the RGB channels, but whose alpha channel is the same as SourceGraphic.
214 * If this option is used, then some implementations might need to rasterize
215 * the graphics elements in order to extract the alpha channel.
216 */
217 public static final String IN_SOURCE_ALPHA = org.vectomatic.dom.svg.utils.SVGConstants.SVG_SOURCE_ALPHA_VALUE;
218 /**
219 * This keyword represents an image snapshot of the canvas under the filter
220 * region at the time that the ‘filter’ element was invoked.
221 */
222 public static final String IN_BACKGROUND_IMAGE = org.vectomatic.dom.svg.utils.SVGConstants.SVG_BACKGROUND_IMAGE_VALUE;
223 /**
224 * Same as BackgroundImage except only the alpha channel is used.
225 */
226 public static final String IN_BACKGROUND_ALPHA = org.vectomatic.dom.svg.utils.SVGConstants.SVG_BACKGROUND_ALPHA_VALUE;
227 /**
228 * This keyword represents the value of the ‘fill’ property on the target
229 * element for the filter effect. The FillPaint image has conceptually
230 * infinite extent. Frequently this image is opaque everywhere, but
231 * it might not be if the "paint" itself has alpha, as in the case
232 * of a gradient or pattern which itself includes transparent or semi-transparent
233 * parts.
234 */
235 public static final String IN_FILL_PAINT = org.vectomatic.dom.svg.utils.SVGConstants.SVG_FILL_PAINT_VALUE;
236 /**
237 * This keyword represents the value of the ‘stroke’ property on
238 * the target element for the filter effect. The StrokePaint image has
239 * conceptually infinite extent. Frequently this image is opaque everywhere,
240 * but it might not be if the "paint" itself has alpha, as in the case of a
241 * gradient or pattern which itself includes transparent or semi-transparent parts.
242 */
243 public static final String IN_STROKE_PAINT = org.vectomatic.dom.svg.utils.SVGConstants.SVG_STROKE_PAINT_VALUE;}