filters/master/Filters.html

Wed, 07 Sep 2011 10:26:03 +1000

author
Dean Jackson <dino@apple.com>
date
Wed, 07 Sep 2011 10:26:03 +1000
changeset 36
b31bb9367aef
parent 34
cc281b90a47a
child 40
3f1fdd4a8004
permissions
-rw-r--r--

- Added opacity function
- Corrected luminanceToAlpha values

edahlstr@0 1 <?xml version="1.0" encoding="UTF-8"?>
edahlstr@0 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional+edit//EN" "xhtml1-transitional+edit.dtd">
edahlstr@0 3 <html xmlns="http://www.w3.org/1999/xhtml"
edahlstr@0 4 xmlns:edit="http://xmlns.grorg.org/SVGT12NG/" xml:lang="en" lang="en">
edahlstr@0 5 <head>
edahlstr@0 6 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
edahlstr@4 7 <title>Filter Effects 1.0: Language</title>
edahlstr@0 8 <link rel="stylesheet" type="text/css" href="style/svg-style.css" />
edahlstr@0 9 <link rel="stylesheet" type="text/css" href="style/svg-style-extra.css"/>
edahlstr@0 10 </head>
edahlstr@0 11
edahlstr@0 12 <body>
edahlstr@0 13
edahlstr@0 14 <div class="head">
edahlstr@0 15 <p><a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"/></a></p>
edahlstr@4 16 <h1 id="pagetitle">Filter Effects 1.0: Language</h1>
edahlstr@0 17 <h2 id="pagesubtitle">W3C <edit:maturity/> <em><edit:date/></em></h2>
edahlstr@0 18 <dl>
edahlstr@0 19 <dt>This version:</dt>
edahlstr@0 20 <dd><edit:thisversion/></dd>
edahlstr@0 21 <dt>Latest version:</dt>
edahlstr@0 22 <dd><edit:latestversion/></dd>
edahlstr@0 23 <dt>Previous version:</dt>
edahlstr@0 24 <dd><edit:previousversion/></dd>
edahlstr@4 25 <dt>Editors:</dt>
edahlstr@4 26 <dd><a href="mailto:ed@opera.com">Erik Dahlström</a>, (<a href="http://www.opera.com/">Opera Software ASA</a>)</dd>
edahlstr@4 27 <dd><a href="mailto:dino@apple.com">Dean Jackson</a> (<a href="http://www.apple.com/">Apple Inc</a>)</dd>
edahlstr@0 28 <dt>Authors:</dt>
edahlstr@4 29 <dd>The authors of this specification are the participants of the W3C SVG and CSS Working Groups.</dd>
edahlstr@0 30 </dl>
edahlstr@0 31 <edit:copyright/>
edahlstr@0 32 </div>
edahlstr@0 33
edahlstr@0 34 <hr/>
edahlstr@0 35
edahlstr@0 36 <h2 id="abstract" edit:toc="no">Abstract</h2>
edahlstr@0 37
edahlstr@0 38 <p>
dino@13 39 Filter effects are a way of processing an element's display before it is
dino@13 40 displayed in the document. Typically, rendering an element via CSS or SVG
dino@13 41 can conceptually described as if the element, including its children, are
dino@13 42 drawn into a buffer (such as a raster image) and then that buffer is
dino@13 43 composited into the elements parent. Filters apply an effect before the
dino@13 44 compositing stage. Examples of such effects are blurring, changing color
dino@13 45 intensity and warping the image.
edahlstr@0 46 </p>
dino@13 47
edahlstr@0 48 <p>
dino@13 49 Although originally designed for use in SVG, filter effects simply define
dino@13 50 a set of operations to apply on an image buffer. In SVG they are triggered
dino@13 51 by a style instruction (the 'filter property' property), and have very little
dino@13 52 specific to an SVG environment. This specification describes filters in
dino@13 53 a manner that allow them to be used in other presentational environments,
dino@33 54 such as HTML styled by CSS and XSL:FO. It also defines a CSS property
dino@33 55 value function that allows a filter chain to produce a CSS &lt;image&gt; value.
edahlstr@0 56 </p>
edahlstr@0 57
edahlstr@0 58 <h2 id="status" edit:toc="no">Status of This Document</h2>
edahlstr@0 59
edahlstr@0 60 <p><em>This section describes the status of this document at the time of its
edahlstr@0 61 publication. Other documents may supersede this document. The latest status
edahlstr@0 62 of this document series is maintained at the W3C. </em> </p>
edahlstr@0 63
dino@13 64 <p>
dino@13 65 This document is the first public working draft of this specification. There
dino@13 66 is an accompanying <a href="http://dev.w3.org/SVG/modules/filters/publish/SVGFilterPrimer.html">Filter Effects 1.0, Part 1:
dino@13 67 Primer</a> that lists the ways SVG filters may be used.
edahlstr@0 68 </p>
edahlstr@0 69
dino@11 70 <p>
dino@13 71 This document has been produced by the <a
dino@13 72 href="http://www.w3.org/Style/CSS">W3C CSS</a> and <a
dino@13 73 href="http://www.w3.org/Graphics/SVG">SVG</a> Working Groups as part of the
dino@13 74 <a href="http://www.w3.org/Interaction/">W3C Interaction Domain</a>.
dino@11 75 </p>
edahlstr@0 76
dino@13 77 <p>
dino@13 78 The (<a href="http://lists.w3.org/Archives/Public/public-fx/">archived</a>)
dino@13 79 public mailing list <a
dino@13 80 href="mailto:www-style@w3.org?Subject=%5Bfilters%5D%20PUT%20SUBJECT%20HERE">
dino@13 81 public-fx@w3.org</a> (see <a
dino@13 82 href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
dino@13 83 discussion of this specification. Acceptance of the archiving policy is
dino@13 84 requested automatically upon first post to the list. When sending e-mail,
dino@13 85 please put the text &#8220;filters&#8221; in the subject, preferably like
dino@13 86 this: &#8220;[<!---->filters<!---->] <em>&hellip;summary of
dino@13 87 comment&hellip;</em>&#8221;
dino@13 88 </p>
dino@13 89
dino@13 90 <p>
dino@13 91 The latest information regarding <a
dino@13 92 href="http://www.w3.org/Graphics/SVG/Disclosures">patent disclosures</a>
dino@13 93 related to this document is available on the Web. As of this publication,
dino@13 94 the SVG Working Group are not aware of any royalty-bearing patents they
dino@13 95 believe to be essential to SVG. <span class="note">[@@ Add patent link for CSS WG]</span>
dino@13 96 </p>
dino@13 97
dino@13 98 <p>
dino@13 99 Publication of this document does not imply endorsement by the W3C
dino@13 100 membership. A list of current W3C Recommendations and other technical
dino@13 101 documents can be found at <a
dino@13 102 href="http://www.w3.org/TR/">http://www.w3.org/TR/</a>. W3C publications may
dino@13 103 be updated, replaced, or obsoleted by other documents at any time. It is
dino@13 104 inappropriate to cite a W3C Working Draft as anything other than a <em>work
dino@13 105 in progress</em>."
dino@13 106 </p>
edahlstr@0 107
dino@11 108 <p>
dino@11 109 The <a href="ChangeLog">list of changes made to this specification</a> is
dino@11 110 available.
dino@11 111 </p>
dino@11 112
edahlstr@0 113 <edit:fulltoc/>
edahlstr@0 114
edahlstr@0 115 <h2 id="introduction">Introduction</h2>
edahlstr@0 116
dino@13 117 <p>
dino@13 118 This chapter describes a declarative filter effects feature set, which when
dino@13 119 combined with the other web technologies, such as SVG or HTML, can describe
dino@13 120 much of the common artwork on the Web in such a way that client-side
dino@13 121 generation and alteration can be performed easily. In addition, the ability
dino@13 122 to apply filter effects to elements helps to maintain the semantic
dino@13 123 structure of the document, instead of resorting to images which aside from
dino@13 124 generally being a fixed resolution tend to obscure the original semantics of
dino@13 125 the elements they replace. This is especially true for effects applied to
dino@13 126 text.
edahlstr@6 127 </p>
edahlstr@6 128
edahlstr@6 129 <p>
edahlstr@6 130
edahlstr@6 131 </p>
edahlstr@0 132
dino@13 133 <p>
dino@13 134 Note that even though this specification references parts of <a
dino@13 135 href="#ref-svg11">SVG 1.1</a> it does not require an SVG 1.1
dino@13 136 implementation. <span class="note">Add link to conformance classes
dino@13 137 here.</span>
edahlstr@6 138 </p>
edahlstr@0 139
dino@13 140 <p>This document is normative.</p>
edahlstr@0 141
edahlstr@0 142 <p>This document contains explicit conformance criteria that overlap with
dino@13 143 some RelaxNG definitions in requirements. If there is any conflict between the
edahlstr@0 144 two, the explicit conformance criteria are the definitive reference. </p>
edahlstr@0 145
edahlstr@0 146 <p>A filter effect consists of a series of graphics operations that are
edahlstr@0 147 applied to a given <span id="TermSourceGraphic" class="SVG-Term">source graphic</span> to produce a modified graphical
edahlstr@0 148 result. The result of the filter effect is rendered to the target device
edahlstr@0 149 instead of the original source graphic. The following illustrates the
edahlstr@0 150 process:</p>
edahlstr@0 151
edahlstr@0 152 <p><object data="examples/filters00.svg" type="image/svg+xml" height="78" width="400">
dino@13 153 <img alt="Image showing source graphic transformed by filter effect"
dino@13 154 src="examples/filters00.png" width="401" height="78" />
edahlstr@0 155 </object></p>
edahlstr@0 156 <p class="view-as-svg"><a href="examples/filters00.svg">View this example as
edahlstr@0 157 SVG (SVG-enabled browsers only)</a><br />
dino@13 158 </p>
edahlstr@0 159
edahlstr@0 160 <h2 id="FilterDefinitions">Definitions</h2>
edahlstr@0 161 <p>When used in this specification, terms have the meanings assigned in this section.</p>
edahlstr@0 162 <dl>
edahlstr@0 163 <dt id="TermNullFilter"><span
edahlstr@0 164 class="SVG-TermDefine">null filter</span></dt>
edahlstr@6 165 <dd>
edahlstr@6 166 <p>
edahlstr@6 167 The null filter output is all transparent black pixels. If applied to an element it means
edahlstr@6 168 that the element (and children if any) becomes invisible. Note that it does not affect event processing.
edahlstr@6 169 </p>
edahlstr@6 170 </dd>
edahlstr@0 171 <dt id="TermTransferFunctionElements"><span
edahlstr@0 172 class="SVG-TermDefine">transfer function elements</span></dt>
edahlstr@6 173 <dd>
edahlstr@6 174 <p>
edahlstr@6 175 The set of elements,
edahlstr@6 176 <a>'feFuncR'</a>, <a>'feFuncG'</a>, <a>'feFuncB'</a>, <a>'feFuncA'</a>, that define the transfer function for the <a>'feComponentTransfer'</a> filter primitive.
edahlstr@6 177 </p>
edahlstr@6 178 </dd>
edahlstr@6 179 <dt id="TermClientBoundingRect"><span
edahlstr@6 180 class="SVG-TermDefine">bounding client rect</span></dt>
dino@13 181 <dd>
edahlstr@6 182 <p>
edahlstr@6 183 The union of all CSS border-boxes for the element if formatted by CSS, as defined by the CSS OM method
edahlstr@6 184 <a href="http://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect">getBoundingClientRect</a> [<a href="#ref-CSSOM">CSSOM</a>].
edahlstr@6 185 </p>
dino@13 186 </dd>
edahlstr@6 187 <dt id="TermCSSBoundingBox"><span
edahlstr@6 188 class="SVG-TermDefine">CSS bounding box</span></dt>
dino@13 189 <dd>
edahlstr@6 190 <p>
edahlstr@6 191 The union of all CSS border-boxes for the element and all it's descendant elements, provided the element is formatted by CSS. [<a href="#ref-CSS21">CSS</a>].
edahlstr@6 192 </p>
dino@13 193 </dd>
edahlstr@6 194 <dt id="TermCurrentUserCoordinateSystem"><span
edahlstr@6 195 class="SVG-TermDefine">current user coordinate system</span></dt>
dino@13 196 <dd>
edahlstr@6 197 <p>
edahlstr@6 198 For elements formatted by CSS: the current user coordinate system has its origin at the top-left corner of the
edahlstr@6 199 <a href="#TermClientBoundingRect">bounding client rect</a> and one unit equals on CSS px. The viewport for resolving percentage values is defined by the width and height of the
edahlstr@6 200 <a href="#TermClientBoundingRect">bounding client rect</a>.
edahlstr@6 201 </p>
edahlstr@6 202 <p>
edahlstr@6 203 For SVG elements see <a>user coordinate system</a>.
edahlstr@6 204 </p>
dino@13 205 </dd>
edahlstr@6 206 <dt id="TermObjectBoundingBoxUnits"><span
edahlstr@6 207 class="SVG-TermDefine">object bounding box units</span></dt>
dino@13 208 <dd>
edahlstr@6 209 For elements formatted by CSS: the bounding box is defined by <a href="#TermCSSBoundingBox">the CSS bounding box.</a>
edahlstr@6 210 <p>
edahlstr@6 211 For SVG elements the bounding box is defined by <a href="http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/intro.html#TermBoundingBox">the SVG bounding box</a>.
edahlstr@6 212 </p>
edahlstr@6 213 <p>
edahlstr@6 214 For both cases the bounding box defines the coordinate system in which to resolve values, as defined in <a>object bounding box units</a>.
edahlstr@6 215 </p>
dino@13 216 </dd>
dino@13 217 <dt id="TermFilterPrimitiveReference"><span
edahlstr@0 218 class="SVG-TermDefine">&lt;filter-primitive-reference&gt;</span></dt>
dino@13 219 <dd>
dino@13 220 <p>
edahlstr@6 221 A string that identifies a particular filter primitive's output.
edahlstr@6 222 </p>
dino@13 223 </dd>
dino@13 224 <dt id="TermFilterPrimitiveElements"><span
edahlstr@0 225 class="SVG-TermDefine">filter primitives, filter primitive elements</span></dt>
dino@13 226 <dd>
edahlstr@6 227 <p>
dino@13 228 The set of elements that control the output of a <a>'filter element'</a> element, particularly:
dino@13 229 <a>'feDistantLight'</a>,
dino@13 230 <a>'fePointLight'</a>,
dino@13 231 <a>'feSpotLight'</a>,
dino@13 232 <a>'feBlend'</a>,
dino@13 233 <a>'feColorMatrix'</a>,
dino@13 234 <a>'feComponentTransfer'</a>,
dino@13 235 <a>'feComposite'</a>,
dino@13 236 <a>'feConvolveMatrix'</a>,
dino@13 237 <a>'feDiffuseLighting'</a>,
dino@13 238 <a>'feDisplacementMap'</a>,
dino@13 239 <a>'feFlood'</a>,
dino@13 240 <a>'feGaussianBlur'</a>,
dino@13 241 <a>'feImage'</a>,
dino@13 242 <a>'feMerge'</a>,
dino@13 243 <a>'feMorphology'</a>,
dino@13 244 <a>'feOffset'</a>,
dino@13 245 <a>'feSpecularLighting'</a>,
dino@13 246 <a>'feTile'</a>,
dino@13 247 <a>'feTurbulence'</a>,
dino@13 248 <a>'feDropShadow'</a>,
dino@13 249 <a>'feDiffuseSpecular'</a>,
edahlstr@0 250 <a>'feUnsharpMask'</a>,
dino@13 251 <a>'feCustom'</a>.
edahlstr@6 252 </p>
dino@13 253 </dd>
edahlstr@0 254 </dl>
edahlstr@0 255 <br/>
edahlstr@0 256
dino@13 257 <h2 id="FilterProperty">The <span class="prop-name">'filter'</span>
dino@13 258 property</h2>
dino@13 259
dino@13 260 <p>The description of the <span class="prop-name">'filter'</span> property is
dino@13 261 as follows:</p>
dino@13 262
dino@13 263 <div class="propdef">
dino@13 264 <dl>
dino@13 265 <dt id='propdef-filter'><span class='propdef-title prop-name'>'filter'</span></dt>
dino@13 266 <dd>
dino@13 267 <table summary="filter property" class="propinfo" cellspacing="0"
dino@13 268 cellpadding="0">
dino@13 269 <tbody>
dino@13 270 <tr valign="baseline">
dino@13 271 <td><em>Value:</em>  </td>
dino@13 272 <td>none | <a href="#FilterFunction">&lt;filter-function&gt;</a> [ <a href="#FilterFunction">&lt;filter-function&gt;</a> ]* </td>
dino@13 273 </tr>
dino@13 274 <tr valign="baseline">
dino@13 275 <td><em>Initial:</em>  </td>
dino@13 276 <td>none</td>
dino@13 277 </tr>
dino@13 278 <tr valign="baseline">
dino@13 279 <td><em>Applies to:</em>  </td>
dino@13 280 <td>All elements</td>
dino@13 281 </tr>
dino@13 282 <tr valign="baseline">
dino@13 283 <td><em>Inherited:</em>  </td>
dino@13 284 <td>no</td>
dino@13 285 </tr>
dino@13 286 <tr valign="baseline">
dino@13 287 <td><em>Percentages:</em>  </td>
dino@13 288 <td>N/A</td>
dino@13 289 </tr>
dino@13 290 <tr valign="baseline">
dino@13 291 <td><em>Media:</em>  </td>
dino@13 292 <td>visual</td>
dino@13 293 </tr>
dino@13 294 <tr valign="baseline">
dino@13 295 <td><em>Animatable:</em>  </td>
dino@13 296 <td>yes</td>
dino@13 297 </tr>
dino@13 298 </tbody>
dino@13 299 </table>
dino@13 300 </dd>
dino@13 301 </dl>
dino@13 302 </div>
dino@13 303
dino@13 304 <p>
dino@13 305 If the value of the <a>'filter property'</a> property is <span class="prop-value">none</span> then there
dino@13 306 is no filter effect applied. Otherwise, the list of functions (described <a href="#FilterFunction">below</a>)
dino@13 307 are applied in order.
dino@13 308 </p>
dino@13 309
dino@13 310 <h3 id="filters-in-css">How the <a>'filter property'</a> property applies to content formatted by CSS (e.g HTML)</h3>
dino@13 311 <p>
dino@13 312 The application of the <a>'filter property'</a> property to an element
dino@13 313 formatted by CSS establishes a pseudo-stacking-context the same way that CSS
dino@13 314 <a href="http://www.w3.org/TR/css3-color/#transparency">'opacity'</a> does,
dino@13 315 and all the element's boxes are rendered together as a group with the filter
dino@13 316 effect applied to the group as a whole.
dino@13 317 </p>
dino@13 318 <p>
dino@13 319 The <a>'filter property'</a> property has no effect on the geometry of the
dino@13 320 target element's CSS boxes, even though <a>'filter property'</a> can cause
dino@13 321 painting outside of an element's border-box.
dino@13 322 </p>
dino@13 323 <p>
dino@13 324 The compositing model follows the <a
dino@13 325 href="http://www.w3.org/TR/SVG11/render.html#Introduction">SVG compositing
dino@13 326 model</a>: first any filter effect is applied, then any clipping, masking
dino@13 327 and opacity. These effects all apply after any other CSS effects such as
dino@13 328 'border'. As per SVG, the application of <a>'filter property'</a> has no
dino@13 329 effect on hit-testing.
dino@13 330 </p>
dino@13 331
dino@13 332 <br />
dino@13 333
dino@13 334 <h2 id="FilterFunction">Filter Functions</h2>
dino@13 335
dino@13 336 <p>
dino@13 337 The value of the <a>'filter property'</a> property is a list of &lt;filter-functions&gt;
dino@13 338 applied in the order provided. The individual filter functions are
dino@13 339 separated by whitespace. The set of allowed filter functions is given
dino@13 340 below.
dino@13 341 </p>
dino@13 342
dino@13 343 <dl>
dino@13 344 <dt>
ed@21 345 <a>&lt;FuncIRI&gt;</a>
dino@13 346 </dt>
dino@13 347 <dd>
ed@21 348 An <a>IRI reference</a>
dino@13 349 to a <a>'filter element'</a> element that defines the
dino@13 350 filter effect. For example "url(commonfilters.xml#large-blur)". If the IRI references a non-existent object or the referenced
dino@13 351 object is not a <a>'filter element'</a> element, then the <a>null filter</a> will be applied instead.
dino@13 352 </dd>
dino@13 353
dino@13 354 <dt>
dino@13 355 grayscale(amount)
dino@13 356 </dt>
dino@13 357 <dd>
dino@13 358 Converts the input image to grayscale. The value of 'amount' defines the proportion
dino@13 359 of the conversion. A value of 1 is completely grayscale. A value of 0 leaves the
dino@13 360 input unchanged. Values between 0 and 1 are linear multipliers on the effect.
dino@13 361 If the 'amount' parameter is missing, a value of 1 is used.
dino@13 362 The markup equivalent of this function is <a href="#grayscaleEquivalent">given below</a>.
dino@13 363 </dd>
dino@13 364
dino@13 365 <dt>
dino@13 366 sepia(amount)
dino@13 367 </dt>
dino@13 368 <dd>
dino@13 369 Converts the input image to sepia. The value of 'amount' defines the proportion
dino@13 370 of the conversion. A value of 1 is completely sepia. A value of 0 leaves the
dino@13 371 input unchanged. Values between 0 and 1 are linear multipliers on the effect.
dino@13 372 If the 'amount' parameter is missing, a value of 1 is used.
dino@13 373 The markup equivalent of this function is <a href="#sepiaEquivalent">given below</a>.
dino@13 374 </dd>
dino@13 375
dino@13 376 <dt>
dino@13 377 saturate(amount)
dino@13 378 </dt>
dino@13 379 <dd>
dino@13 380 Saturates the input image. The value of 'amount' defines the proportion
dino@13 381 of the conversion. A value of 1 is completely saturated. A value of 0 leaves the
dino@13 382 input unchanged. Values between 0 and 1 are linear multipliers on the effect.
dino@13 383 If the 'amount' parameter is missing, a value of 1 is used.
dino@13 384 The markup equivalent of this function is <a href="#saturateEquivalent">given below</a>.
dino@13 385 </dd>
dino@13 386
dino@13 387 <dt>
dino@13 388 hue-rotate(angle)
dino@13 389 </dt>
dino@13 390 <dd>
dino@13 391 Applies a hue rotation on the input image. The value of 'angle' defines the
dino@13 392 number of degrees around the color circle the input samples will be adjusted.
dino@13 393 A value of 0 leaves the input unchanged. If the 'angle' parameter is missing,
dino@13 394 a value of 0 is used.
dino@13 395 The markup equivalent of this function is <a href="#huerotateEquivalent">given below</a>.
dino@13 396 </dd>
dino@13 397
dino@13 398 <dt>
dino@13 399 invert(amount)
dino@13 400 </dt>
dino@13 401 <dd>
dino@13 402 Inverts the samples in the input image. The value of 'amount' defines the proportion
dino@13 403 of the conversion. A value of 1 is completely inverted. A value of 0 leaves the
dino@13 404 input unchanged. Values between 0 and 1 are linear multipliers on the effect.
dino@13 405 If the 'amount' parameter is missing, a value of 1 is used.
dino@13 406 The markup equivalent of this function is <a href="#invertEquivalent">given below</a>.
dino@13 407 </dd>
dino@13 408
dino@13 409 <dt>
dino@36 410 opacity(amount)
dino@36 411 </dt>
dino@36 412 <dd>
dino@36 413 Applies transparency to the samples in the input image. The value of 'amount' defines the proportion
dino@36 414 of the conversion. A value of 1 is completely transparent. A value of 0 leaves the
dino@36 415 input unchanged. Values between 0 and 1 are linear multipliers on the effect.
dino@36 416 This is equivalent to multiplying the input image samples by (1 - amount).
dino@36 417 If the 'amount' parameter is missing, a value of 1 is used.
dino@36 418 The markup equivalent of this function is <a href="#opacityEquivalent">given below</a>.
dino@36 419 </dd>
dino@36 420
dino@36 421 <dt>
dino@34 422 gamma(amplitude exponent offset)
dino@13 423 </dt>
dino@13 424 <dd>
dino@13 425 Applies a gamma function to the input image.
dino@13 426 The value of 'amplitude' defines the multiplier to the gamma function.
dino@13 427 The value of 'exponent' defines the exponent of the gamma function.
dino@13 428 The value of 'offset' defines the offset of the gamma function.
dino@13 429 If any of the parameters are missing, the default value for 'amplitude'
dino@13 430 is 1, for 'exponent' is 1, and for 'offset' is 0.
dino@13 431 The markup equivalent of this function is <a href="#gammaEquivalent">given below</a>.
dino@13 432 </dd>
dino@13 433
dino@13 434 <dt>
dino@34 435 blur(radiusX radiusY)
dino@13 436 </dt>
dino@13 437 <dd>
dino@13 438 Applies a Gaussian blur to the input image.
dino@33 439 The value of 'radiusX' defines the X value of the standard deviation to the Gaussian function.
dino@33 440 The value of 'radiusY' defines the Y value of the standard deviation to the Gaussian function.
dino@13 441 If one parameter is provided, then that value is used for both 'radiusX' and 'radiusY'.
dino@13 442 If no parameters are provided, then the value for both attributes is 0.
dino@13 443 The markup equivalent of this function is <a href="#blurEquivalent">given below</a>.
dino@13 444 </dd>
dino@13 445
dino@13 446 <dt>
dino@34 447 sharpen(amount radius threshold)
dino@13 448 </dt>
dino@13 449 <dd>
dino@13 450 Applies an sharpening effect to the input image. This is equivalent to subtracting the
dino@13 451 input samples from a blurred version of the image.
dino@13 452 The value of 'amount' defines the proportion of the effect (as a multiplier on the
dino@13 453 subtraction). A value of 1 applies the effect completely. A value of 0 leaves the
dino@13 454 input unchanged.
dino@33 455 The value of 'radius' defines the value of the standard deviation to the Gaussian function.
dino@13 456 The value of 'threshold' defines a point at which the function will not be applied.
dino@13 457 If the 'threshold' parameter is not provided, then its value is 1. If the 'radius' parameter
dino@13 458 is not provided, then its value is 0. If no parameters are provided, then the value for 'amount' is 0.
dino@34 459 The markup equivalent of this function is <a href="#sharpenEquivalent">given below</a>.
dino@13 460 </dd>
dino@13 461
dino@33 462 <dt>
dino@34 463 drop-shadow(&lt;shadow&gt;)
dino@33 464 </dt>
dino@33 465 <dd>
dino@34 466 Applies a drop shadow effect to the input image. A drop shadow is
dino@34 467 effectively a blurred, offset version of the input image's alpha mask
dino@34 468 drawn in a particular color, composited below the image. The function
dino@34 469 accepts a parameter of type &lt;shadow&gt; (defined in CSS3 Backgrounds),
dino@34 470 with the exception that the 'inset' keyword is not allowed. The markup
dino@34 471 equivalent of this function is <a href="#dropshadowEquivalent">given
dino@34 472 below</a>.
dino@33 473 </dd>
dino@33 474
dino@13 475 </dl>
dino@13 476
dino@13 477 <div class="note">
dino@13 478 <p>
dino@13 479 The above list is a collection of effects that can be easily defined in
dino@13 480 terms of SVG filters. However, there are many more interesting effects
dino@13 481 that can be considered for inclusion. If accepted, there will have to
dino@13 482 be equivalent XML elements for the effect. Effects considered include:
dino@13 483 </p>
dino@13 484 <ul>
dino@13 485 <li>brightness, contrast, exposure</li>
dino@13 486 <li>halftone</li>
dino@13 487 <li>motion-blur(radius, angle)</li>
dino@13 488 <li>posterize(levels)</li>
dino@13 489 <li>bump(x, y, radius, intensity)</li>
dino@13 490 <li>generators</li>
dino@13 491 <li>circle-crop(x, y, radius)</li>
dino@13 492 <li>affine-transform(some matrix)</li>
dino@13 493 <li>crop(x, y, w, h)</li>
dino@13 494 <li>bloom(radius, intensity)</li>
dino@13 495 <li>gloom(radius, intensity)</li>
dino@13 496 <li>mosaic(w,h)</li>
dino@13 497 <li>displace(url, intensity)</li>
dino@13 498 <li>edge-detect(intensity)</li>
dino@13 499 <li>pinch(x, y, radius, scale)</li>
dino@13 500 <li>twirl(x, y, radius, angle)</li>
dino@13 501 </ul>
dino@13 502 </div>
dino@13 503
dino@13 504 <p>
dino@13 505 The first function in the list takes the element (<a href="#SourceGraphic">SourceGraphic</a>) as
dino@13 506 the input image. Subsequent operations take the output from the
dino@13 507 previous function as the input image. The exception is the function
dino@13 508 that references a 'filter element' element, which can specify an
dino@13 509 alternate input, but still uses the previous output as its
dino@13 510 <a href="#SourceGraphic">SourceGraphic</a>.
dino@13 511 </p>
dino@13 512
edahlstr@0 513 <h2 id="FilterElement">The <span class="element-name">'filter'</span>
edahlstr@0 514 element</h2>
edahlstr@0 515
edahlstr@0 516 <edit:elementsummary name='filter'/>
edahlstr@0 517
edahlstr@0 518 <edit:with element='filter'>
edahlstr@0 519
edahlstr@0 520 <p>The description of the <a>'filter element'</a> element
edahlstr@0 521 follows:</p>
edahlstr@0 522
edahlstr@0 523 <div class="adef-list">
edahlstr@0 524 <p><em>Attribute definitions:</em></p>
edahlstr@0 525 <dl>
edahlstr@0 526 <dt id="FilterElementFilterUnitsAttribute"><span
edahlstr@0 527 class="adef">filterUnits</span> = "<em>userSpaceOnUse</em> |
edahlstr@0 528 <em>objectBoundingBox</em>"</dt>
edahlstr@0 529 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 530 <dt id="FilterElementPrimitiveUnitsAttribute"><span
edahlstr@0 531 class="adef">primitiveUnits</span> = "<em>userSpaceOnUse</em> |
edahlstr@0 532 <em>objectBoundingBox</em>"</dt>
edahlstr@0 533 <dd>Specifies the coordinate system for the various length values within
edahlstr@0 534 the <a>filter primitives</a> and for the attributes that define the <a>filter primitive subregion</a>.<br />
edahlstr@0 535 If <span class='attr-value'>primitiveUnits="userSpaceOnUse"</span>, any length values
edahlstr@6 536 within the filter definitions represent values in the <a href="#TermCurrentUserCoordinateSystem">current user
edahlstr@6 537 coordinate system</a> in place at the time when the <a>'filter element'</a>
edahlstr@0 538 element is referenced (i.e., the user coordinate system for the element
edahlstr@0 539 referencing the <a>'filter element'</a> element via a <a>'filter property'</a>
edahlstr@0 540 property).<br />
edahlstr@0 541 If <span class='attr-value'>primitiveUnits="objectBoundingBox"</span>, then any length
edahlstr@0 542 values within the filter definitions represent fractions or percentages
edahlstr@6 543 of the bounding box on the referencing element (see <a href="#TermObjectBoundingBoxUnits">object bounding box
edahlstr@0 544 units</a>). Note that if only one number was specified in a <a>&lt;number-optional-number&gt;</a> value
dino@13 545 this number is expanded out before the <a>'filter/primitiveUnits'</a> computation takes place.
dino@13 546 <br />
ed@17 547 The <a>lacuna value</a> for <a>'filter/primitiveUnits'</a> is <span class="attr-value">userSpaceOnUse</span>.<br />
edahlstr@0 548 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 549 <dt id="FilterElementXAttribute">
edahlstr@0 550 <span class="adef">x</span> = "<em><a>&lt;coordinate&gt;</a></em>"</dt>
edahlstr@0 551 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 552 <dt id="FilterElementYAttribute">
edahlstr@0 553 <span class="adef">y</span> = "<em><a>&lt;coordinate&gt;</a></em>"</dt>
edahlstr@0 554 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 555 <dt id="FilterElementWidthAttribute"><span class="adef">width</span> =
edahlstr@0 556 "<em><a>&lt;length&gt;</a></em>"</dt>
edahlstr@0 557 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 558 <dt id="FilterElementHeightAttribute"><span class="adef">height</span> =
edahlstr@0 559 "<em><a>&lt;length&gt;</a></em>"</dt>
edahlstr@0 560 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 561 <dt id="FilterElementFilterResAttribute"><span
edahlstr@0 562 class="adef">filterRes</span> = "<em><a>&lt;number-optional-number&gt;</a></em>"
edahlstr@0 563 </dt>
edahlstr@0 564 <dd>See <a>filter effects region</a>.</dd>
edahlstr@0 565 <dt id="FilterElementHrefAttribute"><span class="adef">xlink:href</span>
edahlstr@0 566 = "<span class="attr-value">&lt;IRI&gt;</span>"</dt>
ed@17 567 <dd>An <a>IRI reference</a>
edahlstr@0 568 to another <a>'filter element'</a> element within
edahlstr@0 569 the current <a>SVG document fragment</a>. Any attributes which are defined on
edahlstr@0 570 the referenced <a>'filter element'</a> element which
edahlstr@0 571 are not defined on this element are inherited by this element. If this
edahlstr@0 572 element has no defined filter nodes, and the referenced element has
edahlstr@0 573 defined filter nodes (possibly due to its own <span
edahlstr@0 574 class="attr-name">href</span> attribute), then this element inherits
edahlstr@0 575 the filter nodes defined from the referenced <a>'filter element'</a> element. Inheritance can be
edahlstr@0 576 indirect to an arbitrary level; thus, if the referenced <a>'filter element'</a> element inherits attributes or its
edahlstr@0 577 filter node specification due to its own <span
edahlstr@0 578 class="attr-name">href</span> attribute, then the current element can
ed@25 579 inherit those attributes or filter node specifications.
edahlstr@0 580
edahlstr@0 581 <div class="note">
edahlstr@0 582 This attribute is deprecated and should not be used, it's included for
edahlstr@0 583 backwards compatibility reasons only.</div>
edahlstr@0 584 <br />
edahlstr@0 585 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 586 </dl>
edahlstr@0 587 </div>
edahlstr@0 588
edahlstr@0 589 <p>Properties inherit into the <a>'filter element'</a>
edahlstr@0 590 element from its ancestors; properties do <em>not</em> inherit from the
edahlstr@0 591 element referencing the <a>'filter element'</a>
edahlstr@0 592 element.</p>
edahlstr@0 593
edahlstr@0 594 <p><a>'filter element'</a> elements are never rendered
edahlstr@0 595 directly; their only usage is as something that can be referenced using the
edahlstr@0 596 <a>'filter property'</a>
edahlstr@0 597 property. The <a>'display'</a> property does not
edahlstr@0 598 apply to the <a>'filter element'</a> element; thus, <a>'filter element'</a> elements are not directly rendered even
edahlstr@0 599 if the <a>'display'</a> property is set to a value
edahlstr@0 600 other than <span class="prop-value">none</span>, and <a>'filter element'</a> elements are available for referencing
edahlstr@0 601 even when the <a>'display'</a> property on the <a>'filter element'</a> element or any of its ancestors is set
edahlstr@0 602 to <span class="prop-value">none</span>.</p>
edahlstr@0 603 <br />
edahlstr@0 604
edahlstr@0 605 <h2 id="FilterEffectsRegion">Filter effects region</h2>
edahlstr@0 606
edahlstr@0 607 <p>A <a>'filter element'</a>
edahlstr@0 608 element can define a region on the canvas to which a given filter effect
edahlstr@0 609 applies and can provide a resolution for any intermediate continuous tone
edahlstr@0 610 images used to process any raster-based <a>filter primitives</a>.
edahlstr@0 611
edahlstr@0 612 The <a>'filter element'</a>
edahlstr@0 613 element has the following attributes which work together to define the filter
edahlstr@0 614 effects region:</p>
edahlstr@0 615
edahlstr@0 616 <dl class='definitions unemphasized-names'>
dino@13 617 <dt id="FilterUnitsAttribute"><a>'filterUnits'</a></dt>
dino@13 618 <dd>
dino@13 619 <p>Defines the coordinate system for attributes <a>'x'</a>, <a>'y'</a>,
dino@13 620 <a>'width'</a>, <a>'height'</a>.</p>
edahlstr@0 621
dino@13 622 <p>If <span class="attr-value">filterUnits="userSpaceOnUse"</span>, <a>'x'</a>, <a>'y'</a>,
dino@13 623 <a>'width'</a>, <a>'height'</a> represent values in the current user coordinate
dino@13 624 system in place at the time when the <a>'filter element'</a> element is referenced (i.e., the
dino@13 625 user coordinate system for the element referencing the <a>'filter element'</a>
dino@13 626 element via a <a>'filter property'</a> property).</p>
dino@13 627
dino@13 628 <p>If <span class="attr-value">filterUnits="objectBoundingBox"</span>, then <a>'x'</a>, <a>'y'</a>,
dino@13 629 <a>'width'</a>, <a>'height'</a> represent fractions or percentages of the
dino@13 630 bounding box on the referencing element (see <a>object bounding box units</a>).</p>
dino@13 631
dino@13 632 <p>The <a>lacuna value</a> for <a>'filterUnits'</a> is <span
dino@13 633 class="attr-value">objectBoundingBox</span>.</p>
dino@13 634
dino@13 635 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 636 </dd>
dino@13 637 <dt id="FilterRegionXYWidthHeightAttributes"><a>'x'</a>, <a>'y'</a>, <a>'width'</a>, <a>'height'</a></dt>
edahlstr@0 638 <dd>
dino@13 639 <p>These attributes define a rectangular region on the canvas to which this filter applies.</p>
dino@13 640 <p>The amount of memory and processing time required to apply the filter are
ed@25 641 related to the size of this rectangle and the <a>'filter/filterRes'</a> attribute of the filter.</p>
dino@13 642 <p>The coordinate system for these attributes depends on the value for attribute <a>'filterUnits'</a>.</p>
dino@13 643 <p>The bounds of this rectangle act as a hard clipping region for each <a>filter primitive</a>
dino@13 644 included with a given <a>'filter element'</a> element; thus, if the effect of
dino@13 645 a given filter primitive would extend beyond the bounds of the rectangle
dino@13 646 (this sometimes happens when using a <a>'feGaussianBlur'</a> filter primitive with a
dino@13 647 very large <a>'feGaussianBlur/stdDeviation'</a>), parts of the effect will get clipped.</p>
edahlstr@0 648
dino@13 649 <p>The <a>lacuna value</a> for <a>'x'</a> and <a>'y'</a> is <span class="attr-value">-10%</span>.</p>
dino@13 650 <p>The <a>lacuna value</a> for <a>'width'</a> and <a>'height'</a> is <span class="attr-value">120%</span>.</p>
dino@13 651 <p>Negative or zero values for <a>'width'</a> or <a>'height'</a> disable rendering of the element which
dino@13 652 referenced the filter. </p>
dino@13 653
dino@13 654 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 655 </dd>
dino@13 656
ed@25 657 <dt id="FilterRegionFilterRes"><a>'filter/filterRes'</a></dt>
dino@13 658 <dd>
dino@13 659 <p>Defines the width and height of the intermediate
ed@25 660 images in pixels. If not provided, then the user agent will use reasonable
ed@25 661 values to produce a high-quality result on the output device.</p>
ed@25 662
dino@13 663 <p>Care should be taken when assigning a non-default value to this
dino@13 664 attribute. Too small of a value may result in unwanted pixelation in the
dino@13 665 result. Too large of a value may result in slow processing and large
dino@13 666 memory usage.</p>
ed@25 667
ed@25 668 <p>Non-integer values are truncated, i.e rounded to the closest integer value towards zero.</p>
ed@25 669
dino@13 670 <p><span class="requirement" id="assert_OORFilterRegion">Negative or zero values disable rendering of the element which referenced the filter.</span></p>
dino@13 671 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 672 </dd>
edahlstr@0 673 </dl>
edahlstr@0 674
edahlstr@0 675 <p>Note that both of the two possible value for <a>'filterUnits'</a> (i.e., <span
edahlstr@0 676 class="attr-value">objectBoundingBox</span> and <span
edahlstr@0 677 class="attr-value">userSpaceOnUse</span>) result in a <a>filter region</a> whose
edahlstr@0 678 coordinate system has its X-axis and Y-axis each parallel to the X-axis and
edahlstr@0 679 Y-axis, respectively, of the <a>user coordinate system</a> for the element to which
edahlstr@0 680 the filter will be applied.</p>
edahlstr@0 681
edahlstr@0 682 <p class="note implementation">Sometimes implementers can achieve faster performance when the filter
edahlstr@0 683 region can be mapped directly to device pixels; thus, for best performance on
edahlstr@0 684 display devices, it is suggested that authors define their region such that
ed@23 685 the user agent can align the <a>filter region</a> pixel-for-pixel with the
edahlstr@0 686 background. In particular, for best filter effects performance, avoid
edahlstr@0 687 rotating or skewing the user coordinate system. Explicit values for attribute
ed@25 688 <a>'filter/filterRes'</a> can either help or harm performance.
ed@25 689 If <a>'filter/filterRes'</a> is smaller than the automatic
edahlstr@0 690 (i.e., default) filter resolution, then filter effect might have faster
ed@25 691 performance (usually at the expense of quality). If <a>'filter/filterRes'</a> is larger than the automatic (i.e.,
edahlstr@0 692 default) filter resolution, then filter effects performance will usually be
edahlstr@0 693 slower.</p>
edahlstr@0 694
edahlstr@0 695 <p class="note authoring">It is often necessary to provide padding space because the filter effect
edahlstr@0 696 might impact bits slightly outside the tight-fitting <a>'bounding box'</a> on a given
edahlstr@0 697 object. For these purposes, it is possible to provide negative percentage
edahlstr@0 698 values for <a>'x'</a>, <a>'y'</a> and percentages values greater than <span class="attr-value">100%</span> for
edahlstr@0 699 <a>'width'</a>, <a>'height'</a>. This, for example, is why the defaults for
edahlstr@0 700 the filter effects region are <span class="attr-value">x="-10%" y="-10%" width="120%"
edahlstr@0 701 height="120%"</span>.</p>
edahlstr@0 702
edahlstr@0 703 <h2 id="AccessBackgroundImage">Accessing the background image</h2>
edahlstr@0 704
edahlstr@0 705 <p id="AccessingBackgroundImage">Two possible pseudo input images for filter effects are <a>BackgroundImage</a> and <a>BackgroundAlpha</a>, which each represent an image
ed@23 706 snapshot of the canvas under the <a>filter region</a> at the time that the <a
edahlstr@0 707 href="#FilterElement"><span class="element-name">'filter'</span></a> element
edahlstr@0 708 is invoked. <a>BackgroundImage</a> represents both
edahlstr@0 709 the color values and alpha channel of the canvas (i.e., RGBA pixel values),
edahlstr@0 710 whereas <a>BackgroundAlpha</a> represents only the
edahlstr@0 711 alpha channel.</p>
edahlstr@0 712
edahlstr@0 713 <p>Implementations <!--of SVG user agents often-->
edahlstr@0 714 will often need to maintain supplemental background image buffers in order to
edahlstr@0 715 support the <a>BackgroundImage</a> and <a>BackgroundAlpha</a> pseudo input images. Sometimes,
edahlstr@0 716 the background image buffers will contain an in-memory copy of the
edahlstr@0 717 accumulated painting operations on the current canvas.</p>
edahlstr@0 718
edahlstr@0 719 <p>Because in-memory image buffers can take up significant system resources, <!--SVG-->
edahlstr@0 720 content must explicitly indicate to the <!--SVG-->
edahlstr@0 721 user agent that the document needs access to the background image before <a>BackgroundImage</a> and <a>BackgroundAlpha</a> pseudo input images can be used.
edahlstr@0 722 </p>
edahlstr@0 723
edahlstr@0 724 A background image is what's been <i>rendered before</i> the current element.
edahlstr@0 725 <edit:hostreq>The host language is responsible for defining what <i>rendered before</i> in
edahlstr@0 726 this context means
edahlstr@0 727 .</edit:hostreq> For SVG, that uses the painter's algorithm, <i>rendered before</i> means
edahlstr@0 728 all of the prior elements in pre order traversal previous to the element to
edahlstr@0 729 which the filter is applied.
edahlstr@0 730
edahlstr@0 731 <p>The property which enables access to the background image is
edahlstr@0 732 <a>'enable-background'</a>:</p>
edahlstr@0 733
edahlstr@0 734
edahlstr@0 735 <div class="propdef">
edahlstr@0 736 <dl>
edahlstr@0 737 <dt id="EnableBackgroundProperty"><span class='propdef-title prop-name'>'enable-background'</span></dt>
edahlstr@0 738 <dd>
edahlstr@0 739 <table summary="enable-background property" class="propinfo"
edahlstr@0 740 cellspacing="0" cellpadding="0">
edahlstr@0 741 <tbody>
edahlstr@0 742 <tr valign="baseline">
edahlstr@0 743 <td><em>Value:</em>  </td>
dino@33 744 <td>accumulate | new | <a class="noxref"
edahlstr@0 745 href="http://www.w3.org/TR/2009/CR-CSS2-20090423/cascade.html#value-def-inherit"><span
edahlstr@0 746 class="value-inst-inherit noxref">inherit</span></a></td>
edahlstr@0 747 </tr>
edahlstr@0 748 <tr valign="baseline">
edahlstr@0 749 <td><em>Initial:</em>  </td>
edahlstr@0 750 <td>accumulate</td>
edahlstr@0 751 </tr>
edahlstr@0 752 <tr valign="baseline">
edahlstr@0 753 <td><em>Applies to:</em>  </td>
edahlstr@6 754 <td>Typically elements that can contain renderable elements.
edahlstr@0 755 language is responsible for defining the applicable set of
edahlstr@0 756 elements.
edahlstr@0 757 For SVG: <a>container elements</a></td>
edahlstr@0 758 </tr>
edahlstr@0 759 <tr valign="baseline">
edahlstr@0 760 <td><em>Inherited:</em>  </td>
edahlstr@0 761 <td>no</td>
edahlstr@0 762 </tr>
edahlstr@0 763 <tr valign="baseline">
edahlstr@0 764 <td><em>Percentages:</em>  </td>
edahlstr@0 765 <td>N/A</td>
edahlstr@0 766 </tr>
edahlstr@0 767 <tr valign="baseline">
edahlstr@0 768 <td><em>Media:</em>  </td>
edahlstr@0 769 <td>visual</td>
edahlstr@0 770 </tr>
edahlstr@0 771 <tr valign="baseline">
edahlstr@0 772 <td><em>Animatable:</em>  </td>
edahlstr@0 773 <td>no</td>
edahlstr@0 774 </tr>
edahlstr@0 775 </tbody>
edahlstr@0 776 </table>
edahlstr@0 777 </dd>
edahlstr@0 778 </dl>
edahlstr@0 779 </div>
edahlstr@0 780 <p><a>'enable-background'</a> is only
edahlstr@0 781 applicable to <a>container elements</a>
edahlstr@0 782 and specifies how the <a>SVG user agent</a> manages the accumulation
edahlstr@0 783 of the background image.</p>
edahlstr@0 784
edahlstr@0 785 <p>A value of <strong>new</strong> indicates two things:</p>
edahlstr@0 786 <ul>
edahlstr@0 787 <li>It enables the ability of children of the current <a>container element</a>
edahlstr@0 788 element to access the background image.</li>
edahlstr@0 789 <li>It indicates that a new (i.e., initially transparent black) background
edahlstr@0 790 image canvas is established and that (in effect) all children of the
edahlstr@0 791 current <a>container element</a>
edahlstr@0 792 element shall be rendered into the new background image canvas in
edahlstr@0 793 addition to being rendered onto the target device.</li>
edahlstr@0 794 </ul>
edahlstr@0 795
edahlstr@0 796 <p>A meaning of <span class="attr-value">enable-background: accumulate</span> (the
edahlstr@0 797 initial/default value) depends on context:</p>
edahlstr@0 798 <ul>
edahlstr@0 799 <li>If an ancestor <a>container element</a>
edahlstr@0 800 element has a property value of <span class="attr-value">'enable-background:new'</span>, then all
edahlstr@0 801 renderable child elements of the current <a>container element</a>
edahlstr@0 802 element are rendered both onto the parent <a>container element</a>
edahlstr@0 803 element's background image canvas and onto the target device.</li>
edahlstr@0 804 <li>Otherwise, there is no current background image canvas, so it is only
edahlstr@0 805 necessary to render <a>graphics elements</a>
edahlstr@0 806 the renderable elements onto the target device. (No need to render to the
edahlstr@0 807 background image canvas.)</li>
edahlstr@0 808 </ul>
edahlstr@0 809
edahlstr@0 810 <p>If a filter effect specifies either the <a>BackgroundImage</a> or the
dino@13 811 <a>BackgroundAlpha</a> pseudo input images and no
edahlstr@0 812 ancestor <a>container element</a>
edahlstr@0 813 element has a property value of <span class="attr-value">'enable-background:new'</span>, then the background
edahlstr@0 814 image request is technically in error. Processing will proceed without
edahlstr@0 815 interruption (i.e., no error message) and a transparent black image shall be
edahlstr@0 816 provided in response to the request.</p>
edahlstr@0 817
edahlstr@0 818 <h3 id="AccessBackgroundImageSVG">Accessing the background image in SVG</h3>
edahlstr@0 819 <p>This section only applies to the SVG definition of enable-background.</p>
edahlstr@0 820
edahlstr@0 821 <p>Assume you have an element E in the document and that E has a series of
edahlstr@0 822 ancestors A<sub>1</sub> (its immediate parent), A<sub>2</sub>, etc. (Note:
edahlstr@0 823 A<sub>0</sub> is E.) Each ancestor A<sub>i</sub> will have a corresponding
edahlstr@0 824 temporary background image offscreen buffer BUF<sub>i</sub>. The contents of
edahlstr@0 825 the <em>background image</em> available to a <a href="#FilterElement"><span
edahlstr@0 826 class="element-name">'filter'</span></a> referenced by E is defined as
edahlstr@0 827 follows:</p>
edahlstr@0 828 <ul>
edahlstr@0 829 <li>Find the element A<sub>i</sub> with the smallest subscript i (including
edahlstr@0 830 A<sub>0</sub>=E) for which the <a href="#EnableBackgroundProperty"><span
edahlstr@0 831 class="prop-name">'enable-background'</span></a> property has the value
edahlstr@0 832 <span class="prop-value">new</span>. (Note: if there is no such ancestor
edahlstr@0 833 element, then there is no background image available to E, in which case
edahlstr@0 834 a transparent black image will be used as E's background image.)</li>
edahlstr@0 835 <li>For each A<sub>i</sub> (from i=n to 1), initialize BUF<sub>i</sub> to
edahlstr@0 836 transparent black. Render all children of A<sub>i</sub> up to but not
edahlstr@0 837 including A<sub>i-1</sub> into BUF<sub>i</sub>. The children are painted,
edahlstr@0 838 then filtered, clipped, masked and composited using the various painting,
edahlstr@0 839 filtering, clipping, masking and object opacity settings on the given
edahlstr@0 840 child. Any filter effects, masking and group opacity that might be set on
edahlstr@0 841 A<sub>i</sub> do <em>not</em> apply when rendering the children of
edahlstr@0 842 A<sub>i</sub> into BUF<sub>i</sub>.<br />
edahlstr@0 843 (Note that for the case of A<sub>0</sub>=E, the graphical contents of E
edahlstr@0 844 are not rendered into BUF<sub>1</sub> and thus are not part of the
edahlstr@0 845 background image available to E. Instead, the graphical contents of E are
edahlstr@0 846 available via the <a href="#SourceGraphic">SourceGraphic</a> and <a
edahlstr@0 847 href="#SourceAlpha">SourceAlpha</a> pseudo input images.)</li>
edahlstr@0 848 <li>Then, for each A<sub>i</sub> (from i=1 to n-1), composite
edahlstr@0 849 BUF<sub>i</sub> into BUF<sub>i+1</sub>.</li>
edahlstr@0 850 <li>The accumulated result (i.e., BUF<sub>n</sub>) represents the
edahlstr@0 851 background image available to E.</li>
edahlstr@0 852 </ul>
edahlstr@0 853
edahlstr@0 854 <edit:example href="examples/enable-background-01.svg" image="yes" link="yes"/>
edahlstr@0 855
edahlstr@0 856 <p>The example above contains five parts, described as follows:</p>
edahlstr@0 857 <ol>
edahlstr@0 858 <li>The first set is the reference graphic. The reference graphic consists
edahlstr@0 859 of a red rectangle followed by a 50% transparent <span
edahlstr@0 860 class="element-name">'g'</span>
edahlstr@0 861 element. Inside the <span class="element-name">'g'</span>
edahlstr@0 862 is a green circle that partially overlaps the rectangle and a a blue
edahlstr@0 863 triangle that partially overlaps the circle. The three objects are then
edahlstr@0 864 outlined by a rectangle stroked with a thin blue line. No filters are
edahlstr@0 865 applied to the reference graphic.</li>
edahlstr@0 866 <li>The second set enables background image processing and adds an empty
edahlstr@0 867 <span class="element-name">'g'</span>
edahlstr@0 868 element which invokes the ShiftBGAndBlur filter. This filter takes the
edahlstr@0 869 current accumulated background image (i.e., the entire reference graphic)
edahlstr@0 870 as input, shifts its offscreen down, blurs it, and then writes the result
edahlstr@0 871 to the canvas. Note that the offscreen for the filter is initialized to
edahlstr@0 872 transparent black, which allows the already rendered rectangle, circle
edahlstr@0 873 and triangle to show through after the filter renders its own result to
edahlstr@0 874 the canvas.</li>
edahlstr@0 875 <li>The third set enables background image processing and instead invokes
edahlstr@0 876 the ShiftBGAndBlur filter on the inner <span
edahlstr@0 877 class="element-name">'g'</span>
edahlstr@0 878 element. The accumulated background at the time the filter is applied
edahlstr@0 879 contains only the red rectangle. Because the children of the inner <span
edahlstr@0 880 class="element-name">'g'</span>
edahlstr@0 881 (i.e., the circle and triangle) are not part of the inner <span
edahlstr@0 882 class="element-name">'g'</span>
edahlstr@0 883 element's background and because ShiftBGAndBlur ignores SourceGraphic,
edahlstr@0 884 the children of the inner <span class="element-name">'g'</span>
edahlstr@0 885 do not appear in the result.</li>
edahlstr@0 886 <li>The fourth set enables background image processing and invokes the
edahlstr@0 887 ShiftBGAndBlur on the <span class="element-name">'polygon'</span>
edahlstr@0 888 element that draws the triangle. The accumulated background at the time
edahlstr@0 889 the filter is applied contains the red rectangle plus the green circle
edahlstr@0 890 ignoring the effect of the <span class="prop-name">'opacity'</span>
edahlstr@0 891 property on the inner <span class="element-name">'g'</span>
edahlstr@0 892 element. (Note that the blurred green circle at the bottom does not let
edahlstr@0 893 the red rectangle show through on its left side. This is due to ignoring
edahlstr@0 894 the effect of the <span class="prop-name">'opacity'</span>
edahlstr@0 895 property.) Because the triangle itself is not part of the accumulated
edahlstr@0 896 background and because ShiftBGAndBlur ignores SourceGraphic, the triangle
edahlstr@0 897 does not appear in the result.</li>
edahlstr@0 898 <li>The fifth set is the same as the fourth except that filter
edahlstr@0 899 ShiftBGAndBlur_WithSourceGraphic is invoked instead of ShiftBGAndBlur.
edahlstr@0 900 ShiftBGAndBlur_WithSourceGraphic performs the same effect as
edahlstr@0 901 ShiftBGAndBlur, but then renders the SourceGraphic on top of the shifted,
edahlstr@0 902 blurred background image. In this case, SourceGraphic is the blue
edahlstr@0 903 triangle; thus, the result is the same as in the fourth case except that
edahlstr@0 904 the blue triangle now appears.</li>
edahlstr@0 905 </ol>
edahlstr@0 906 </edit:with>
edahlstr@0 907
edahlstr@0 908 <h2 id="FilterPrimitivesOverview">Filter primitives overview</h2>
edahlstr@0 909
edahlstr@0 910 <h3 id="FilterPrimitivesOverviewIntro">Overview</h3>
edahlstr@0 911
edahlstr@0 912 <p>This section describes the various filter primtives that can be assembled
edahlstr@0 913 to achieve a particular filter effect.</p>
edahlstr@0 914
edahlstr@0 915 <p>Unless otherwise stated, all image filters operate on premultiplied RGBA
edahlstr@0 916 samples. Filters which work more naturally on non-premultiplied data
edahlstr@0 917 (<a>'feColorMatrix'</a> and <a>'feComponentTransfer'</a>) will temporarily undo and redo
edahlstr@0 918 premultiplication as specified. All raster effect filtering operations take 1
edahlstr@0 919 to N input RGBA images, additional attributes as parameters, and produce a
edahlstr@0 920 single output RGBA image.</p>
edahlstr@0 921
edahlstr@0 922 <p>The RGBA result from each filter primitive will be clamped into the
edahlstr@0 923 allowable ranges for colors and opacity values. Thus, for example, the result
edahlstr@0 924 from a given <a>filter primitive</a> will have any negative color values or opacity
edahlstr@0 925 values adjusted up to color/opacity of zero.</p>
edahlstr@0 926
edahlstr@0 927 <p id="filtersColorSpace">The color space in which a particular <a>filter primitive</a> performs its
edahlstr@0 928 operations is determined by the value of property <a>'color-interpolation-filters'</a> on the given <a>filter
edahlstr@0 929 primitive</a>. A different property, <a>'color-interpolation'</a> determines the color space for
edahlstr@0 930 other color operations. Because these two properties have different initial
edahlstr@0 931 values (<a>'color-interpolation-filters'</a> has an
edahlstr@0 932 initial value of <span class="prop-value">linearRGB</span> whereas <a>'color-interpolation'</a> has an initial value of <span class="prop-value">sRGB</span>), in some cases to achieve certain results
edahlstr@0 933 (e.g., when coordinating gradient interpolation with a filtering operation)
edahlstr@0 934 it will be necessary to explicitly set <a>'color-interpolation'</a> to <span
edahlstr@0 935 class="prop-value">linearRGB</span> or <a>'color-interpolation-filters'</a> to <span
edahlstr@0 936 class="prop-value">sRGB</span> on particular elements. Note that the examples
edahlstr@0 937 below do not explicitly set either <a>'color-interpolation'</a> or <a>'color-interpolation-filters'</a>, so the initial values for these properties apply to the examples.</p>
edahlstr@0 938
edahlstr@0 939 <p><span class="requirement" id="assert_undefinedPixels">Sometimes <a>filter primitives</a> result in undefined pixels. For example,
edahlstr@0 940 filter primitive <a>'feOffset'</a> can shift an image down and to the
edahlstr@0 941 right, leaving undefined pixels at the top and left. In these cases, the
edahlstr@0 942 undefined pixels are set to transparent black.</span></p>
edahlstr@0 943
edahlstr@0 944 <h3 id="CommonAttributes">Common attributes</h3>
edahlstr@0 945
edahlstr@0 946 <p>The following attributes are available for most of the filter
edahlstr@0 947 primitives:</p>
edahlstr@0 948
edahlstr@0 949 <div class="adef-list">
edahlstr@0 950 <p><em>Attribute definitions:</em></p>
edahlstr@0 951 <dl>
edahlstr@0 952 <dt id="FilterPrimitiveXAttribute">
edahlstr@0 953 <span class="adef">x</span> = "<em><a>&lt;coordinate&gt;</a></em>"</dt>
edahlstr@0 954 <dd><p>The minimum x coordinate for the subregion which restricts
edahlstr@0 955 calculation and rendering of the given <a>filter primitive</a>. See <a>filter primitive subregion</a>.</p>
dino@13 956 <p>The <a>lacuna value</a> for <span class="attr-name">x</span> is <span class="attr-value">0%</span>.</p>
dino@13 957 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 958 </dd>
edahlstr@0 959 <dt id="FilterPrimitiveYAttribute">
edahlstr@0 960 <span class="adef">y</span> = "<em><a>&lt;coordinate&gt;</a></em>"</dt>
edahlstr@0 961 <dd><p>The minimum y coordinate for the subregion which restricts
edahlstr@0 962 calculation and rendering of the given <a>filter primitive</a>. See <a>filter primitive subregion</a>. </p>
dino@13 963 <p>The <a>lacuna value</a> for <span class="attr-name">y</span> is <span class="attr-value">0%</span>.</p>
dino@13 964 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 965 </dd>
edahlstr@0 966 <dt id="FilterPrimitiveWidthAttribute">
edahlstr@0 967 <span class="adef">width</span> = "<em><a>&lt;length&gt;</a></em>"</dt>
edahlstr@0 968 <dd><p>The width of the subregion which restricts calculation and rendering
edahlstr@0 969 of the given <a>filter primitive</a>. See <a>filter primitive subregion</a>.</p>
edahlstr@0 970 <p>A negative or zero value disables the effect of the given filter
edahlstr@0 971 primitive (i.e., the result is a transparent black image).</p>
dino@13 972 <p>The <a>lacuna value</a> for <span class="attr-name">width</span> is <span class="attr-value">100%</span>.</p>
edahlstr@0 973 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 974 </dd>
edahlstr@0 975 <dt id="FilterPrimitiveHeightAttribute">
edahlstr@0 976 <span class="adef">height</span> = "<em><a>&lt;length&gt;</a></em>"</dt>
edahlstr@0 977 <dd><p>The height of the subregion which restricts calculation and rendering
edahlstr@0 978 of the given <a>filter primitive</a>. See <a>filter primitive subregion</a>.</p>
edahlstr@0 979 <p>A negative or zero value disables the effect of the given filter
edahlstr@0 980 primitive (i.e., the result is a transparent black image).</p>
dino@13 981 <p>The <a>lacuna value</a> for <span class="attr-name">height</span> is <span class="attr-value">100%</span>.</p>
edahlstr@0 982 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 983 </dd>
edahlstr@0 984 <dt id="FilterPrimitiveResultAttribute">
edahlstr@0 985 <span class="adef">result</span> =
edahlstr@0 986 "<em><a>&lt;filter-primitive-reference&gt;</a></em>"</dt>
edahlstr@0 987 <dd><p>Assigned name for this <a>filter primitive</a>. If supplied, then graphics
edahlstr@0 988 that result from processing this <a>filter primitive</a> can be referenced by
edahlstr@0 989 an <a>'in'</a> attribute on a subsequent filter
edahlstr@0 990 primitive within the same <a>'filter element'</a> element. If no value is
edahlstr@0 991 provided, the output will only be available for re-use as the implicit
edahlstr@0 992 input into the next <a>filter primitive</a> if that <a>filter primitive</a> provides
edahlstr@0 993 no value for its <a>'in'</a> attribute.</p>
edahlstr@0 994 <p>Note that a <a>&lt;filter-primitive-reference&gt;</a> is not an XML
edahlstr@0 995 ID; instead, a <a>&lt;filter-primitive-reference&gt;</a> is only
edahlstr@0 996 meaningful within a given <a>'filter element'</a> element and thus have only
edahlstr@0 997 local scope. It is legal for the same
edahlstr@0 998 <a>&lt;filter-primitive-reference&gt;</a> to appear multiple times
edahlstr@0 999 within the same <a>'filter element'</a> element. When referenced, the
edahlstr@0 1000 <a>&lt;filter-primitive-reference&gt;</a> will use the closest
edahlstr@0 1001 preceding <a>filter primitive</a> with the given result.</p>
edahlstr@0 1002 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 1003 </dd>
edahlstr@0 1004 <dt id="FilterPrimitiveInAttribute">
edahlstr@0 1005 <span class="adef">in</span> = "<em><a>SourceGraphic</a> | <a>SourceAlpha</a> | <a>BackgroundImage</a> | <a>BackgroundAlpha</a> | <a>FillPaint</a> | <a>StrokePaint</a> |
edahlstr@0 1006 <a>&lt;filter-primitive-reference&gt;</a></em>"</dt>
edahlstr@0 1007 <dd><p>Identifies input for the given filter primitive. The value can be
edahlstr@0 1008 either one of six keywords or can be a string which matches a previous
edahlstr@0 1009 <a>'feBlend/result'</a> attribute value within the same <a>'filter element'</a>
edahlstr@0 1010 element. If no value is provided and this is the first <a>filter primitive</a>,
dino@13 1011 then this <a>filter primitive</a> will use <a>SourceGraphic</a>
edahlstr@0 1012 as its input. If no value is provided and this is a subsequent <a>filter primitive</a>,
dino@13 1013 then this <a>filter primitive</a> will use the result from the
edahlstr@0 1014 previous <a>filter primitive</a> as its input.</p>
edahlstr@0 1015 <p>If the value for <span class="attr-name">result</span> appears
edahlstr@0 1016 multiple times within a given <a>'filter element'</a> element, then a reference to
edahlstr@0 1017 that result will use the closest preceding <a>filter primitive</a> with the
edahlstr@0 1018 given value for attribute <a>'feBlend/result'</a>.
edahlstr@0 1019 Forward references to results are not allowed, and will be treated as
edahlstr@0 1020 if no result was specified. </p>
edahlstr@0 1021 <p>Definitions for the six keywords: </p>
edahlstr@0 1022 <dl>
edahlstr@0 1023 <dt id="SourceGraphic"><span class="attr-value">SourceGraphic</span></dt>
edahlstr@0 1024 <dd><p>This keyword represents the graphics elements
edahlstr@0 1025 that were the original input into the <a>'filter element'</a> element. For raster
edahlstr@0 1026 effects <a>filter primitives</a>, the graphics elements
edahlstr@0 1027 will be rasterized into an initially clear RGBA raster in image
edahlstr@0 1028 space. Pixels left untouched by the original graphic will be left
edahlstr@0 1029 clear. The image is specified to be rendered in linear RGBA
edahlstr@0 1030 pixels. The alpha channel of this image captures any
edahlstr@0 1031 anti-aliasing specified by SVG. (Since the raster is linear, the
edahlstr@0 1032 alpha channel of this image will represent the exact percent
edahlstr@0 1033 coverage of each pixel.)</p></dd>
edahlstr@0 1034 <dt id="SourceAlpha"><span class="attr-value">SourceAlpha</span></dt>
edahlstr@0 1035 <dd><p>This keyword represents the graphics elements
edahlstr@0 1036 that were the original input into the <a>'filter element'</a> element.
dino@13 1037 <a>SourceAlpha</a> has all of the same rules
edahlstr@0 1038 as <a>SourceGraphic</a> except that only the
edahlstr@0 1039 alpha channel is used. The input image is an RGBA image
edahlstr@0 1040 consisting of implicitly black color values for the RGB channels,
edahlstr@0 1041 but whose alpha channel is the same as <a>SourceGraphic</a>.</p>
dino@13 1042 <p class="note implementation">If this option is
edahlstr@0 1043 used, then some implementations might need to rasterize the
edahlstr@0 1044 graphics elements
edahlstr@0 1045 in order to extract the alpha channel.</p>
dino@13 1046 </dd>
edahlstr@0 1047 <dt id="BackgroundImage"><span class="attr-value">BackgroundImage</span></dt>
edahlstr@0 1048 <dd><p>This keyword represents an image snapshot of the canvas under
ed@23 1049 the <a>filter region</a> at the time that the <a>'filter element'</a> element was invoked. See
edahlstr@0 1050 <a href="#AccessingBackgroundImage">accessing the background
edahlstr@0 1051 image</a>.</p>
dino@13 1052 </dd>
edahlstr@0 1053 <dt id="BackgroundAlpha"><span class="attr-value">BackgroundAlpha</span></dt>
edahlstr@0 1054 <dd><p>Same as <a>BackgroundImage</a> except
edahlstr@0 1055 only the alpha channel is used. See <a>SourceAlpha</a> and <a
edahlstr@0 1056 href="#AccessingBackgroundImage">accessing the background
edahlstr@0 1057 image</a>.</p>
dino@13 1058 </dd>
edahlstr@0 1059
edahlstr@0 1060 <dt id="FillPaint"><span class="attr-value">FillPaint</span></dt>
edahlstr@0 1061 <dd>
edahlstr@6 1062 <p>This keyword represents the target element <i>rendered filled</i>.</p>
dino@13 1063 <p>For svg this keyword represents the value of the <a>'fill'</a>
edahlstr@0 1064 property on the target element for the filter effect.</p>
edahlstr@6 1065 <p>For non-SVG cases <a>FillPaint</a> generates a transparent black image.
edahlstr@6 1066 <span class="specissue">ISSUE: Consider whether this should be e.g the CSS bounding box filled with the current color, or if it makes sense to use the 'fill' property for this case too.</span>
edahlstr@6 1067 </p>
dino@13 1068 <p class="note authoring">Note that text is generally painted filled, not stroked.</p>
dino@13 1069 <p>The <a>FillPaint</a> image has conceptually infinite extent.
dino@13 1070 Frequently this image is opaque everywhere, but it might not be if the "paint"
dino@13 1071 itself has alpha, as in the case of a gradient or pattern which
dino@13 1072 itself includes transparent or semi-transparent parts.</p>
dino@13 1073 </dd>
edahlstr@0 1074 <dt id="StrokePaint"><span class="attr-value">StrokePaint</span></dt>
edahlstr@0 1075 <dd>
dino@13 1076 <p>This keyword represents the target element <i>rendered stroked</i>.</p>
edahlstr@6 1077 <p>For svg this keyword represents the value of the <a>'stroke'</a>
edahlstr@6 1078 on the target element for the filter effect.</p>
edahlstr@6 1079 <p>For non-SVG cases <a>StrokePaint</a> generates a transparent black image.
edahlstr@6 1080 <span class="specissue">ISSUE: Consider whether this should be e.g the CSS bounding box filled with the one of the border colors, or if it makes sense to use the 'stroke' property for this case too.</span>
edahlstr@6 1081 </p>
dino@13 1082 <p class="note authoring">Note that text is generally painted filled, not stroked.</p>
dino@13 1083 <p>The <a>StrokePaint</a> image has conceptually infinite extent.
dino@13 1084 Frequently this image is opaque everywhere, but it
dino@13 1085 might not be if the "paint"
dino@13 1086 itself has alpha, as in the case of a gradient or pattern which
dino@13 1087 itself includes transparent or semi-transparent parts.
dino@13 1088 </p>
dino@13 1089 </dd>
edahlstr@0 1090 </dl>
edahlstr@0 1091 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 1092 </dd>
edahlstr@0 1093 </dl>
edahlstr@0 1094 </div>
edahlstr@0 1095
edahlstr@0 1096 <h3 id="FilterPrimitiveSubRegion">Filter primitive subregion</h3>
edahlstr@0 1097
edahlstr@0 1098 <edit:with element="feBlend">
edahlstr@0 1099 <p>
edahlstr@0 1100 All <a>filter primitives</a> have attributes <a>'x'</a>, <a>'y'</a>,
ed@14 1101 <a>'width'</a> and <a>'height'</a> which
edahlstr@0 1102 together identify a subregion which restricts calculation and rendering of
edahlstr@0 1103 the given <a>filter primitive</a>. The <a>'x'</a>, <a>'y'</a>,
edahlstr@0 1104 <a>'width'</a> and <a>'height'</a> attributes are defined
edahlstr@0 1105 according to the same rules as other <a>filter primitives</a>' coordinate and length
edahlstr@0 1106 attributes and thus represent values in the coordinate system established by
edahlstr@0 1107 attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a> element.
edahlstr@0 1108 </p>
edahlstr@0 1109
edahlstr@0 1110 <p><a>'x'</a>, <a>'y'</a>,
edahlstr@0 1111 <a>'width'</a> and <a>'height'</a> default to the union (i.e., tightest fitting bounding
edahlstr@0 1112 box) of the subregions defined for all referenced nodes. If there are no
edahlstr@0 1113 referenced nodes (e.g., for <a>'feImage'</a> or <a>'feTurbulence'</a>), or one or more of the
edahlstr@0 1114 referenced nodes is a standard input (one of <a>SourceGraphic</a>, <a>SourceAlpha</a>, <a>BackgroundImage</a>, <a>BackgroundAlpha</a>,
edahlstr@0 1115 <a href="#FillPaint"><span class="attr-value">FillPaint</span></a> or <a
edahlstr@0 1116 href="#StrokePaint"><span class="attr-value">StrokePaint</span></a>), or for
edahlstr@0 1117 <a href="#feTileElement"><span class="element-name">'feTile'</span></a>
edahlstr@0 1118 (which is special because its principal function is to replicate the
edahlstr@0 1119 referenced node in X and Y and thereby produce a usually larger result), the
ed@23 1120 default subregion is <span class="attr-value">0%, 0%, 100%, 100%</span>,
ed@23 1121 where as a special-case the percentages are relative to the dimensions of the <a>filter region</a>,
ed@23 1122 thus making the default <a>filter primitive subregion</a> equal to the <a>filter region</a>.
ed@23 1123 </p>
edahlstr@0 1124
ed@14 1125 <p>If the <a>filter primitive
edahlstr@0 1126 subregion</a> has a negative or zero width or height, the effect of the filter
edahlstr@0 1127 primitive is disabled. </p>
edahlstr@0 1128
ed@29 1129 <p>The <a>filter primitive subregion</a> act as a hard clip clipping rectangle on both the
ed@29 1130 filter primitive's input image(s) and the filter primitive result.</p>
ed@29 1131 <p class="specissue">ISSUE: Consider making it possible to do select between clip-input, clip-output, clip-both or none.</p>
edahlstr@0 1132
edahlstr@0 1133 <p>All intermediate offscreens are defined to not exceed the intersection of
ed@23 1134 the <a>filter primitive subregion</a> with the <a>filter region</a>.
ed@23 1135 The <a>filter region</a> and any of the filter primitive subregions are
edahlstr@0 1136 to be set up such that all offscreens are made big enough to accommodate any
ed@23 1137 pixels which even partly intersect with either the <a>filter region</a> or the
edahlstr@0 1138 filter primitive subregions.</p>
edahlstr@0 1139
edahlstr@0 1140 <p><a>'feTile'</a> references a previous filter primitive and then stitches the tiles together
edahlstr@0 1141 based on the <a>filter primitive subregion</a> of the referenced filter primitive in
edahlstr@0 1142 order to fill its own <a>filter primitive subregion</a>.</p>
edahlstr@0 1143
edahlstr@0 1144 <edit:example href="examples/filtersubregion00.svg" image="yes" link="yes"/>
edahlstr@0 1145
edahlstr@0 1146 <p>
ed@23 1147 In the example above there are three rects that each have a cross and a circle in them.
ed@23 1148
ed@23 1149 The circle element in each one has a different filter applied, but with the same <a>filter primitive subregion</a>.
ed@23 1150 The filter output should be limited to the <a>filter primitive subregion</a>, so you should never see the circles
ed@23 1151 themselves, just the rects that make up the <a>filter primitive subregion</a>.
edahlstr@0 1152 </p>
edahlstr@0 1153 <ul>
edahlstr@0 1154 <li>
edahlstr@0 1155 The upper left rect shows an <a>'feFlood'</a> with <span class="attr-name">flood-opacity</span>="<span class="attr-value">75%</span>" so the cross should be visible through the green rect in the middle.
edahlstr@0 1156 </li>
edahlstr@0 1157 <li>
edahlstr@0 1158 The lower left rect shows an <a>'feMerge'</a> that merges <a>SourceGraphic</a> with <a>FillPaint</a>. Since the circle has <span class="attr-name">fill-opacity</span>="<span class="attr-value">0.5</span>" it will also be transparent so that the cross is visible through the green rect in the middle.
edahlstr@0 1159 </li>
edahlstr@0 1160 <li>The upper right rect shows an <a>'feBlend'</a> that has <span class="attr-name">mode</span>="<span class="attr-value">multiply</span>". Since the circle in this case isn't transparent the result is totally opaque. The rect should be dark green and the cross should not be visible through it.
edahlstr@0 1161 </li>
edahlstr@0 1162 </ul>
edahlstr@0 1163
edahlstr@0 1164 </edit:with>
edahlstr@0 1165
edahlstr@0 1166 <h2 id="LightSourceDefinitions">Light source elements and properties</h2>
edahlstr@0 1167
edahlstr@0 1168 <h3 id="LightSourceIntro">Introduction</h3>
edahlstr@0 1169
edahlstr@0 1170 <p>The following sections define the elements that define a light source, <a>'feDistantLight'</a>,
edahlstr@0 1171 <a>'fePointLight'</a> and <a>'feSpotLight'</a>,
edahlstr@0 1172 and property <a>'lighting-color'</a>, which defines the color of the
edahlstr@0 1173 light.</p>
edahlstr@0 1174
edahlstr@0 1175 <h3 id="feDistantLightElement">Light source <span class="element-name">'feDistantLight'</span></h3>
edahlstr@0 1176
edahlstr@0 1177 <edit:elementsummary name='feDistantLight'/>
ed@17 1178 <edit:with element='feDistantLight'>
edahlstr@0 1179
edahlstr@0 1180 <div class="adef-list">
edahlstr@0 1181 <p><em>Attribute definitions:</em></p>
edahlstr@0 1182 <dl>
edahlstr@0 1183 <dt id="feDistantLightAzimuthAttribute"><span
edahlstr@0 1184 class="adef">azimuth</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1185 <dd>Direction angle for the light source on the XY plane (clockwise), in
ed@30 1186 degrees from the x axis.<br />
ed@17 1187 The <a>lacuna value</a> for <a>'azimuth'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1188 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1189 <dt id="feDistantLightElevationAttribute"><span
edahlstr@0 1190 class="adef">elevation</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
ed@31 1191 <dd>Direction angle for the light source from the XY plane towards the Z-axis, in degrees.
ed@30 1192 Note that the positive Z-axis points towards the viewer.<br />
ed@30 1193 The <a>lacuna value</a> for <a>'elevation'</a> is <span class="attr-value">0</span>.<br />
ed@30 1194 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1195 </dl>
edahlstr@0 1196 </div>
ed@30 1197
ed@30 1198 <p>
ed@30 1199 The following diagram illustrates the angles which <a>'azimuth'</a>
ed@30 1200 and <a>'elevation'</a> represent in an XYZ coordinate system.
ed@30 1201 </p>
ed@30 1202 <img src="examples/azimuth-elevation.png" alt="Angles which azimuth and elevation represent" width="480" height="360" />
ed@17 1203 </edit:with>
edahlstr@0 1204
edahlstr@0 1205 <h3 id="fePointLightElement">Light source <span class="element-name">'fePointLight'</span></h3>
edahlstr@0 1206
edahlstr@0 1207 <edit:elementsummary name='fePointLight'/>
edahlstr@0 1208
edahlstr@0 1209 <div class="adef-list">
edahlstr@0 1210 <p><em>Attribute definitions:</em></p>
edahlstr@0 1211 <dl>
edahlstr@0 1212 <dt id="fePointLightXAttribute"><span
edahlstr@0 1213 class="adef">x</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1214 <dd>X location for the light source in the coordinate system established
edahlstr@0 1215 by attribute <a>'filter/primitiveUnits'</a> on the <a
edahlstr@0 1216 href="#FilterElement"><span class="element-name">'filter'</span></a>
edahlstr@0 1217 element.<br />
ed@17 1218 The <a>lacuna value</a> for <a>'fePointLight/x'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1219 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1220 <dt id="fePointLightYAttribute"><span
edahlstr@0 1221 class="adef">y</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1222 <dd>Y location for the light source in the coordinate system established
edahlstr@0 1223 by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 1224 element.<br />
ed@17 1225 The <a>lacuna value</a> for <a>'fePointLight/y'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1226 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1227 <dt id="fePointLightZAttribute"><span
edahlstr@0 1228 class="adef">z</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1229 <dd>Z location for the light source in the coordinate system established
edahlstr@0 1230 by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 1231 element, assuming that, in the <a>initial coordinate system</a>
edahlstr@0 1232 , the positive Z-axis comes out towards the person viewing the content
edahlstr@0 1233 and assuming that one unit along the Z-axis equals <a href="http://www.w3.org/TR/SVG11/coords.html#Units_viewport_percentage">one unit in X and Y</a>.<br />
ed@17 1234 The <a>lacuna value</a> for <a>'fePointLight/z'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1235 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1236 </dl>
edahlstr@0 1237 </div>
edahlstr@0 1238
edahlstr@0 1239 <h3 id="feSpotLightElement">Light source <span class="element-name">'feSpotLight'</span></h3>
edahlstr@0 1240
edahlstr@0 1241 <edit:elementsummary name='feSpotLight'/>
ed@17 1242 <edit:with element='feSpotLight'>
edahlstr@0 1243
edahlstr@0 1244 <div class="adef-list">
edahlstr@0 1245 <p><em>Attribute definitions:</em></p>
edahlstr@0 1246 <dl>
edahlstr@0 1247 <dt id="feSpotLightXAttribute"><span
edahlstr@0 1248 class="adef">x</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1249 <dd>X location for the light source in the coordinate system established
edahlstr@0 1250 by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 1251 element.<br />
ed@17 1252 The <a>lacuna value</a> for <a>'feSpotLight/x'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1253 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1254 <dt id="feSpotLightYAttribute"><span
edahlstr@0 1255 class="adef">y</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1256 <dd>Y location for the light source in the coordinate system established
edahlstr@0 1257 by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 1258 element.<br />
ed@17 1259 The <a>lacuna value</a> for <a>'feSpotLight/y'</a> is <span class="attr-value">0</span>.<br />
ed@17 1260 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1261 <dt id="feSpotLightZAttribute"><span
edahlstr@0 1262 class="adef">z</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1263 <dd>Z location for the light source in the coordinate system established
edahlstr@0 1264 by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 1265 element, assuming that, in the <a>initial coordinate system</a>
edahlstr@0 1266 , the positive Z-axis comes out towards the person viewing the content
edahlstr@0 1267 and assuming that one unit along the Z-axis equals <a href="http://www.w3.org/TR/SVG11/coords.html#Units_viewport_percentage">one unit in X and Y</a>.<br />
ed@17 1268 The <a>lacuna value</a> for <a>'feSpotLight/z'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1269 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1270 <dt id="feSpotLightPointsAtXAttribute"><span
edahlstr@0 1271 class="adef">pointsAtX</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1272 <dd>X location in the coordinate system established by attribute <a>'filter/primitiveUnits'</a>
dino@13 1273 on the <a>'filter element'</a>
edahlstr@0 1274 element of the point at which the light source is pointing.<br />
ed@17 1275 The <a>lacuna value</a> for <a>'pointsAtX'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1276 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1277 <dt id="feSpotLightPointsAtYAttribute"><span
edahlstr@0 1278 class="adef">pointsAtY</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1279 <dd>Y location in the coordinate system established by attribute <a>'filter/primitiveUnits'</a>
dino@13 1280 on the <a>'filter element'</a> element of the point at which the light source is pointing.<br />
ed@17 1281 The <a>lacuna value</a> for <a>'pointsAtY'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1282 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1283 <dt id="feSpotLightPointsAtZAttribute"><span
edahlstr@0 1284 class="adef">pointsAtZ</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1285 <dd>Z location in the coordinate system established by the
dino@13 1286 attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a> element of
dino@13 1287 the point at which the light source is pointing, assuming that, in the
dino@13 1288 <a>initial coordinate system</a>, the positive Z-axis comes out
edahlstr@0 1289 towards the person viewing the content and assuming that
edahlstr@0 1290 one unit along the Z-axis equals
edahlstr@0 1291 <a href="http://www.w3.org/TR/SVG11/coords.html#Units_viewport_percentage">
edahlstr@0 1292 one unit in X and Y</a>.<br />
ed@17 1293 The <a>lacuna value</a> for <a>'pointsAtZ'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1294 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1295 <dt id="feSpotLightSpecularExponentAttribute"><span
edahlstr@0 1296 class="adef">specularExponent</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1297 <dd>Exponent value controlling the focus for the light source.<br />
ed@17 1298 The <a>lacuna value</a> for <a>'specularExponent'</a> is <span class="attr-value">1</span>.<br />
edahlstr@0 1299 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1300 <dt id="feSpotLightLimitingConeAngleAttribute"><span
edahlstr@0 1301 class="adef">limitingConeAngle</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1302 <dd>A limiting cone which restricts the region where the light is
edahlstr@0 1303 projected. No light is projected outside the cone. <span
edahlstr@0 1304 class="attr-name">limitingConeAngle</span> represents the angle in degrees between
edahlstr@0 1305 the spot light axis (i.e. the axis between the light source and the
edahlstr@0 1306 point to which it is pointing at) and the spot light cone. <span class="requirement" id="assert_userAgentLightingConeSmoothing">User agents
edahlstr@0 1307 should apply a smoothing technique such as anti-aliasing at the
edahlstr@0 1308 boundary of the cone.</span><br />
edahlstr@0 1309 If no value is specified, then no limiting cone will be applied.<br />
edahlstr@0 1310 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1311 </dl>
edahlstr@0 1312 </div>
ed@17 1313 </edit:with>
edahlstr@0 1314
edahlstr@0 1315 <h3 id="LightingColorProperty">The <span class="prop-name">'lighting-color'</span> property</h3>
edahlstr@0 1316
edahlstr@0 1317 <p>The <a>'lighting-color'</a> property defines the
edahlstr@0 1318 color of the light source for <a>filter primitives</a> <a>'feDiffuseLighting'</a> and <a>'feSpecularLighting'</a>.</p>
edahlstr@0 1319
edahlstr@0 1320 <div class="propdef">
edahlstr@0 1321 <dl>
edahlstr@0 1322 <dt><span class="index-def" title="'margin-top'"><a
edahlstr@0 1323 id="propdef-lighting-color" name="propdef-lighting-color"
edahlstr@0 1324 class="propdef-title"><span
edahlstr@0 1325 class="prop-name">'lighting-color'</span></a></span></dt>
edahlstr@0 1326 <dd>
edahlstr@0 1327 <table summary="lighting-color property" class="propinfo"
edahlstr@0 1328 cellspacing="0" cellpadding="0">
edahlstr@0 1329 <tbody>
edahlstr@0 1330 <tr valign="baseline">
edahlstr@0 1331 <td><em>Value:</em>  </td>
edahlstr@0 1332 <td>currentColor |<br />
edahlstr@0 1333 <a>&lt;color&gt;</a>
edahlstr@0 1334 [<a>&lt;icccolor&gt;</a>] |<br />
edahlstr@0 1335 <a class="noxref"
edahlstr@0 1336 href="http://www.w3.org/TR/2009/CR-CSS2-20090423/cascade.html#value-def-inherit"><span
edahlstr@0 1337 class="value-inst-inherit noxref">inherit</span></a></td>
edahlstr@0 1338 </tr>
edahlstr@0 1339 <tr valign="baseline">
edahlstr@0 1340 <td><em>Initial:</em>  </td>
edahlstr@0 1341 <td>white</td>
edahlstr@0 1342 </tr>
edahlstr@0 1343 <tr valign="baseline">
edahlstr@0 1344 <td><em>Applies to:</em>  </td>
edahlstr@0 1345 <td><a>'feDiffuseLighting'</a> and <a>'feSpecularLighting'</a>
edahlstr@0 1346 elements</td>
edahlstr@0 1347 </tr>
edahlstr@0 1348 <tr valign="baseline">
edahlstr@0 1349 <td><em>Inherited:</em>  </td>
edahlstr@0 1350 <td>no</td>
edahlstr@0 1351 </tr>
edahlstr@0 1352 <tr valign="baseline">
edahlstr@0 1353 <td><em>Percentages:</em>  </td>
edahlstr@0 1354 <td>N/A</td>
edahlstr@0 1355 </tr>
edahlstr@0 1356 <tr valign="baseline">
edahlstr@0 1357 <td><em>Media:</em>  </td>
edahlstr@0 1358 <td>visual</td>
edahlstr@0 1359 </tr>
edahlstr@0 1360 <tr valign="baseline">
edahlstr@0 1361 <td><em>Animatable:</em>  </td>
edahlstr@0 1362 <td>yes</td>
edahlstr@0 1363 </tr>
edahlstr@0 1364 </tbody>
edahlstr@0 1365 </table>
edahlstr@0 1366 </dd>
edahlstr@0 1367 </dl>
edahlstr@0 1368 </div>
edahlstr@0 1369
edahlstr@0 1370 <h2 id="feBlendElement">Filter primitive <span class="element-name">'feBlend'</span></h2>
edahlstr@0 1371
edahlstr@0 1372 <edit:elementsummary name='feBlend'/>
ed@17 1373 <edit:with element='feBlend'>
edahlstr@0 1374
edahlstr@0 1375 <p>This filter composites two objects together using commonly used imaging
edahlstr@0 1376 software blending modes. It performs a pixel-wise combination of two input
edahlstr@0 1377 images.</p>
edahlstr@0 1378
edahlstr@0 1379 <div class="adef-list">
edahlstr@0 1380 <p><em>Attribute definitions:</em></p>
edahlstr@0 1381 <dl>
edahlstr@0 1382 <dt id="feBlendModeAttribute"><span
edahlstr@0 1383 class="adef">mode</span> = "<em>normal | multiply | screen | darken |
edahlstr@0 1384 lighten</em>"</dt>
edahlstr@0 1385 <dd>One of the image blending modes (see <a
ed@17 1386 href="#BlendingTable">table</a> below). The <a>lacuna value</a> for <a>'mode'</a> is <span class="attr-value">normal</span>.<br />
edahlstr@0 1387 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1388 <dt id="feBlendIn2Attribute"><span
edahlstr@0 1389 class="adef">in2</span> = "<em>(see <a
edahlstr@0 1390 href="#FilterPrimitiveInAttribute"><span class="attr-name">in</span></a>
edahlstr@0 1391 attribute)</em>"</dt>
edahlstr@0 1392 <dd>The second input image to the blending operation. This attribute can
edahlstr@0 1393 take on the same values as the <a
edahlstr@0 1394 href="#FilterPrimitiveInAttribute"><span
edahlstr@0 1395 class="attr-name">in</span></a> attribute.<br />
edahlstr@0 1396 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1397 </dl>
edahlstr@0 1398 </div>
edahlstr@0 1399
edahlstr@0 1400 <p>For all feBlend modes, the result opacity is computed as follows:</p>
edahlstr@0 1401 <pre>qr = 1 - (1-qa)*(1-qb)</pre>
edahlstr@0 1402
edahlstr@0 1403 <p>For the compositing formulas below, the following definitions apply:</p>
edahlstr@0 1404 <pre>image A = in
edahlstr@0 1405 image B = in2
edahlstr@0 1406 cr = Result color (RGB) - premultiplied
edahlstr@0 1407 qa = Opacity value at a given pixel for image A
edahlstr@0 1408 qb = Opacity value at a given pixel for image B
edahlstr@0 1409 ca = Color (RGB) at a given pixel for image A - premultiplied
edahlstr@0 1410 cb = Color (RGB) at a given pixel for image B - premultiplied </pre>
edahlstr@0 1411
edahlstr@0 1412 <p id="BlendingTable">The following table
edahlstr@0 1413 provides the list of available image blending modes:</p>
edahlstr@0 1414
edahlstr@0 1415 <div class="note-editor">
edahlstr@0 1416 ED: make table look nicer</div>
edahlstr@0 1417
edahlstr@0 1418 <table summary="blending modes" width="500" border="1">
edahlstr@0 1419 <tbody>
edahlstr@0 1420 <tr>
edahlstr@0 1421 <td>Image Blending Mode</td>
edahlstr@0 1422 <td>Formula for computing result color</td>
edahlstr@0 1423 </tr>
edahlstr@0 1424 <tr>
edahlstr@0 1425 <td>normal</td>
edahlstr@0 1426 <td>cr = (1 - qa) * cb + ca</td>
edahlstr@0 1427 </tr>
edahlstr@0 1428 <tr>
edahlstr@0 1429 <td>multiply</td>
edahlstr@0 1430 <td>cr = (1-qa)*cb + (1-qb)*ca + ca*cb</td>
edahlstr@0 1431 </tr>
edahlstr@0 1432 <tr>
edahlstr@0 1433 <td>screen</td>
edahlstr@0 1434 <td>cr = cb + ca - ca * cb</td>
edahlstr@0 1435 </tr>
edahlstr@0 1436 <tr>
edahlstr@0 1437 <td>darken</td>
edahlstr@0 1438 <td>cr = Min ((1 - qa) * cb + ca, (1 - qb) * ca + cb)</td>
edahlstr@0 1439 </tr>
edahlstr@0 1440 <tr>
edahlstr@0 1441 <td>lighten</td>
edahlstr@0 1442 <td>cr = Max ((1 - qa) * cb + ca, (1 - qb) * ca + cb)</td>
edahlstr@0 1443 </tr>
edahlstr@0 1444 </tbody>
edahlstr@0 1445 </table>
edahlstr@0 1446
ed@17 1447 <p>The <span class="attr-value">'normal'</span> blend mode is equivalent to <a
edahlstr@0 1448 href="#feCompositeOperatorAttribute"><span
edahlstr@0 1449 class="attr-value">operator="over"</span></a> on the <a>'feComposite'</a>
edahlstr@0 1450 filter primitive, matches the blending method used by <a>'feMerge'</a> and matches
edahlstr@0 1451 the <a>simple alpha compositing</a> technique used in SVG for all compositing outside of filter effects.</p>
edahlstr@0 1452
ed@17 1453 </edit:with>
edahlstr@0 1454 <edit:example href="examples/feBlend.svg" image="yes" link="yes"/>
edahlstr@0 1455
edahlstr@0 1456 <h2 id="feColorMatrixElement">Filter primitive <span class="element-name">'feColorMatrix'</span></h2>
edahlstr@0 1457
edahlstr@0 1458 <edit:elementsummary name='feColorMatrix'/>
edahlstr@0 1459
edahlstr@0 1460 <p>This filter applies a matrix transformation:</p>
edahlstr@0 1461 <object data="mathml/feColorMatrix00.mml" type="application/mathml+xml" width="100%" height="140">
edahlstr@0 1462 <pre>| R' | | a00 a01 a02 a03 a04 | | R |
edahlstr@0 1463 | G' | | a10 a11 a12 a13 a14 | | G |
edahlstr@0 1464 | B' | = | a20 a21 a22 a23 a24 | * | B |
edahlstr@0 1465 | A' | | a30 a31 a32 a33 a34 | | A |
edahlstr@0 1466 | 1 | | 0 0 0 0 1 | | 1 |</pre>
edahlstr@0 1467 </object>
edahlstr@0 1468
edahlstr@0 1469 <p>on the RGBA color and alpha values of every pixel on the input graphics to
edahlstr@0 1470 produce a result with a new set of RGBA color and alpha values.</p>
edahlstr@0 1471
edahlstr@0 1472 <p>The calculations are performed on non-premultiplied color values. If the
edahlstr@0 1473 input graphics consists of premultiplied color values, those values are
edahlstr@0 1474 automatically converted into non-premultiplied color values for this
edahlstr@0 1475 operation.</p>
edahlstr@0 1476
edahlstr@0 1477 <p>These matrices often perform an identity mapping in the alpha channel. If
edahlstr@0 1478 that is the case, an implementation can avoid the costly undoing and redoing
edahlstr@0 1479 of the premultiplication for all pixels with A = 1.</p>
edahlstr@0 1480
edahlstr@0 1481 <div class="adef-list">
edahlstr@0 1482 <p><em>Attribute definitions:</em></p>
edahlstr@0 1483 <dl>
edahlstr@0 1484 <dt id="feColorMatrixTypeAttribute"><span class="adef">type</span> =
edahlstr@0 1485 "<em>matrix | saturate | hueRotate | luminanceToAlpha</em>"</dt>
edahlstr@0 1486 <dd>Indicates the type of matrix operation. The keyword <span
edahlstr@0 1487 class="attr-name">matrix</span> indicates that a full 5x4 matrix of
edahlstr@0 1488 values will be provided. The other keywords represent convenience
edahlstr@0 1489 shortcuts to allow commonly used color operations to be performed
ed@17 1490 without specifying a complete matrix.
ed@17 1491 The <a>lacuna value</a> for <a>'type'</a> is <span class="attr-value">matrix</span>.
ed@17 1492 <br />
edahlstr@0 1493 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1494 <dt id="feColorMatrixValuesAttribute"><span class="adef">values</span> =
edahlstr@0 1495 "<em>list of <a>&lt;number&gt;</a>s</em>"</dt>
edahlstr@0 1496 <dd>The contents of <span class="attr-name">values</span> depends on the
edahlstr@0 1497 value of attribute <a href="#feColorMatrixTypeAttribute"><span
edahlstr@0 1498 class="attr-name">type</span></a>:
edahlstr@0 1499 <ul>
edahlstr@0 1500 <li>For <span class="attr-value">type="matrix"</span>, <span
edahlstr@0 1501 class="attr-name">values</span> is a list of 20 matrix values (a00
edahlstr@0 1502 a01 a02 a03 a04 a10 a11 ... a34), separated by whitespace and/or a
edahlstr@0 1503 comma. For example, the identity matrix could be expressed as:
edahlstr@0 1504 <pre>type="matrix"
edahlstr@0 1505 values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"</pre>
edahlstr@0 1506 </li>
edahlstr@0 1507 <li>For <span class="attr-value">type="saturate"</span>, <span
edahlstr@0 1508 class="attr-name">values</span> is a single real number value (0 to
edahlstr@0 1509 1). A <span class="attr-value">saturate</span> operation is
edahlstr@0 1510 equivalent to the following matrix operation:
dino@13 1511 <p>
dino@13 1512 <object data="mathml/feColorMatrix01.mml" type="application/mathml+xml" width="100%" height="130">
dino@36 1513 <pre>| R' | | (0.2127 + 0.7873s) (0.7152 - 0.7152s) (0.0722 - 0.0722s) 0 0 | | R |
dino@36 1514 | G' | | (0.2127 - 0.2127s) (0.7152 + 0.2848s) (0.0722 - 0.0722s) 0 0 | | G |
dino@36 1515 | B' | = | (0.2127 - 0.2127s) (0.7152 - 0.7152s) (0.0722 + 0.9278s) 0 0 | * | B |
dino@36 1516 | A' | | 0 0 0 1 0 | | A |
dino@36 1517 | 1 | | 0 0 0 0 1 | | 1 |</pre>
dino@13 1518 </object>
dino@13 1519 </p>
edahlstr@0 1520 </li>
edahlstr@0 1521 <li>For <span class="attr-value">type="hueRotate"</span>, <span
edahlstr@0 1522 class="attr-name">values</span> is a single one real number value
edahlstr@0 1523 (degrees). A <span class="attr-value">hueRotate</span> operation is
edahlstr@0 1524 equivalent to the following matrix operation:
dino@13 1525 <p>
dino@13 1526 <object data="mathml/feColorMatrix02.mml" type="application/mathml+xml" width="100%" height="130">
edahlstr@0 1527 <pre>| R' | | a00 a01 a02 0 0 | | R |
edahlstr@0 1528 | G' | | a10 a11 a12 0 0 | | G |
edahlstr@0 1529 | B' | = | a20 a21 a22 0 0 | * | B |
edahlstr@0 1530 | A' | | 0 0 0 1 0 | | A |
edahlstr@0 1531 | 1 | | 0 0 0 0 1 | | 1 |</pre>
dino@13 1532 </object>
dino@13 1533 </p>
edahlstr@0 1534
edahlstr@0 1535 where the terms a00, a01, etc. are calculated as follows:
dino@13 1536 <p>
dino@13 1537 <object data="mathml/feColorMatrix03.mml" type="application/mathml+xml" width="100%" height="230">
dino@36 1538 <pre>| a00 a01 a02 | [0.2127 0.7152 0.0722]
dino@36 1539 | a10 a11 a12 | = [0.2127 0.7152 0.0722] +
dino@36 1540 | a20 a21 a22 | [0.2127 0.7152 0.0722]
dino@36 1541
dino@36 1542 [ 0.7873 -0.7152 -0.0722]
dino@36 1543 cos(hueRotate value) * [-0.2127 0.2848 -0.0722] +
dino@36 1544 [-0.2127 -0.7152 0.9278]
dino@36 1545
dino@36 1546 [-0.2127 -0.7152 0.9278]
dino@36 1547 sin(hueRotate value) * [ 0.143 0.140 -0.283 ]
dino@36 1548 [-0.7873 0.7152 0.0722]</pre>
dino@13 1549 </object>
dino@13 1550 </p>
edahlstr@0 1551 Thus, the upper left term of the hue matrix turns out to be:
dino@13 1552 <p>
dino@13 1553 <object data="mathml/feColorMatrix04.mml" type="application/mathml+xml" width="100%" height="30">
dino@36 1554 <pre>.2127 + cos(hueRotate value) * 0.7873 - sin(hueRotate value) * 0.2127</pre>
dino@13 1555 </object>
dino@13 1556 </p>
edahlstr@0 1557
edahlstr@0 1558 </li>
edahlstr@0 1559 <li>For <span class="attr-value">type="luminanceToAlpha"</span>,
edahlstr@0 1560 <span class="attr-name">values</span> is not applicable. A <span
edahlstr@0 1561 class="attr-value">luminanceToAlpha</span> operation is equivalent
edahlstr@0 1562 to the following matrix operation:
dino@13 1563 <p>
dino@13 1564 <object data="mathml/feColorMatrix05.mml" type="application/mathml+xml" width="100%" height="130">
edahlstr@0 1565 <pre> | R' | | 0 0 0 0 0 | | R |
edahlstr@0 1566 | G' | | 0 0 0 0 0 | | G |
edahlstr@0 1567 | B' | = | 0 0 0 0 0 | * | B |
dino@36 1568 | A' | | 0.2127 0.7152 0.0722 0 0 | | A |
edahlstr@0 1569 | 1 | | 0 0 0 0 1 | | 1 |</pre>
edahlstr@0 1570 </object>
edahlstr@0 1571 </p>
dino@13 1572 </li>
edahlstr@0 1573 </ul>
edahlstr@0 1574 If the attribute is not specified, then the default behavior depends on
edahlstr@0 1575 the value of attribute <a>'feColorMatrix/type'</a>. If <span
edahlstr@0 1576 class="attr-value">type="matrix"</span>, then this attribute defaults
edahlstr@0 1577 to the identity matrix. If <span
edahlstr@0 1578 class="attr-value">type="saturate"</span>, then this attribute defaults
edahlstr@0 1579 to the value <span class="attr-value">1</span>, which results in the
ed@18 1580 identity matrix. If <span class="attr-value">type="hueRotate"</span>,
edahlstr@0 1581 then this attribute defaults to the value <span
ed@18 1582 class="attr-value">0</span>, which results in the identity matrix.<br />
edahlstr@0 1583 <span class="anim-target">Animatable: yes.</span> </dd>
edahlstr@0 1584 </dl>
edahlstr@0 1585 </div>
edahlstr@0 1586
edahlstr@0 1587 <edit:example href="examples/feColorMatrix.svg" image="yes" link="yes"/>
edahlstr@0 1588
edahlstr@0 1589 <h2 id="feComponentTransferElement">Filter primitive <span class="element-name">'feComponentTransfer'</span></h2>
edahlstr@0 1590
edahlstr@0 1591 <edit:elementsummary name='feComponentTransfer'/>
edahlstr@0 1592
edahlstr@0 1593 <p>This filter primitive performs component-wise remapping of data as
edahlstr@0 1594 follows:</p>
edahlstr@0 1595 <pre>R' = <a href="#feFuncRElement">feFuncR</a>( R )
edahlstr@0 1596 G' = <a href="#feFuncGElement">feFuncG</a>( G )
edahlstr@0 1597 B' = <a href="#feFuncBElement">feFuncB</a>( B )
edahlstr@0 1598 A' = <a href="#feFuncAElement">feFuncA</a>( A )</pre>
edahlstr@0 1599
edahlstr@0 1600 <p>for every pixel. It allows operations like brightness adjustment, contrast
edahlstr@0 1601 adjustment, color balance or thresholding.</p>
edahlstr@0 1602
edahlstr@0 1603 <p>The calculations are performed on non-premultiplied color values. If the
edahlstr@0 1604 input graphics consists of premultiplied color values, those values are
edahlstr@0 1605 automatically converted into non-premultiplied color values for this
edahlstr@0 1606 operation. (Note that the undoing and redoing of the premultiplication can be
edahlstr@0 1607 avoided if <a>'feFuncA'</a> is the identity transform
edahlstr@0 1608 and all alpha values on the source graphic are set to 1.)</p>
edahlstr@0 1609
edahlstr@0 1610 <p>The child elements of a <a>'feComponentTransfer'</a> element specify the
edahlstr@0 1611 transfer functions for the four channels:</p>
edahlstr@0 1612
edahlstr@0 1613 <ul id="transferFuncElements">
edahlstr@0 1614 <li><a>'feFuncR'</a> — transfer function for the red component of the input graphic</li>
edahlstr@0 1615 <li><a>'feFuncG'</a> — transfer function for the green component of the input graphic</li>
edahlstr@0 1616 <li><a>'feFuncB'</a> — transfer function for the blue component of the input graphic</li>
edahlstr@0 1617 <li><a>'feFuncA'</a> — transfer function for the alpha component of the input graphic</li>
edahlstr@0 1618 </ul>
edahlstr@0 1619
edahlstr@0 1620 <p>The following rules apply to the processing of the <a>'feComponentTransfer'</a> element:</p>
edahlstr@0 1621 <ul>
dino@13 1622 <li>If more than one <a>transfer function element</a> of the same kind is specified, the last occurrence is to be used.</li>
dino@13 1623 <li>If any of the <a>transfer function elements</a> are unspecified, the <a>'feComponentTransfer'</a> must be processed as if those <a>transfer function elements</a> were specified with their <a>'type'</a> attributes set to <span class="attr-value">'identity'</span>.</li>
edahlstr@0 1624 </ul>
dino@13 1625
edahlstr@0 1626 <edit:with element='feFuncR'>
edahlstr@0 1627
edahlstr@0 1628 <div id='feFuncRElement'>
edahlstr@0 1629 <edit:elementsummary name='feFuncR'/>
edahlstr@0 1630 </div>
edahlstr@0 1631
edahlstr@0 1632 <div id='feFuncGElement'>
edahlstr@0 1633 <edit:elementsummary name='feFuncG'/>
edahlstr@0 1634 </div>
edahlstr@0 1635
edahlstr@0 1636 <div id='feFuncBElement'>
edahlstr@0 1637 <edit:elementsummary name='feFuncB'/>
edahlstr@0 1638 </div>
edahlstr@0 1639
edahlstr@0 1640 <div id='feFuncAElement'>
edahlstr@0 1641 <edit:elementsummary name='feFuncA'/>
edahlstr@0 1642 </div>
edahlstr@0 1643
edahlstr@0 1644 <p id="TransferFunctionElementAttributes">The attributes below are the
edahlstr@0 1645 <span class='SVG-TermDefine'>transfer function element attributes</span>,
edahlstr@0 1646 which apply to the <a>transfer function elements</a>.</p>
edahlstr@0 1647
edahlstr@0 1648 <div class="adef-list">
edahlstr@0 1649 <p><em>Attribute definitions:</em></p>
edahlstr@0 1650 <dl>
edahlstr@0 1651 <dt id="feComponentTransferTypeAttribute"><span class="adef">type</span>
edahlstr@0 1652 = "<em>identity | table | discrete | linear | gamma</em>"</dt>
edahlstr@0 1653 <dd><p>Indicates the type of component transfer function. The type of
edahlstr@0 1654 function determines the applicability of the other attributes.</p>
ed@24 1655 <p>In the following, C is the initial component (e.g.,
ed@24 1656 <a>'feFuncR'</a>), C' is the remapped component; both
ed@24 1657 in the closed interval [0,1].</p>
edahlstr@0 1658 <ul>
edahlstr@0 1659 <li>For <span class="attr-value">identity</span>:
edahlstr@0 1660 <pre>C' = C</pre>
edahlstr@0 1661 </li>
edahlstr@0 1662 <li>For <span class="attr-value">table</span>, the function is
ed@24 1663 defined by linear interpolation
ed@24 1664 between values given in the attribute
ed@24 1665 <a>'tableValues'</a>. The table has <em>n+1</em>
ed@24 1666 values (i.e., v<sub>0</sub> to v<sub>n</sub>)
ed@24 1667 specifying the start and end values for <em>n</em>
ed@24 1668 evenly sized interpolation regions. Interpolations
ed@24 1669 use the following formula:
ed@24 1670
ed@24 1671 <p>For a value <code>C &lt; 1</code> find <code>k</code> such that:</p>
ed@24 1672 <p class="filterformula">k/n &lt;= C &lt; (k+1)/n</p>
ed@24 1673
ed@24 1674 <p>The result <code>C'</code> is given by:</p>
ed@24 1675 <p class="filterformula">C' = v<sub>k</sub> + (C - k/n)*n * (v<sub>k+1</sub> - v<sub>k</sub>)</p>
ed@24 1676
ed@24 1677 <p>If <code>C = 1</code> then:</p>
ed@24 1678 <p class="filterformula">C' = v<sub>n</sub>.</p>
ed@24 1679 </li>
ed@24 1680 <li>For <span class="attr-value">discrete</span>, the function is defined by the step function
ed@24 1681 given in the attribute <a>'tableValues'</a>, which provides a list of
ed@24 1682 <em>n</em> values (i.e., v<sub>0</sub> to v<sub>n-1</sub>) in order
ed@24 1683 to identify a step function consisting of <em>n</em> steps. The
ed@24 1684 step function is defined by the following formula:
ed@24 1685
ed@24 1686 <p>For a value <code>C &lt; 1</code> find <code>k</code> such that:</p>
ed@24 1687 <p class="filterformula">k/n &lt;= C &lt; (k+1)/n</p>
ed@24 1688
edahlstr@0 1689 <p>For a value <code>C</code> pick a <code>k</code> such that:</p>
edahlstr@0 1690 <p class="filterformula">k/N &lt;= C &lt; (k+1)/N</p>
ed@24 1691
edahlstr@0 1692 <p>The result <code>C'</code> is given by:</p>
edahlstr@0 1693 <p class="filterformula">C' = v<sub>k</sub></p>
ed@24 1694 <p>If <code>C = 1</code> then:</p>
ed@24 1695 <p class="filterformula">C' = v<sub>n-1</sub>.</p>
edahlstr@0 1696 </li>
edahlstr@0 1697 <li>For <span class="attr-value">linear</span>, the function is
edahlstr@0 1698 defined by the following linear equation:
edahlstr@0 1699 <p class="filterformula">C' = <a
edahlstr@0 1700 href="#feComponentTransferSlopeAttribute"><span
edahlstr@0 1701 class="attr-name">slope</span></a> * C + <a
edahlstr@0 1702 href="#feComponentTransferInterceptAttribute"><span
edahlstr@0 1703 class="attr-name">intercept</span></a></p>
edahlstr@0 1704 </li>
edahlstr@0 1705 <li>For <span class="attr-value">gamma</span>, the function is
edahlstr@0 1706 defined by the following exponential function:
edahlstr@0 1707 <p class="filterformula">C' = <a
edahlstr@0 1708 href="#feComponentTransferAmplitudeAttribute"><span
edahlstr@0 1709 class="attr-name">amplitude</span></a> * pow(C, <a
edahlstr@0 1710 href="#feComponentTransferExponentAttribute"><span
edahlstr@0 1711 class="attr-name">exponent</span></a>) + <a
edahlstr@0 1712 href="#feComponentTransferOffsetAttribute"><span
edahlstr@0 1713 class="attr-name">offset</span></a></p>
edahlstr@0 1714 </li>
edahlstr@0 1715 </ul>
edahlstr@0 1716 <span class="anim-target">Animatable: yes.</span> </dd>
edahlstr@0 1717 <dt id="feComponentTransferTableValuesAttribute"><span
edahlstr@0 1718 class="adef">tableValues</span> = "<em>(list of <a>&lt;number&gt;</a>s)</em>"</dt>
edahlstr@0 1719 <dd>When <span class="attr-value">type="table"</span>, the list of
edahlstr@0 1720 <a>&lt;number&gt;</a>
edahlstr@0 1721 s <em>v0,v1,...vn</em>, separated by white space and/or a comma, which
edahlstr@0 1722 define the lookup table. An empty list results in an identity transfer
edahlstr@0 1723 function. If the attribute is not specified, then the effect is as if
edahlstr@0 1724 an empty list were provided.<br />
edahlstr@0 1725 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1726 <dt id="feComponentTransferSlopeAttribute"><span
edahlstr@0 1727 class="adef">slope</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1728 <dd>When <span class="attr-value">type="linear"</span>, the slope of the
edahlstr@0 1729 linear function.<br />
ed@17 1730 The <a>lacuna value</a> for <a>'slope'</a> is <span class="attr-value">1</span>.<br />
edahlstr@0 1731 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1732 <dt id="feComponentTransferInterceptAttribute"><span
edahlstr@0 1733 class="adef">intercept</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1734 <dd>When <span class="attr-value">type="linear"</span>, the intercept of
edahlstr@0 1735 the linear function.<br />
ed@17 1736 The <a>lacuna value</a> for <a>'intercept'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1737 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1738 <dt id="feComponentTransferAmplitudeAttribute"><span
edahlstr@0 1739 class="adef">amplitude</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1740 <dd>When <span class="attr-value">type="gamma"</span>, the amplitude of
edahlstr@0 1741 the gamma function.<br />
ed@17 1742 The <a>lacuna value</a> for <a>'amplitude'</a> is <span class="attr-value">1</span>.<br />
edahlstr@0 1743 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1744 <dt id="feComponentTransferExponentAttribute"><span
edahlstr@0 1745 class="adef">exponent</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1746 <dd>When <span class="attr-value">type="gamma"</span>, the exponent of
edahlstr@0 1747 the gamma function.<br />
ed@17 1748 The <a>lacuna value</a> for <a>'exponent'</a> is <span class="attr-value">1</span>.<br />
edahlstr@0 1749 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1750 <dt id="feComponentTransferOffsetAttribute"><span
edahlstr@0 1751 class="adef">offset</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1752 <dd>When <span class="attr-value">type="gamma"</span>, the offset of the
edahlstr@0 1753 gamma function.<br />
ed@17 1754 The <a>lacuna value</a> for <a>'offset'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1755 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1756 </dl>
edahlstr@0 1757 </div>
edahlstr@0 1758 </edit:with>
edahlstr@0 1759
edahlstr@0 1760 <edit:example href="examples/feComponentTransfer.svg" image="yes" link="yes"/>
edahlstr@0 1761
edahlstr@0 1762 <h2 id="feCompositeElement">Filter primitive <span class="element-name">'feComposite'</span></h2>
edahlstr@0 1763
edahlstr@0 1764 <edit:elementsummary name='feComposite'/>
ed@17 1765 <edit:with element='feComposite'>
edahlstr@0 1766
edahlstr@0 1767 <p>This filter performs the combination of the two input images pixel-wise in
edahlstr@0 1768 image space using one of the Porter-Duff [<a
edahlstr@0 1769 href="#ref-PORTERDUFF">PORTERDUFF</a>] compositing operations: <em>over, in,
ed@27 1770 atop, out, xor</em> [<a href="#ref-SVG-COMPOSITING">SVG-COMPOSITING</a>]. Additionally, a component-wise <em>arithmetic</em>
edahlstr@0 1771 operation (with the result clamped between [0..1]) can be applied.</p>
edahlstr@0 1772
edahlstr@0 1773 <p>The <em>arithmetic</em> operation is useful for combining the output from
edahlstr@0 1774 the <a>'feDiffuseLighting'</a> and <a>'feSpecularLighting'</a> filters with texture
edahlstr@0 1775 data. It is also useful for implementing <em>dissolve</em>. If the
edahlstr@0 1776 <em>arithmetic</em> operation is chosen, each result pixel is computed using
edahlstr@0 1777 the following formula:</p>
edahlstr@0 1778 <pre>result = k1*i1*i2 + k2*i1 + k3*i2 + k4</pre>
ed@27 1779 where:
ed@27 1780 <ul>
ed@27 1781 <li>
ed@27 1782 <code>i1</code> and <code>i2</code> indicate the corresponding pixel channel values of the input image, which map to <a>'in'</a> and <a>'in2'</a> respectively
ed@27 1783 </li>
ed@27 1784 <li>
ed@27 1785 <code>k1, k2, k3</code> and <code>k4</code> indicate the values of the attributes with the same name
ed@27 1786 </li>
ed@27 1787 </ul>
edahlstr@0 1788
edahlstr@0 1789 <p>For this filter primitive, the extent of the resulting image might grow as
ed@17 1790 described in the section that describes the <a>filter primitive subregion</a>.</p>
edahlstr@0 1791
edahlstr@0 1792 <div class="adef-list">
edahlstr@0 1793 <p><em>Attribute definitions:</em></p>
edahlstr@0 1794 <dl>
edahlstr@0 1795 <dt id="feCompositeOperatorAttribute"><span class="adef">operator</span>
edahlstr@0 1796 = "<em>over | in | out | atop | xor | arithmetic</em>"</dt>
edahlstr@0 1797 <dd>The compositing operation that is to be performed. All of the <span
edahlstr@0 1798 class="attr-name">operator</span> types except <span
ed@29 1799 class="attr-value">arithmetic</span> match the corresponding operation as
edahlstr@0 1800 described in [<a href="#ref-PORTERDUFF">PORTERDUFF</a>]. The <span
ed@17 1801 class="attr-value">arithmetic</span> operator is described above.
ed@17 1802 The <a>lacuna value</a> for <a>'operator'</a> is <span class="attr-value">over</span>.
ed@17 1803 <br />
edahlstr@0 1804 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1805 <dt id="feCompositeK1Attribute"><span
edahlstr@0 1806 class="adef">k1</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1807 <dd>Only applicable if <span
edahlstr@0 1808 class="attr-value">operator="arithmetic"</span>.<br />
ed@17 1809 The <a>lacuna value</a> for <a>'k1'</a> is <span class="attr-value">0</span>. <br />
edahlstr@0 1810 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1811 <dt id="feCompositeK2Attribute"><span
edahlstr@0 1812 class="adef">k2</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1813 <dd>Only applicable if <span
edahlstr@0 1814 class="attr-value">operator="arithmetic"</span>.<br />
ed@17 1815 The <a>lacuna value</a> for <a>'k2'</a> is <span class="attr-value">0</span>. <br />
edahlstr@0 1816 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1817 <dt id="feCompositeK3Attribute"><span
edahlstr@0 1818 class="adef">k3</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1819 <dd>Only applicable if <span
edahlstr@0 1820 class="attr-value">operator="arithmetic"</span>.<br />
ed@17 1821 The <a>lacuna value</a> for <a>'k3'</a> is <span class="attr-value">0</span>. <br />
edahlstr@0 1822 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1823 <dt id="feCompositeK4Attribute"><span
edahlstr@0 1824 class="adef">k4</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 1825 <dd>Only applicable if <span
edahlstr@0 1826 class="attr-value">operator="arithmetic"</span>.<br />
ed@17 1827 The <a>lacuna value</a> for <a>'k4'</a> is <span class="attr-value">0</span>. <br />
edahlstr@0 1828 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1829 <dt id="feCompositeIn2Attribute">
edahlstr@0 1830 <span class="adef">in2</span> = "<em>(see <a
edahlstr@0 1831 href="#FilterPrimitiveInAttribute"><span class="attr-name">in</span></a>
edahlstr@0 1832 attribute)</em>"</dt>
edahlstr@0 1833 <dd>The second input image to the compositing operation. This attribute
edahlstr@0 1834 can take on the same values as the <a
edahlstr@0 1835 href="#FilterPrimitiveInAttribute"><span
edahlstr@0 1836 class="attr-name">in</span></a> attribute.<br />
edahlstr@0 1837 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1838 </dl>
edahlstr@0 1839 </div>
ed@17 1840 </edit:with>
edahlstr@0 1841
edahlstr@0 1842 <edit:example href="examples/feComposite.svg" image="yes" link="yes"/>
edahlstr@0 1843
edahlstr@0 1844 <h2 id="feConvolveMatrixElement">Filter primitive <span class="element-name">'feConvolveMatrix'</span></h2>
edahlstr@0 1845
edahlstr@0 1846 <edit:elementsummary name='feConvolveMatrix'/>
edahlstr@0 1847 <edit:with element='feConvolveMatrix'>
edahlstr@0 1848
edahlstr@0 1849 <p>feConvolveMatrix applies a matrix convolution filter effect. A convolution
edahlstr@0 1850 combines pixels in the input image with neighboring pixels to produce a
edahlstr@0 1851 resulting image. A wide variety of imaging operations can be achieved through
edahlstr@0 1852 convolutions, including blurring, edge detection, sharpening, embossing and
edahlstr@0 1853 beveling.</p>
edahlstr@0 1854
edahlstr@0 1855 <p>A matrix convolution is based on an n-by-m matrix (the convolution kernel)
edahlstr@0 1856 which describes how a given pixel value in the input image is combined with
edahlstr@0 1857 its neighboring pixel values to produce a resulting pixel value. Each result
edahlstr@0 1858 pixel is determined by applying the kernel matrix to the corresponding source
edahlstr@0 1859 pixel and its neighboring pixels. The basic convolution formula which is
edahlstr@0 1860 applied to each color value for a given pixel is:</p>
edahlstr@0 1861
ed@27 1862 <p class="filterformula" id="feConvolveMatrixElementFormula">COLOR<sub>X,Y</sub> = ( <br />
edahlstr@0 1863               SUM <sub>I=0 to [<a
edahlstr@0 1864 href="#feConvolveMatrixElementOrderAttribute">'orderY'</a>-1]</sub> { <br />
edahlstr@0 1865                 SUM <sub>J=0 to [<a
edahlstr@0 1866 href="#feConvolveMatrixElementOrderAttribute">'orderX'</a>-1]</sub> { <br />
edahlstr@0 1867                   SOURCE <sub>X-<a>'targetX'</a>+J, Y-<a>'targetY'</a>+I</sub> *  <a>'kernelMatrix'</a><sub><a
edahlstr@0 1868 href="#feConvolveMatrixElementOrderAttribute">'orderX'</a>-J-1,  <a
edahlstr@0 1869 href="#feConvolveMatrixElementOrderAttribute">'orderY'</a>-I-1</sub> <br />
edahlstr@0 1870                 } <br />
edahlstr@0 1871               } <br />
ed@27 1872             ) /  <a>'divisor'</a> +  <a>'bias'</a>&nbsp;*&nbsp;ALPHA<sub>X,Y</sub><br />
edahlstr@0 1873 </p>
edahlstr@0 1874
edahlstr@0 1875 <div class="note-editor">
edahlstr@0 1876 ED: Consider making this into mathml</div>
edahlstr@0 1877
edahlstr@0 1878 <p>where "orderX" and "orderY" represent the X and Y values for the <a>'order'</a> attribute, "targetX" represents the value
edahlstr@0 1879 of the <a>'targetX'</a> attribute, "targetY" represents the
edahlstr@0 1880 value of the <a>'targetY'</a> attribute, "kernelMatrix" represents the
edahlstr@0 1881 value of the <a>'kernelMatrix'</a> attribute, "divisor" represents the
edahlstr@0 1882 value of the <a>'divisor'</a> attribute, and "bias" represents the
edahlstr@0 1883 value of the <a>'bias'</a> attribute.</p>
edahlstr@0 1884
edahlstr@0 1885 <p>Note in the above formulas that the values in the kernel matrix are
edahlstr@0 1886 applied such that the kernel matrix is rotated 180 degrees relative to the
edahlstr@0 1887 source and destination images in order to match convolution theory as
edahlstr@0 1888 described in many computer graphics textbooks.</p>
edahlstr@0 1889
edahlstr@0 1890 <p>To illustrate, suppose you have a input image which is 5 pixels by 5
edahlstr@0 1891 pixels, whose color values for one of the color channels are as follows:</p>
edahlstr@0 1892 <pre> 0 20 40 235 235
edahlstr@0 1893 100 120 140 235 235
edahlstr@0 1894 200 220 240 235 235
edahlstr@0 1895 225 225 255 255 255
edahlstr@0 1896 225 225 255 255 255</pre>
edahlstr@0 1897
edahlstr@0 1898 <div class="note-editor">
edahlstr@0 1899 ED: Consider making this into mathml</div>
edahlstr@0 1900
edahlstr@0 1901 <p>and you define a 3-by-3 convolution kernel as follows:</p>
edahlstr@0 1902 <pre> 1 2 3
edahlstr@0 1903 4 5 6
edahlstr@0 1904 7 8 9</pre>
edahlstr@0 1905
edahlstr@0 1906 <div class="note-editor">
edahlstr@0 1907 ED: Consider making this into mathml</div>
edahlstr@0 1908
edahlstr@0 1909 <p>Let's focus on the color value at the second row and second column of the
edahlstr@0 1910 image (source pixel value is 120). Assuming the simplest case (where the
edahlstr@0 1911 input image's pixel grid aligns perfectly with the kernel's pixel grid) and
edahlstr@0 1912 assuming default values for attributes <a>'divisor'</a>, <a>'targetX'</a> and
edahlstr@0 1913 <a>'targetY'</a>, then resulting color value will
edahlstr@0 1914 be:</p>
edahlstr@0 1915 <pre>(9* 0 + 8* 20 + 7* 40 +
edahlstr@0 1916 6*100 + 5*120 + 4*140 +
edahlstr@0 1917 3*200 + 2*220 + 1*240) / (9+8+7+6+5+4+3+2+1)</pre>
edahlstr@0 1918
edahlstr@0 1919 <div class="note-editor">
edahlstr@0 1920 ED: Consider making this into mathml</div>
edahlstr@0 1921
edahlstr@0 1922 <p>Because they operate on pixels, matrix convolutions are inherently
edahlstr@0 1923 resolution-dependent. To make <a>'feConvolveMatrix'</a> produce resolution-independent
edahlstr@0 1924 results, an explicit value should be provided for either the <a>'filter/filterRes'</a> attribute on the <a>'filter element'</a> element
edahlstr@0 1925 and/or attribute <a>'kernelUnitLength'</a>.</p>
edahlstr@0 1926
edahlstr@0 1927 <p><a>'kernelUnitLength'</a>, in combination with the other
edahlstr@0 1928 attributes, defines an implicit pixel grid in the filter effects coordinate
edahlstr@0 1929 system (i.e., the coordinate system established by the <a>'filter/primitiveUnits'</a> attribute). If the pixel grid
edahlstr@0 1930 established by <a>'kernelUnitLength'</a> is not scaled to match the
edahlstr@0 1931 pixel grid established by attribute <a>'filter/filterRes'</a> (implicitly or explicitly), then the
edahlstr@0 1932 input image will be temporarily rescaled to match its pixels with <a>'kernelUnitLength'</a>. The convolution happens on the
edahlstr@0 1933 resampled image. After applying the convolution, the image is resampled back
edahlstr@0 1934 to the original resolution.</p>
edahlstr@0 1935
edahlstr@0 1936 <p>When the image must be resampled to match the coordinate system defined by
edahlstr@0 1937 <a>'kernelUnitLength'</a> prior to convolution, or
edahlstr@0 1938 resampled to match the device coordinate system after convolution, it is
edahlstr@0 1939 recommended that high quality viewers make use of appropriate interpolation
edahlstr@0 1940 techniques, for example bilinear or bicubic. Depending on the speed of the
edahlstr@0 1941 available interpolents, this choice may be affected by the <a>'image-rendering'</a> property setting. Note that
edahlstr@0 1942 implementations might choose approaches that minimize or eliminate resampling
edahlstr@0 1943 when not necessary to produce proper results, such as when the document is
edahlstr@0 1944 zoomed out such that <a>'kernelUnitLength'</a> is
edahlstr@0 1945 considerably smaller than a device pixel.</p>
edahlstr@0 1946
edahlstr@0 1947 <div class="adef-list">
edahlstr@0 1948 <p><em>Attribute definitions:</em></p>
edahlstr@0 1949 <dl>
edahlstr@0 1950 <dt id="feConvolveMatrixElementOrderAttribute"><span
edahlstr@0 1951 class="adef">order</span> = "<span
edahlstr@0 1952 class="attr-value"><a>&lt;number-optional-number&gt;</a></span>"</dt>
edahlstr@0 1953 <dd>Indicates the number of cells in each dimension for <a>'kernelMatrix'</a>. The values provided must be
edahlstr@0 1954 <a>&lt;integer&gt;</a>
edahlstr@0 1955 s greater than zero. The first number, &lt;orderX&gt;, indicates the
edahlstr@0 1956 number of columns in the matrix. The second number, &lt;orderY&gt;,
edahlstr@0 1957 indicates the number of rows in the matrix. If &lt;orderY&gt; is not
edahlstr@0 1958 provided, it defaults to &lt;orderX&gt;.<br />
edahlstr@0 1959 A typical value is order="3". It is recommended that only small values
edahlstr@0 1960 (e.g., 3) be used; higher values may result in very high CPU overhead
edahlstr@0 1961 and usually do not produce results that justify the impact on
edahlstr@0 1962 performance.<br />
edahlstr@0 1963 If the attribute is not specified, the effect is as if a value of "3"
edahlstr@0 1964 were specified.<br />
edahlstr@0 1965 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1966 <dt id="feConvolveMatrixElementKernelMatrixAttribute"><span
edahlstr@0 1967 class="adef">kernelMatrix</span> = "<span class="attr-value">&lt;list of
edahlstr@0 1968 numbers&gt;</span>"</dt>
edahlstr@0 1969 <dd>The list of <a>&lt;number&gt;</a>
edahlstr@0 1970 s that make up the kernel matrix for the convolution. Values are
edahlstr@0 1971 separated by space characters and/or a comma. The number of entries in
edahlstr@0 1972 the list must equal &lt;orderX&gt; times &lt;orderY&gt;.<br />
edahlstr@0 1973 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1974 <dt id="feConvolveMatrixElementDivisorAttribute"><span
edahlstr@0 1975 class="adef">divisor</span> = "<span
edahlstr@0 1976 class="attr-value"><a>&lt;number&gt;</a></span>"</dt>
edahlstr@0 1977 <dd>After applying the <span class="attr-name">kernelMatrix</span> to the
edahlstr@0 1978 input image to yield a number, that number is divided by <a>'divisor'</a> to yield the final destination color
edahlstr@0 1979 value. A divisor that is the sum of all the matrix values tends to have
edahlstr@0 1980 an evening effect on the overall color intensity of the result. If the
edahlstr@0 1981 specified divisor is zero then the default value will be used instead.
edahlstr@0 1982 The default value is the sum of all values in kernelMatrix, with the
edahlstr@0 1983 exception that if the sum is zero, then the divisor is set to 1.<br />
edahlstr@0 1984 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1985 <dt id="feConvolveMatrixElementBiasAttribute"><span
edahlstr@0 1986 class="adef">bias</span> = "<span
edahlstr@0 1987 class="attr-value"><a>&lt;number&gt;</a></span>"</dt>
edahlstr@0 1988 <dd>After applying the <span class="attr-name">kernelMatrix</span> to the
edahlstr@0 1989 input image to yield a number and applying the <a>'divisor'</a>, the <a>'bias'</a> attribute is added to each component. One
edahlstr@0 1990 application of <a>'bias'</a> is when it is
ed@27 1991 desirable to have <span class="attr-value">.5</span> gray value be the zero response of the filter.
ed@28 1992 The bias property shifts the range of the filter. This allows representation of values that would
ed@28 1993 otherwise be clamped to 0 or 1.<br />
ed@27 1994 The <a>lacuna value</a> for <a>'bias'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 1995 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 1996 <dt id="feConvolveMatrixElementTargetXAttribute"><span
edahlstr@0 1997 class="adef">targetX</span> = "<span
edahlstr@0 1998 class="attr-value"><a>&lt;integer&gt;</a></span>"</dt>
edahlstr@0 1999 <dd>Determines the positioning in X of the convolution matrix relative to
edahlstr@0 2000 a given target pixel in the input image. The leftmost column of the
edahlstr@0 2001 matrix is column number zero. The value must be such that: 0 &lt;=
edahlstr@0 2002 targetX &lt; orderX. By default, the convolution matrix is centered in
edahlstr@0 2003 X over each pixel of the input image (i.e., targetX = floor ( orderX /
edahlstr@0 2004 2 )).<br />
edahlstr@0 2005 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2006 <dt id="feConvolveMatrixElementTargetYAttribute"><span
edahlstr@0 2007 class="adef">targetY</span> = "<span
edahlstr@0 2008 class="attr-value"><a>&lt;integer&gt;</a></span>"</dt>
edahlstr@0 2009 <dd>Determines the positioning in Y of the convolution matrix relative to
edahlstr@0 2010 a given target pixel in the input image. The topmost row of the matrix
edahlstr@0 2011 is row number zero. The value must be such that: 0 &lt;= targetY &lt;
edahlstr@0 2012 orderY. By default, the convolution matrix is centered in Y over each
edahlstr@0 2013 pixel of the input image (i.e., targetY = floor ( orderY / 2 )).<br />
edahlstr@0 2014 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2015 <dt id="feConvolveMatrixElementEdgeModeAttribute"><span
edahlstr@0 2016 class="adef">edgeMode</span> = "<span class="attr-value">duplicate | wrap |
edahlstr@0 2017 none</span>"</dt>
edahlstr@0 2018 <dd><p>Determines how to extend the input image as necessary with color
edahlstr@0 2019 values so that the matrix operations can be applied when the kernel is
edahlstr@0 2020 positioned at or near the edge of the input image.</p>
edahlstr@0 2021 <p>"duplicate" indicates that the input image is extended along each of
edahlstr@0 2022 its borders as necessary by duplicating the color values at the given
edahlstr@0 2023 edge of the input image.</p>
edahlstr@0 2024 <pre>Original N-by-M image, where m=M-1 and n=N-1:
edahlstr@0 2025 11 12 ... 1m 1M
edahlstr@0 2026 21 22 ... 2m 2M
edahlstr@0 2027 .. .. ... .. ..
edahlstr@0 2028 n1 n2 ... nm nM
edahlstr@0 2029 N1 N2 ... Nm NM
edahlstr@0 2030 Extended by two pixels using "duplicate":
edahlstr@0 2031 11 11 11 12 ... 1m 1M 1M 1M
edahlstr@0 2032 11 11 11 12 ... 1m 1M 1M 1M
edahlstr@0 2033 11 11 11 12 ... 1m 1M 1M 1M
edahlstr@0 2034 21 21 21 22 ... 2m 2M 2M 2M
edahlstr@0 2035 .. .. .. .. ... .. .. .. ..
edahlstr@0 2036 n1 n1 n1 n2 ... nm nM nM nM
edahlstr@0 2037 N1 N1 N1 N2 ... Nm NM NM NM
edahlstr@0 2038 N1 N1 N1 N2 ... Nm NM NM NM
edahlstr@0 2039 N1 N1 N1 N2 ... Nm NM NM NM</pre>
edahlstr@0 2040
edahlstr@0 2041 <div class="note-editor">
edahlstr@0 2042 ED: Consider making this into mathml</div>
edahlstr@0 2043 <p>"wrap" indicates that the input image is extended by taking the
edahlstr@0 2044 color values from the opposite edge of the image.</p>
edahlstr@0 2045 <pre>Extended by two pixels using "wrap":
edahlstr@0 2046 nm nM n1 n2 ... nm nM n1 n2
edahlstr@0 2047 Nm NM N1 N2 ... Nm NM N1 N2
edahlstr@0 2048 1m 1M 11 12 ... 1m 1M 11 12
edahlstr@0 2049 2m 2M 21 22 ... 2m 2M 21 22
edahlstr@0 2050 .. .. .. .. ... .. .. .. ..
edahlstr@0 2051 nm nM n1 n2 ... nm nM n1 n2
edahlstr@0 2052 Nm NM N1 N2 ... Nm NM N1 N2
edahlstr@0 2053 1m 1M 11 12 ... 1m 1M 11 12
edahlstr@0 2054 2m 2M 21 22 ... 2m 2M 21 22</pre>
edahlstr@0 2055
edahlstr@0 2056 <div class="note-editor">
edahlstr@0 2057 ED: Consider making this into mathml</div>
ed@17 2058 <p>The value <span class="attr-value">none</span> indicates that the input image is extended with pixel values
edahlstr@0 2059 of zero for R, G, B and A.</p>
ed@17 2060 <p>The <a>lacuna value</a> for <a>'edgeMode'</a> is <span class="attr-value">duplicate</span>.</p>
edahlstr@0 2061 <p><span class="anim-target">Animatable: yes.</span></p>
edahlstr@0 2062 </dd>
edahlstr@0 2063 <dt id="feConvolveMatrixElementKernelUnitLengthAttribute"><span
edahlstr@0 2064 class="adef">kernelUnitLength</span> = "<span
edahlstr@0 2065 class="attr-value"><a>&lt;number-optional-number&gt;</a></span>"</dt>
edahlstr@0 2066 <dd>The first number is the &lt;dx&gt; value. The second number is the
edahlstr@0 2067 &lt;dy&gt; value. If the &lt;dy&gt; value is not specified, it defaults
edahlstr@0 2068 to the same value as &lt;dx&gt;. Indicates the intended distance in
edahlstr@0 2069 current filter units (i.e., units as determined by the value of
edahlstr@0 2070 attribute <a>'filter/primitiveUnits'</a>) between successive columns
edahlstr@0 2071 and rows, respectively, in the <a>'kernelMatrix'</a>. By specifying value(s) for
edahlstr@0 2072 <a>'kernelUnitLength'</a>, the kernel becomes defined
edahlstr@0 2073 in a scalable, abstract coordinate system. If <a>'kernelUnitLength'</a> is not specified, the default
edahlstr@0 2074 value is one pixel in the offscreen bitmap, which is a pixel-based
edahlstr@0 2075 coordinate system, and thus potentially not scalable. For some level of
edahlstr@0 2076 consistency across display media and user agents, it is necessary that
edahlstr@0 2077 a value be provided for at least one of <a>'filter/filterRes'</a> and <a>'kernelUnitLength'</a>.
edahlstr@0 2078 In some implementations, the most consistent results and the fastest performance will be achieved if
edahlstr@0 2079 the pixel grid of the temporary offscreen images aligns with the pixel
edahlstr@0 2080 grid of the kernel.<br />
edahlstr@0 2081 If a negative or zero value is specified the default value will be used
edahlstr@0 2082 instead. <br />
edahlstr@0 2083 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2084 <dt id="feConvolveMatrixElementPreserveAlphaAttribute"><span
edahlstr@0 2085 class="adef">preserveAlpha</span> = "<span class="attr-value">false |
edahlstr@0 2086 true</span>"</dt>
edahlstr@0 2087 <dd>A value of <span class="attr-value">false</span> indicates that the
ed@27 2088 convolution will apply to all channels, including the alpha channel.
ed@27 2089 In this case the <code>ALPHA<sub>X,Y</sub></code> of the
ed@27 2090 <a href="#feConvolveMatrixElementFormula">convolution formula</a> for a given pixel is:
ed@27 2091 <p class="filterformula">
ed@27 2092 ALPHA<sub>X,Y</sub>&nbsp;=&nbsp;(&nbsp;<br />
ed@27 2093 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SUM
ed@27 2094 <sub>I=0&nbsp;to&nbsp;[<a href="#feConvolveMatrixElementOrderAttribute">'orderY'</a>-1]</sub>&nbsp;{&nbsp;<br />
ed@27 2095 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SUM
ed@27 2096 <sub>J=0&nbsp;to&nbsp;[<a href="#feConvolveMatrixElementOrderAttribute">'orderX'</a>-1]</sub>&nbsp;{&nbsp;<br />
ed@27 2097 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOURCE
ed@27 2098 <sub>X-<a>'targetX'</a>+J,&nbsp;Y-<a>'targetY'</a>+I</sub>&nbsp;*&nbsp;
ed@27 2099 <a>'kernelMatrix'</a><sub><a href="#feConvolveMatrixElementOrderAttribute">'orderX'</a>-J-1,&nbsp;
ed@27 2100 <a href="#feConvolveMatrixElementOrderAttribute">'orderY'</a>-I-1</sub>&nbsp;<br />
ed@27 2101 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br />
ed@27 2102 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br />
ed@27 2103 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;/&nbsp;
ed@27 2104 <a>'divisor'</a>&nbsp;+&nbsp;
ed@27 2105 <a>'bias'</a>&nbsp;
ed@27 2106 <br />
ed@27 2107 </p>
ed@27 2108 <br />
edahlstr@0 2109 A value of <span class="attr-value">true</span> indicates that the
edahlstr@0 2110 convolution will only apply to the color channels. In this case, the
edahlstr@0 2111 filter will temporarily unpremultiply the color component values, apply
ed@27 2112 the kernel, and then re-premultiply at the end.
ed@27 2113 In this case the <code>ALPHA<sub>X,Y</sub></code>
ed@27 2114 of the <a href="#feConvolveMatrixElementFormula">convolution formula</a> for a given pixel is:
ed@27 2115 <p class="filterformula">
ed@27 2116 ALPHA<sub>X,Y</sub>&nbsp;=&nbsp;SOURCE<sub>X,Y</sub>
ed@27 2117 </p>
ed@17 2118 The <a>lacuna value</a> for <a>'preserveAlpha'</a> is <span class="attr-value">false</span>.<br />
edahlstr@0 2119 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2120 </dl>
edahlstr@0 2121 </div>
edahlstr@0 2122
edahlstr@0 2123 </edit:with>
edahlstr@0 2124
edahlstr@0 2125 <h2 id="feDiffuseLightingElement">Filter primitive <span
edahlstr@0 2126 class="element-name">'feDiffuseLighting'</span></h2>
edahlstr@0 2127
edahlstr@0 2128 <edit:elementsummary name='feDiffuseLighting'/>
edahlstr@0 2129
edahlstr@0 2130 <p>This filter primitive lights an image using the alpha channel as a bump
edahlstr@0 2131 map. The resulting image is an RGBA opaque image based on the light color
edahlstr@0 2132 with alpha = 1.0 everywhere. The lighting calculation follows the standard
edahlstr@0 2133 diffuse component of the Phong lighting model. The resulting image depends on
edahlstr@0 2134 the light color, light position and surface geometry of the input bump
edahlstr@0 2135 map.</p>
edahlstr@0 2136
edahlstr@0 2137 <p>The light map produced by this filter primitive can be combined with a
edahlstr@0 2138 texture image using the multiply term of the <em>arithmetic</em> <a>'feComposite'</a> compositing method. Multiple
edahlstr@0 2139 light sources can be simulated by adding several of these light maps together
edahlstr@0 2140 before applying it to the texture image.</p>
edahlstr@0 2141
edahlstr@0 2142 <p>The formulas below make use of 3x3 filters. Because they operate on
edahlstr@0 2143 pixels, such filters are inherently resolution-dependent. To make <a>'feDiffuseLighting'</a> produce
edahlstr@0 2144 resolution-independent results, an explicit value should be provided for
edahlstr@0 2145 either the <a>'filter/filterRes'</a> attribute on the <a>'filter element'</a> element
edahlstr@0 2146 and/or attribute <a>'feDiffuseLighting/kernelUnitLength'</a>.</p>
edahlstr@0 2147
edahlstr@0 2148 <p><a>'feDiffuseLighting/kernelUnitLength'</a>, in combination with the other
edahlstr@0 2149 attributes, defines an implicit pixel grid in the filter effects coordinate
edahlstr@0 2150 system (i.e., the coordinate system established by the <a>'filter/primitiveUnits'</a> attribute). If the pixel grid
edahlstr@0 2151 established by <a>'feDiffuseLighting/kernelUnitLength'</a> is not scaled to match the
edahlstr@0 2152 pixel grid established by attribute <a>'filter/filterRes'</a> (implicitly or explicitly), then the
edahlstr@0 2153 input image will be temporarily rescaled to match its pixels with <a>'feDiffuseLighting/kernelUnitLength'</a>. The 3x3 filters are applied to the resampled image. After applying the filter, the image is resampled back
edahlstr@0 2154 to its original resolution.</p>
edahlstr@0 2155
edahlstr@0 2156 <p><span class="requirement" id="assert_diffuseLightingImageResampling">When the image must be resampled, it is recommended that high quality viewers make use of appropriate interpolation techniques, for example
edahlstr@0 2157 bilinear or bicubic.</span> Depending on the speed of the available interpolents,
edahlstr@0 2158 this choice may be affected by the <a>'image-rendering'</a> property setting. Note that
edahlstr@0 2159 implementations might choose approaches that minimize or eliminate resampling
edahlstr@0 2160 when not necessary to produce proper results, such as when the document is
edahlstr@0 2161 zoomed out such that <a>'feDiffuseLighting/kernelUnitLength'</a> is
edahlstr@0 2162 considerably smaller than a device pixel.</p>
edahlstr@0 2163
edahlstr@0 2164 <p>For the formulas that follow, the
edahlstr@0 2165 <code>Norm(A<sub>x</sub>,A<sub>y</sub>,A<sub>z</sub>)</code> function is
edahlstr@0 2166 defined as:</p>
edahlstr@0 2167
edahlstr@0 2168 <div class="note-editor">
edahlstr@0 2169 ED: Consider making the following in mathml</div>
edahlstr@0 2170
edahlstr@0 2171 <p class="filterformula">Norm(A<sub>x</sub>,A<sub>y</sub>,A<sub>z</sub>) =
edahlstr@0 2172 sqrt(A<sub>x</sub>^2+A<sub>y</sub>^2+A<sub>z</sub>^2)</p>
edahlstr@0 2173
edahlstr@0 2174 <p>The resulting RGBA image is computed as follows:</p>
edahlstr@0 2175
edahlstr@0 2176 <p class="filterformula">D<sub>r</sub> = k<sub>d</sub> * N.L *
edahlstr@0 2177 L<sub>r</sub><br />
edahlstr@0 2178 D<sub>g</sub> = k<sub>d</sub> * N.L * L<sub>g</sub><br />
edahlstr@0 2179 D<sub>b</sub> = k<sub>d</sub> * N.L * L<sub>b</sub><br />
edahlstr@0 2180 D<sub>a</sub> = 1.0</p>
edahlstr@0 2181
edahlstr@0 2182 <p>where</p>
edahlstr@0 2183 <dl>
edahlstr@0 2184 <dd>k<sub>d</sub> = diffuse lighting constant<br />
edahlstr@0 2185 N = surface normal unit vector, a function of x and y<br />
edahlstr@0 2186 L = unit vector pointing from surface to light, a function of x and y
edahlstr@0 2187 in the point and spot light cases<br />
edahlstr@0 2188 L<sub>r</sub>,L<sub>g</sub>,L<sub>b</sub> = RGB components of light, a
edahlstr@0 2189 function of x and y in the spot light case</dd>
edahlstr@0 2190 </dl>
edahlstr@0 2191
edahlstr@0 2192 <p>N is a function of x and y and depends on the surface gradient as
edahlstr@0 2193 follows:</p>
edahlstr@0 2194
ed@16 2195 <p>The surface described by the input alpha image I(x,y) is:</p>
ed@16 2196
ed@16 2197 <p class="filterformula">Z (x,y) = surfaceScale * I(x,y)</p>
edahlstr@0 2198
edahlstr@0 2199 <p id="SurfaceNormalCalculations">Surface normal is calculated using the Sobel gradient 3x3 filter.
edahlstr@0 2200 Different filter kernels are used depending on whether the given pixel is on
edahlstr@0 2201 the interior or an edge. For each case, the formula is:</p>
ed@16 2202 <p class="filterformula">N<sub>x</sub> (x,y) = - surfaceScale *
edahlstr@0 2203 FACTOR<sub>x</sub> *<br />
ed@16 2204 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(K<sub>x</sub>(0,0)*I(x-dx,y-dy)&nbsp;+
ed@16 2205 K<sub>x</sub>(1,0)*I(x,y-dy)&nbsp;+
ed@16 2206 K<sub>x</sub>(2,0)*I(x+dx,y-dy)&nbsp;+<br />
ed@16 2207 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K<sub>x</sub>(0,1)*I(x-dx,y)&nbsp;&nbsp;&nbsp;&nbsp;+
ed@16 2208 K<sub>x</sub>(1,1)*I(x,y)&nbsp;&nbsp;&nbsp;&nbsp;+
ed@16 2209 K<sub>x</sub>(2,1)*I(x+dx,y)&nbsp;&nbsp;&nbsp;&nbsp;+<br />
ed@16 2210 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K<sub>x</sub>(0,2)*I(x-dx,y+dy)&nbsp;+
ed@16 2211 K<sub>x</sub>(1,2)*I(x,y+dy)&nbsp;+
ed@16 2212 K<sub>x</sub>(2,2)*I(x+dx,y+dy))<br />
ed@16 2213 N<sub>y</sub> (x,y) = - surfaceScale * FACTOR<sub>y</sub>
ed@16 2214 *<br />
ed@16 2215 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(K<sub>y</sub>(0,0)*I(x-dx,y-dy)&nbsp;+
ed@16 2216 K<sub>y</sub>(1,0)*I(x,y-dy)&nbsp;+
ed@16 2217 K<sub>y</sub>(2,0)*I(x+dx,y-dy)&nbsp;+<br />
ed@16 2218 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K<sub>y</sub>(0,1)*I(x-dx,y)&nbsp;&nbsp;&nbsp;&nbsp;+
ed@16 2219 K<sub>y</sub>(1,1)*I(x,y)&nbsp;&nbsp;&nbsp;&nbsp;+
ed@16 2220 K<sub>y</sub>(2,1)*I(x+dx,y)&nbsp;&nbsp;&nbsp;&nbsp;+<br />
ed@16 2221 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K<sub>y</sub>(0,2)*I(x-dx,y+dy)&nbsp;+
ed@16 2222 K<sub>y</sub>(1,2)*I(x,y+dy)&nbsp;+
ed@16 2223 K<sub>y</sub>(2,2)*I(x+dx,y+dy))<br />
ed@16 2224 N<sub>z</sub> (x,y) = 1.0<br />
edahlstr@0 2225 <br />
ed@16 2226 N = (N<sub>x</sub>, N<sub>y</sub>, N<sub>z</sub>) /
edahlstr@0 2227 Norm((N<sub>x</sub>,N<sub>y</sub>,N<sub>z</sub>))</p>
edahlstr@0 2228
edahlstr@0 2229 <p>In these formulas, the <code>dx</code> and <code>dy</code> values (e.g.,
edahlstr@0 2230 <code>I(x-dx,y-dy)</code>), represent deltas relative to a given
edahlstr@0 2231 <code>(x,y)</code> position for the purpose of estimating the slope of the
edahlstr@0 2232 surface at that point. These deltas are determined by the value (explicit or
edahlstr@0 2233 implicit) of attribute <a>'feDiffuseLighting/kernelUnitLength'</a>.</p>
edahlstr@0 2234
edahlstr@0 2235 <table summary="feDiffuseLighting formulas" border="1">
edahlstr@0 2236 <colgroup><col width="33.3%" /><col width="33.3%" /><col width="*"
edahlstr@0 2237 /></colgroup>
edahlstr@0 2238 <tbody>
edahlstr@0 2239 <tr>
edahlstr@0 2240 <td><p>Top/left corner:</p>
edahlstr@0 2241
edahlstr@0 2242 <p class="filterformula">FACTOR<sub>x</sub>=2/(3*dx)<br />
edahlstr@0 2243 K<sub>x</sub> =<br />
edahlstr@0 2244     |  0  0  0 |<br />
edahlstr@0 2245     |  0 -2  2 |<br />
edahlstr@0 2246     |  0 -1  1 |<br />
edahlstr@0 2247 <br />
edahlstr@0 2248 FACTOR<sub>y</sub>=2/(3*dy)<br />
edahlstr@0 2249 K<sub>y</sub> =  <br />
edahlstr@0 2250     |  0  0  0 |<br />
edahlstr@0 2251     |  0 -2 -1 |<br />
edahlstr@0 2252     |  0  2  1 |</p>
edahlstr@0 2253 </td>
edahlstr@0 2254 <td><p>Top row:</p>
edahlstr@0 2255
edahlstr@0 2256 <p class="filterformula">FACTOR<sub>x</sub>=1/(3*dx)<br />
edahlstr@0 2257 K<sub>x</sub> =<br />
edahlstr@0 2258     |  0  0  0 |<br />
edahlstr@0 2259     | -2  0  2 |<br />
edahlstr@0 2260     | -1  0  1 |<br />
edahlstr@0 2261 <br />
edahlstr@0 2262 FACTOR<sub>y</sub>=1/(2*dy)<br />
edahlstr@0 2263 K<sub>y</sub> =  <br />
edahlstr@0 2264     |  0  0  0 |<br />
edahlstr@0 2265     | -1 -2 -1 |<br />
edahlstr@0 2266     |  1  2  1 |</p>
edahlstr@0 2267 </td>
edahlstr@0 2268 <td><p>Top/right corner:</p>
edahlstr@0 2269
edahlstr@0 2270 <p class="filterformula">FACTOR<sub>x</sub>=2/(3*dx)<br />
edahlstr@0 2271 K<sub>x</sub> =<br />
edahlstr@0 2272     |  0  0  0 |<br />
edahlstr@0 2273     | -2  2  0 |<br />
edahlstr@0 2274     | -1  1  0 |<br />
edahlstr@0 2275 <br />
edahlstr@0 2276 FACTOR<sub>y</sub>=2/(3*dy)<br />
edahlstr@0 2277 K<sub>y</sub> =  <br />
edahlstr@0 2278     |  0  0  0 |<br />
edahlstr@0 2279     | -1 -2  0 |<br />
edahlstr@0 2280     |  1  2  0 |</p>
edahlstr@0 2281 </td>
edahlstr@0 2282 </tr>
edahlstr@0 2283 <tr>
edahlstr@0 2284 <td><p>Left column:</p>
edahlstr@0 2285
edahlstr@0 2286 <p class="filterformula">FACTOR<sub>x</sub>=1/(2*dx)<br />
edahlstr@0 2287 K<sub>x</sub> =<br />
edahlstr@0 2288     | 0 -1  1 |<br />
edahlstr@0 2289     | 0 -2  2 |<br />
edahlstr@0 2290     | 0 -1  1 |<br />
edahlstr@0 2291 <br />
edahlstr@0 2292 FACTOR<sub>y</sub>=1/(3*dy)<br />
edahlstr@0 2293 K<sub>y</sub> =  <br />
edahlstr@0 2294     |  0 -2 -1 |<br />
edahlstr@0 2295     |  0  0  0 |<br />
edahlstr@0 2296     |  0  2  1 |</p>
edahlstr@0 2297 </td>
edahlstr@0 2298 <td><p>Interior pixels:</p>
edahlstr@0 2299
edahlstr@0 2300 <p class="filterformula">FACTOR<sub>x</sub>=1/(4*dx)<br />
edahlstr@0 2301 K<sub>x</sub> =<br />
edahlstr@0 2302     | -1  0  1 |<br />
edahlstr@0 2303     | -2  0  2 |<br />
edahlstr@0 2304     | -1  0  1 |<br />
edahlstr@0 2305 <br />
edahlstr@0 2306 FACTOR<sub>y</sub>=1/(4*dy)<br />
edahlstr@0 2307 K<sub>y</sub> =  <br />
edahlstr@0 2308     | -1 -2 -1 |<br />
edahlstr@0 2309     |  0  0  0 |<br />
edahlstr@0 2310     |  1  2  1 |</p>
edahlstr@0 2311 </td>
edahlstr@0 2312 <td><p>Right column:</p>
edahlstr@0 2313
edahlstr@0 2314 <p class="filterformula">FACTOR<sub>x</sub>=1/(2*dx)<br />
edahlstr@0 2315 K<sub>x</sub> =<br />
edahlstr@0 2316     | -1  1  0|<br />
edahlstr@0 2317     | -2  2  0|<br />
edahlstr@0 2318     | -1  1  0|<br />
edahlstr@0 2319 <br />
edahlstr@0 2320 FACTOR<sub>y</sub>=1/(3*dy)<br />
edahlstr@0 2321 K<sub>y</sub> =  <br />
edahlstr@0 2322     | -1 -2  0 |<br />
edahlstr@0 2323     |  0  0  0 |<br />
edahlstr@0 2324     |  1  2  0 |</p>
edahlstr@0 2325 </td>
edahlstr@0 2326 </tr>
edahlstr@0 2327 <tr>
edahlstr@0 2328 <td><p>Bottom/left corner:</p>
edahlstr@0 2329
edahlstr@0 2330 <p class="filterformula">FACTOR<sub>x</sub>=2/(3*dx)<br />
edahlstr@0 2331 K<sub>x</sub> =<br />
edahlstr@0 2332     | 0 -1  1 |<br />
edahlstr@0 2333     | 0 -2  2 |<br />
edahlstr@0 2334     | 0  0  0 |<br />
edahlstr@0 2335 <br />
edahlstr@0 2336 FACTOR<sub>y</sub>=2/(3*dy)<br />
edahlstr@0 2337 K<sub>y</sub> =  <br />
edahlstr@0 2338     |  0 -2 -1 |<br />
edahlstr@0 2339     |  0  2  1 |<br />
edahlstr@0 2340     |  0  0  0 |</p>
edahlstr@0 2341 </td>
edahlstr@0 2342 <td><p>Bottom row:</p>
edahlstr@0 2343
edahlstr@0 2344 <p class="filterformula">FACTOR<sub>x</sub>=1/(3*dx)<br />
edahlstr@0 2345 K<sub>x</sub> =<br />
edahlstr@0 2346     | -1  0  1 |<br />
edahlstr@0 2347     | -2  0  2 |<br />
edahlstr@0 2348     |  0  0  0 |<br />
edahlstr@0 2349 <br />
edahlstr@0 2350 FACTOR<sub>y</sub>=1/(2*dy)<br />
edahlstr@0 2351 K<sub>y</sub> =  <br />
edahlstr@0 2352     | -1 -2 -1 |<br />
edahlstr@0 2353     |  1  2  1 |<br />
edahlstr@0 2354     |  0  0  0 |</p>
edahlstr@0 2355 </td>
edahlstr@0 2356 <td><p>Bottom/right corner:</p>
edahlstr@0 2357
edahlstr@0 2358 <p class="filterformula">FACTOR<sub>x</sub>=2/(3*dx)<br />
edahlstr@0 2359 K<sub>x</sub> =<br />
edahlstr@0 2360     | -1  1  0 |<br />
edahlstr@0 2361     | -2  2  0 |<br />
edahlstr@0 2362     |  0  0  0 |<br />
edahlstr@0 2363 <br />
edahlstr@0 2364 FACTOR<sub>y</sub>=2/(3*dy)<br />
edahlstr@0 2365 K<sub>y</sub> =  <br />
edahlstr@0 2366     | -1 -2  0 |<br />
edahlstr@0 2367     |  1  2  0 |<br />
edahlstr@0 2368     |  0  0  0 |</p>
edahlstr@0 2369 </td>
edahlstr@0 2370 </tr>
edahlstr@0 2371 </tbody>
edahlstr@0 2372 </table>
edahlstr@0 2373
edahlstr@0 2374 <p>L, the unit vector from the image sample to the light, is calculated as
edahlstr@0 2375 follows:</p>
edahlstr@0 2376
edahlstr@0 2377 <p>For Infinite light sources it is constant:</p>
edahlstr@0 2378
edahlstr@0 2379 <p class="filterformula">L<sub>x</sub> = cos(azimuth)*cos(elevation)<br />
edahlstr@0 2380 L<sub>y</sub> = sin(azimuth)*cos(elevation)<br />
edahlstr@0 2381 L<sub>z</sub> = sin(elevation)</p>
edahlstr@0 2382
edahlstr@0 2383 <p>For Point and spot lights it is a function of position:</p>
edahlstr@0 2384
edahlstr@0 2385 <p class="filterformula">L<sub>x</sub> = Light<sub>x</sub> - x<br />
edahlstr@0 2386 L<sub>y</sub> = Light<sub>y</sub> - y<br />
edahlstr@0 2387 L<sub>z</sub> = Light<sub>z</sub> - Z(x,y)<br />
edahlstr@0 2388 <br />
edahlstr@0 2389 L = (L<sub>x</sub>, L<sub>y</sub>, L<sub>z</sub>) / Norm(L<sub>x</sub>,
edahlstr@0 2390 L<sub>y</sub>, L<sub>z</sub>)</p>
edahlstr@0 2391
edahlstr@0 2392 <p>where Light<sub>x</sub>, Light<sub>y</sub>, and Light<sub>z</sub> are the
edahlstr@0 2393 input light position.</p>
edahlstr@0 2394
edahlstr@0 2395 <p>L<sub>r</sub>,L<sub>g</sub>,L<sub>b</sub>, the light color vector, is a
edahlstr@0 2396 function of position in the spot light case only:</p>
edahlstr@0 2397
edahlstr@0 2398 <p class="filterformula">L<sub>r</sub> =
edahlstr@0 2399 Light<sub>r</sub>*pow((-L.S),specularExponent)<br />
edahlstr@0 2400 L<sub>g</sub> = Light<sub>g</sub>*pow((-L.S),specularExponent)<br />
edahlstr@0 2401 L<sub>b</sub> = Light<sub>b</sub>*pow((-L.S),specularExponent)</p>
edahlstr@0 2402
edahlstr@0 2403 <p>where S is the unit vector pointing from the light to the point
edahlstr@0 2404 (pointsAtX, pointsAtY, pointsAtZ) in the x-y plane:</p>
edahlstr@0 2405
edahlstr@0 2406 <p class="filterformula">S<sub>x</sub> = pointsAtX - Light<sub>x</sub><br />
edahlstr@0 2407 S<sub>y</sub> = pointsAtY - Light<sub>y</sub><br />
edahlstr@0 2408 S<sub>z</sub> = pointsAtZ - Light<sub>z</sub><br />
edahlstr@0 2409 <br />
edahlstr@0 2410 S = (S<sub>x</sub>, S<sub>y</sub>, S<sub>z</sub>) / Norm(S<sub>x</sub>,
edahlstr@0 2411 S<sub>y</sub>, S<sub>z</sub>)</p>
edahlstr@0 2412
edahlstr@0 2413 <p>If L.S is positive, no light is present. (L<sub>r</sub> = L<sub>g</sub> =
edahlstr@0 2414 L<sub>b</sub> = 0). If <a>'feSpotLight/limitingConeAngle'</a> is specified, -L.S &lt; cos(limitingConeAngle) also indicates that no light is present.</p>
edahlstr@0 2415
edahlstr@0 2416 <div class="adef-list">
edahlstr@0 2417 <p><em>Attribute definitions:</em></p>
edahlstr@0 2418 <dl>
edahlstr@0 2419 <dt id="feDiffuseLightingSurfaceScaleAttribute"><span
edahlstr@0 2420 class="adef">surfaceScale</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 2421 <dd>height of surface when A<sub>in</sub> = 1.<br />
edahlstr@0 2422 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 2423 <span class="attr-value">1</span> were specified.<br />
edahlstr@0 2424 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2425 <dt id="feDiffuseLightingDiffuseConstantAttribute"><span
edahlstr@0 2426 class="adef">diffuseConstant</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 2427 <dd>kd in Phong lighting model. In SVG, this can be any non-negative
edahlstr@0 2428 number.<br />
edahlstr@0 2429 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 2430 <span class="attr-value">1</span> were specified.<br />
edahlstr@0 2431 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2432 <dt id="feDiffuseLightingKernelUnitLengthAttribute"><span
edahlstr@0 2433 class="adef">kernelUnitLength</span> = "<span
edahlstr@0 2434 class="attr-value"><a>&lt;number-optional-number&gt;</a></span>"</dt>
edahlstr@0 2435 <dd>The first number is the &lt;dx&gt; value. The second number is the
edahlstr@0 2436 &lt;dy&gt; value. If the &lt;dy&gt; value is not specified, it defaults
edahlstr@0 2437 to the same value as &lt;dx&gt;. Indicates the intended distance in
edahlstr@0 2438 current filter units (i.e., units as determined by the value of
edahlstr@0 2439 attribute <a>'filter/primitiveUnits'</a>) for <code>dx</code> and
edahlstr@0 2440 <code>dy</code>, respectively, in the <a
edahlstr@0 2441 href="#SurfaceNormalCalculations">surface normal calculation
edahlstr@0 2442 formulas</a>. By specifying value(s) for <span
edahlstr@0 2443 class="attr-name">kernelUnitLength</span>, the kernel becomes defined
edahlstr@0 2444 in a scalable, abstract coordinate system. If <span
edahlstr@0 2445 class="attr-name">kernelUnitLength</span> is not specified, the
edahlstr@0 2446 <code>dx</code> and <code>dy</code> values should represent very small
edahlstr@0 2447 deltas relative to a given <code>(x,y)</code> position, which might be
edahlstr@0 2448 implemented in some cases as one pixel in the intermediate image
edahlstr@0 2449 offscreen bitmap, which is a pixel-based coordinate system, and thus
edahlstr@0 2450 potentially not scalable. For some level of consistency across display
edahlstr@0 2451 media and user agents, it is necessary that a value be provided for at
edahlstr@0 2452 least one of <a>'filter/filterRes'</a> and <span
edahlstr@0 2453 class="attr-name">kernelUnitLength</span>. Discussion of intermediate
edahlstr@0 2454 images are in the <a href="#Introduction">Introduction</a> and in the
edahlstr@0 2455 description of attribute <a>'filter/filterRes'</a>.<br />
edahlstr@0 2456 If a negative or zero value is specified the default value will be used
edahlstr@0 2457 instead. <br />
edahlstr@0 2458 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2459 </dl>
edahlstr@0 2460 </div>
edahlstr@0 2461
edahlstr@0 2462 <p>The light source is defined by one of the child elements <a>'feDistantLight'</a>,
edahlstr@0 2463 <a>'fePointLight'</a> or <a>'feSpotLight'</a>. The light color is specified
edahlstr@0 2464 by property <a>'lighting-color'</a>.</p>
edahlstr@0 2465
edahlstr@0 2466 <h2 id="feDisplacementMapElement">Filter primitive <span class="element-name">'feDisplacementMap'</span></h2>
edahlstr@0 2467
edahlstr@0 2468 <edit:elementsummary name='feDisplacementMap'/>
edahlstr@0 2469
edahlstr@0 2470 <p>This filter primitive uses the pixels values from the image from <a>'feDisplacementMap/in2'</a>
edahlstr@0 2471 to spatially displace the image from <a>'in'</a>.
edahlstr@0 2472 This is the transformation to be performed:</p>
edahlstr@0 2473
dino@13 2474 <pre> P'(x,y) ← P( x + scale * (XC(x,y) - .5), y + scale * (YC(x,y) - .5))
dino@13 2475 </pre>
edahlstr@0 2476
edahlstr@0 2477 <p>where P(x,y) is the input image, <a>'in'</a>, and
edahlstr@0 2478 P'(x,y) is the destination. XC(x,y) and YC(x,y) are the component values of
edahlstr@0 2479 the channel designated by the <a>'feDisplacementMap/xChannelSelector'</a> and
edahlstr@0 2480 <a>'feDisplacementMap/yChannelSelector'</a>. For example, to use the R component of <a>'feDisplacementMap/in2'</a>
edahlstr@0 2481 to control displacement in x and the G component of Image2 to control
edahlstr@0 2482 displacement in y, set <a>'feDisplacementMap/xChannelSelector'</a> to <span class="attr-value">"R"</span> and
edahlstr@0 2483 <a>'feDisplacementMap/yChannelSelector'</a> to <span class="attr-value">"G"</span>.</p>
edahlstr@0 2484
edahlstr@0 2485 <p>The displacement map, <a>'feDisplacementMap/in2'</a>, defines the inverse of the mapping
edahlstr@0 2486 performed.</p>
edahlstr@0 2487
edahlstr@0 2488 <p>The input image in is to remain premultiplied for this filter primitive. The calculations using the pixel values from <a>'feDisplacementMap/in2'</a> are performed using non-premultiplied color values. If the image from <a>'feDisplacementMap/in2'</a> consists of premultiplied color values, those values are automatically converted into non-premultiplied color values before performing this operation.</p>
edahlstr@0 2489
edahlstr@0 2490 <p>This filter can have arbitrary non-localized effect on the input which
edahlstr@0 2491 might require substantial buffering in the processing pipeline. However with
edahlstr@0 2492 this formulation, any intermediate buffering needs can be determined by
edahlstr@0 2493 <a>'feDisplacementMap/scale'</a> which represents the maximum range of displacement in either x
edahlstr@0 2494 or y.</p>
edahlstr@0 2495
edahlstr@0 2496 <p>When applying this filter, the source pixel location will often lie
edahlstr@0 2497 between several source pixels. In this case it is recommended that high
edahlstr@0 2498 quality viewers apply an interpolent on the surrounding pixels, for example
edahlstr@0 2499 bilinear or bicubic, rather than simply selecting the nearest source pixel.
edahlstr@0 2500 Depending on the speed of the available interpolents, this choice may be
edahlstr@0 2501 affected by the <a>'image-rendering'</a> property
edahlstr@0 2502 setting.</p>
edahlstr@0 2503
edahlstr@0 2504 <p>The <a>'color-interpolation-filters'</a> property only applies to the
edahlstr@0 2505 <a>'feDisplacementMap/in2'</a> source image and does not apply to the <a>'in'</a> source image.
edahlstr@0 2506 The <a>'in'</a> source image must remain in its current color space.
edahlstr@0 2507 </p>
edahlstr@0 2508
edahlstr@0 2509 <div class="adef-list">
edahlstr@0 2510 <p><em>Attribute definitions:</em></p>
edahlstr@0 2511 <dl>
edahlstr@0 2512 <dt id="feDisplacementMapScaleAttribute"><span class="adef">scale</span>
edahlstr@0 2513 = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 2514 <dd>Displacement scale factor. The amount is expressed in the coordinate
edahlstr@0 2515 system established by attribute <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 2516 element.<br />
edahlstr@0 2517 When the value of this attribute is <span class="attr-value">0</span>,
edahlstr@0 2518 this operation has no effect on the source image.<br />
edahlstr@0 2519 <p>The <a>lacuna value</a> for <a>'feDisplacementMap/scale'</a> is <span class="attr-value">0</span>.</p>
edahlstr@0 2520 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2521 <dt id="feDisplacementMapXChannelSelectorAttribute"><span
edahlstr@0 2522 class="adef">xChannelSelector</span> = "<em>R | G | B | A</em>"</dt>
edahlstr@0 2523 <dd>Indicates which channel from <a>'feDisplacementMap/in2'</a> to use to displace the pixels in <a>'in'</a> along the x-axis.
dino@10 2524 The <a>lacuna value</a> for <a>'feDisplacementMap/xChannelSelector'</a> is <span class="attr-value">A</span>.
edahlstr@0 2525 <br />
edahlstr@0 2526 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2527 <dt id="feDisplacementMapYChannelSelectorAttribute"><span
edahlstr@0 2528 class="adef">yChannelSelector</span> = "<em>R | G | B | A</em>"</dt>
edahlstr@0 2529 <dd>Indicates which channel from <a>'feDisplacementMap/in2'</a> to use to displace the pixels in <a>'in'</a> along the y-axis.
dino@10 2530 The <a>lacuna value</a> for <a>'feDisplacementMap/yChannelSelector'</a> is <span class="attr-value">A</span>.
edahlstr@0 2531 <br />
edahlstr@0 2532 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2533 <dt id="feDisplacementMapIn2Attribute"><span class="adef">in2</span> =
edahlstr@0 2534 "<em>(see <a>'in'</a> attribute)</em>"</dt>
edahlstr@0 2535 <dd>The second input image, which is used to displace the pixels in the
edahlstr@0 2536 image from attribute <a>'in'</a>. This attribute can take on the same
edahlstr@0 2537 values as the <a>'in'</a> attribute.<br />
edahlstr@0 2538 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2539 </dl>
edahlstr@0 2540 </div>
edahlstr@0 2541
edahlstr@0 2542 <h2 id="feFloodElement">Filter primitive <span
edahlstr@0 2543 class="element-name">'feFlood'</span></h2>
edahlstr@0 2544
edahlstr@0 2545 <edit:elementsummary name='feFlood'/>
edahlstr@0 2546
edahlstr@0 2547 <p>This filter primitive creates a rectangle filled with the color and
edahlstr@0 2548 opacity values from properties <span class="prop-name">'flood-color'</span>
edahlstr@0 2549 and <span class="prop-name">'flood-opacity'</span>. The rectangle is as large
edahlstr@0 2550 as the <a href="#FilterPrimitiveSubRegion">filter primitive subregion</a>
edahlstr@0 2551 established by the <span class="element-name">'feFlood'</span> element.</p>
edahlstr@0 2552
edahlstr@0 2553 <div class="adef-list">
edahlstr@0 2554   </div>
edahlstr@0 2555
edahlstr@0 2556 <p>The <span class="prop-name">'flood-color'</span> property indicates what
edahlstr@0 2557 color to use to flood the current <a href="#FilterPrimitiveSubRegion">filter
edahlstr@0 2558 primitive subregion</a>. The keyword <span
edahlstr@0 2559 class="attr-value">currentColor</span> and ICC colors can be specified in the
edahlstr@0 2560 same manner as within a &lt;paint&gt; specification for the <span
edahlstr@0 2561 class="prop-name">'fill'</span> and <span class="prop-name">'stroke'</span>
edahlstr@0 2562 properties.</p>
edahlstr@0 2563
edahlstr@0 2564 <div class="propdef">
edahlstr@0 2565 <dl>
edahlstr@0 2566 <dt id="FloodColorProperty"><span class="propdef-title prop-name">'flood-color'</span></dt>
edahlstr@0 2567 <dd>
edahlstr@0 2568 <table summary="flood-color property" class="propinfo" cellspacing="0"
edahlstr@0 2569 cellpadding="0">
edahlstr@0 2570 <tbody>
edahlstr@0 2571 <tr valign="baseline">
edahlstr@0 2572 <td><em>Value:</em>  </td>
edahlstr@0 2573 <td>currentColor |<br />
edahlstr@0 2574 <a>&lt;color&gt;</a>
edahlstr@0 2575 [<a>&lt;icccolor&gt;</a>] |<br />
edahlstr@0 2576 <a class="noxref"
edahlstr@0 2577 href="http://www.w3.org/TR/2009/CR-CSS2-20090423/cascade.html#value-def-inherit"><span
edahlstr@0 2578 class="value-inst-inherit noxref">inherit</span></a></td>
edahlstr@0 2579 </tr>
edahlstr@0 2580 <tr valign="baseline">
edahlstr@0 2581 <td><em>Initial:</em>  </td>
edahlstr@0 2582 <td>black</td>
edahlstr@0 2583 </tr>
edahlstr@0 2584 <tr valign="baseline">
edahlstr@0 2585 <td><em>Applies to:</em>  </td>
edahlstr@0 2586 <td><a href="#feFloodElement"><span
edahlstr@0 2587 class="element-name">'feFlood'</span></a> and <a
edahlstr@0 2588 href="#feDropShadowElement"><span
edahlstr@0 2589 class="element-name">'feDropShadow'</span></a> elements</td>
edahlstr@0 2590 </tr>
edahlstr@0 2591 <tr valign="baseline">
edahlstr@0 2592 <td><em>Inherited:</em>  </td>
edahlstr@0 2593 <td>no</td>
edahlstr@0 2594 </tr>
edahlstr@0 2595 <tr valign="baseline">
edahlstr@0 2596 <td><em>Percentages:</em>  </td>
edahlstr@0 2597 <td>N/A</td>
edahlstr@0 2598 </tr>
edahlstr@0 2599 <tr valign="baseline">
edahlstr@0 2600 <td><em>Media:</em>  </td>
edahlstr@0 2601 <td>visual</td>
edahlstr@0 2602 </tr>
edahlstr@0 2603 <tr valign="baseline">
edahlstr@0 2604 <td><em>Animatable:</em>  </td>
edahlstr@0 2605 <td>yes</td>
edahlstr@0 2606 </tr>
edahlstr@0 2607 </tbody>
edahlstr@0 2608 </table>
edahlstr@0 2609 </dd>
edahlstr@0 2610 </dl>
edahlstr@0 2611 </div>
edahlstr@0 2612
edahlstr@0 2613 <p>The <span class="prop-name">'flood-opacity'</span> property defines the
edahlstr@0 2614 opacity value to use across the entire <a
edahlstr@0 2615 href="#FilterPrimitiveSubRegion">filter primitive subregion</a>.</p>
edahlstr@0 2616
edahlstr@0 2617 <div class="propdef">
edahlstr@0 2618 <dl>
edahlstr@0 2619 <dt id="OpacityFloodOpacityProperty"><span class="propdef-title prop-name">'flood-opacity'</span></dt>
edahlstr@0 2620 <dd>
edahlstr@0 2621 <table summary="flood-opacity property" class="propinfo"
edahlstr@0 2622 cellspacing="0" cellpadding="0">
edahlstr@0 2623 <tbody>
edahlstr@0 2624 <tr valign="baseline">
edahlstr@0 2625 <td><em>Value:</em>  </td>
edahlstr@0 2626 <td>&lt;opacity-value&gt; | <a class="noxref"
edahlstr@0 2627 href="http://www.w3.org/TR/2009/CR-CSS2-20090423/cascade.html#value-def-inherit"><span
edahlstr@0 2628 class="value-inst-inherit noxref">inherit</span></a></td>
edahlstr@0 2629 </tr>
edahlstr@0 2630 <tr valign="baseline">
edahlstr@0 2631 <td><em>Initial:</em>  </td>
edahlstr@0 2632 <td>1</td>
edahlstr@0 2633 </tr>
edahlstr@0 2634 <tr valign="baseline">
edahlstr@0 2635 <td><em>Applies to:</em>  </td>
edahlstr@0 2636 <td><a href="#feFloodElement"><span
edahlstr@0 2637 class="element-name">'feFlood'</span></a> and <a
edahlstr@0 2638 href="#feDropShadowElement"><span
edahlstr@0 2639 class="element-name">'feDropShadow'</span></a> elements</td>
edahlstr@0 2640 </tr>
edahlstr@0 2641 <tr valign="baseline">
edahlstr@0 2642 <td><em>Inherited:</em>  </td>
edahlstr@0 2643 <td>no</td>
edahlstr@0 2644 </tr>
edahlstr@0 2645 <tr valign="baseline">
edahlstr@0 2646 <td><em>Percentages:</em>  </td>
edahlstr@0 2647 <td>N/A</td>
edahlstr@0 2648 </tr>
edahlstr@0 2649 <tr valign="baseline">
edahlstr@0 2650 <td><em>Media:</em>  </td>
edahlstr@0 2651 <td>visual</td>
edahlstr@0 2652 </tr>
edahlstr@0 2653 <tr valign="baseline">
edahlstr@0 2654 <td><em>Animatable:</em>  </td>
edahlstr@0 2655 <td>yes</td>
edahlstr@0 2656 </tr>
edahlstr@0 2657 </tbody>
edahlstr@0 2658 </table>
edahlstr@0 2659 </dd>
edahlstr@0 2660 </dl>
edahlstr@0 2661 </div>
edahlstr@0 2662
edahlstr@0 2663 <h2 id="feGaussianBlurElement">Filter primitive <span
edahlstr@0 2664 class="element-name">'feGaussianBlur'</span></h2>
edahlstr@0 2665
edahlstr@0 2666 <edit:elementsummary name='feGaussianBlur'/>
ed@22 2667 <edit:with element='feGaussianBlur'>
edahlstr@0 2668
edahlstr@0 2669 <p>This filter primitive performs a Gaussian blur on the input image.</p>
edahlstr@0 2670
edahlstr@0 2671 <p>The Gaussian blur kernel is an approximation of the normalized
edahlstr@0 2672 convolution:</p>
edahlstr@0 2673
edahlstr@0 2674 <p class="filterformula">G(x,y) = H(x)I(y)</p>
ed@22 2675 <p>where</p>
ed@22 2676 <p class="filterformula">H(x) = exp(-x<sup>2</sup>/ (2s<sup>2</sup>)) / sqrt(2* pi*s<sup>2</sup>)</p>
edahlstr@0 2677 <p>and</p>
ed@22 2678 <p class="filterformula">I(x) = exp(-y<sup>2</sup>/ (2t<sup>2</sup>)) / sqrt(2* pi*t<sup>2</sup>)</p>
edahlstr@0 2679 <p>with 's' being the standard deviation in the x direction
ed@22 2680 and 't' being the standard deviation in the y direction, as specified by <a>'stdDeviation'</a>.</p>
ed@22 2681
ed@22 2682 <p>The value of <a>'stdDeviation'</a> can be either one or two numbers.
edahlstr@0 2683 If two numbers are provided, the first number represents a standard deviation
edahlstr@0 2684 value along the x-axis of the current coordinate system and the second value
edahlstr@0 2685 represents a standard deviation in Y. If one number is provided, then that
edahlstr@0 2686 value is used for both X and Y.</p>
edahlstr@0 2687
ed@22 2688 <p>Even if only one value is provided for <a>'stdDeviation'</a>, this can be implemented as a
edahlstr@0 2689 separable convolution.</p>
edahlstr@0 2690
edahlstr@0 2691 <p>For larger values of 's' (s &gt;= 2.0), an approximation can be used:
edahlstr@0 2692 Three successive box-blurs build a piece-wise quadratic convolution kernel,
edahlstr@0 2693 which approximates the Gaussian kernel to within roughly 3%.</p>
edahlstr@0 2694
edahlstr@0 2695 <p class="filterformula">let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)</p>
edahlstr@0 2696
edahlstr@0 2697 <p>... if d is odd, use three box-blurs of size 'd', centered on the output
edahlstr@0 2698 pixel.</p>
edahlstr@0 2699
edahlstr@0 2700 <p>... if d is even, two box-blurs of size 'd' (the first one centered on the
edahlstr@0 2701 pixel boundary between the output pixel and the one to the left, the second
edahlstr@0 2702 one centered on the pixel boundary between the output pixel and the one to
edahlstr@0 2703 the right) and one box blur of size 'd+1' centered on the output pixel.</p>
edahlstr@0 2704
ed@22 2705 <p>The approximation formula also applies correspondingly to 't'.</p>
ed@22 2706
edahlstr@0 2707 <p>Frequently this operation will take place on alpha-only images, such as
edahlstr@0 2708 that produced by the built-in input, <a href="#SourceAlpha"><span
edahlstr@0 2709 class="attr-value">SourceAlpha</span></a>. The implementation may notice this
edahlstr@0 2710 and optimize the single channel case. If the input has infinite extent and is
ed@26 2711 constant (e.g <span class="attr-value"><a href="#FillPaint">FillPaint</a></span>,
ed@26 2712 this operation has no effect. If the input has infinite extent and the filter result
ed@26 2713 is the input to an <a>'feTile'</a>, the filter is evaluated with periodic boundary conditions.</p>
edahlstr@0 2714
edahlstr@0 2715 <div class="adef-list">
edahlstr@0 2716 <p><em>Attribute definitions:</em></p>
edahlstr@0 2717 <dl>
edahlstr@0 2718 <dt id="feGaussianBlurStdDeviationAttribute"><span
edahlstr@0 2719 class="adef">stdDeviation</span> =
edahlstr@0 2720 "<em><a>&lt;number-optional-number&gt;</a></em>"</dt>
edahlstr@0 2721 <dd>The standard deviation for the blur operation. If two <a>&lt;number&gt;</a>
edahlstr@0 2722 s are provided, the first number represents a standard deviation value
edahlstr@0 2723 along the x-axis of the coordinate system established by attribute <a>'filter/primitiveUnits'</a> on the <a
edahlstr@0 2724 href="#FilterElement"><span class="element-name">'filter'</span></a>
edahlstr@0 2725 element. The second value represents a standard deviation in Y. If one
edahlstr@0 2726 number is provided, then that value is used for both X and Y.<br />
edahlstr@0 2727 A value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image).<br />
ed@22 2728 If <a>'stdDeviation'</a> is <span class="attr-value">0</span> in only one of X or Y,
ed@22 2729 then the effect is that the blur is only applied in the direction that has a non-zero value.
ed@22 2730 <br />
ed@22 2731 The <a>lacuna value</a> for <a>'stdDeviation'</a> is <span class="attr-value">0</span>.<br />
edahlstr@0 2732 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2733 </dl>
edahlstr@0 2734 </div>
edahlstr@0 2735
edahlstr@0 2736 <p><a href="#AnExample">The example</a> at the start of this chapter makes
edahlstr@0 2737 use of the <a>'feGaussianBlur'</a> filter primitive
edahlstr@0 2738 to create a drop shadow effect.</p>
ed@22 2739 </edit:with>
edahlstr@0 2740
edahlstr@0 2741 <h2 id="feUnsharpMaskElement">Filter primitive <span
edahlstr@0 2742 class="element-name">'feUnsharpMask'</span></h2>
edahlstr@0 2743
edahlstr@0 2744 <edit:elementsummary name='feUnsharpMask'/>
edahlstr@0 2745
edahlstr@0 2746 <p>This filter primitive performs an image sharpening operation on the input image. This is traditionally known as an unsharp mask operation.</p>
edahlstr@0 2747
edahlstr@0 2748 <p>The filter first does a <a>'feGaussianBlur'</a> operation on the input image and then subtracts the difference between the input image and the blurred image.</p>
edahlstr@0 2749
edahlstr@0 2750 <p>
edahlstr@0 2751 For controlling the result there are three attributes that can be used:
edahlstr@0 2752 <ul>
edahlstr@0 2753 <li>the <a>'feUnsharpMask/stdDeviation'</a> attribute controls how much to blur the input image</li>
edahlstr@0 2754 <li>the <a>'feUnsharpMask/threshold'</a> attribute can be used for controlling when the difference should not be subtracted</li>
edahlstr@0 2755 <li>the <a>'feUnsharpMask/amount'</a> attribute specifies an optional multiplier for the difference to subtract</li>
edahlstr@0 2756 </ul>
edahlstr@0 2757 </p>
edahlstr@0 2758
edahlstr@0 2759 <h2 id="feImageElement">Filter primitive <span
edahlstr@0 2760 class="element-name">'feImage'</span></h2>
edahlstr@0 2761
edahlstr@0 2762 <edit:elementsummary name='feImage'/>
ed@23 2763 <edit:with element='feImage'>
edahlstr@0 2764
edahlstr@0 2765 <p>This filter primitive refers to a graphic external to this filter element,
edahlstr@0 2766 which is loaded or rendered into an RGBA raster and becomes the result of the
edahlstr@0 2767 filter primitive.</p>
edahlstr@0 2768
edahlstr@0 2769 <p>This filter primitive can refer to an external image or can be a reference
edahlstr@0 2770 to another piece of SVG. It produces an image similar to the built-in image
edahlstr@0 2771 source <a href="#SourceGraphic"><span
edahlstr@0 2772 class="attr-value">SourceGraphic</span></a> except that the graphic comes
edahlstr@0 2773 from an external source.</p>
edahlstr@0 2774
edahlstr@0 2775 <p>If the <span class="attr-name">xlink:href</span> references a stand-alone
edahlstr@0 2776 image resource such as a JPEG, PNG or SVG file, then the image resource is
edahlstr@0 2777 rendered according to the behavior of the <span
edahlstr@0 2778 class="element-name">'image'</span> element; otherwise, the referenced
edahlstr@0 2779 resource is rendered according to the behavior of the <span
edahlstr@0 2780 class="element-name">'use'</span> element. In either case, the current user
edahlstr@0 2781 coordinate system depends on the value of attribute <a>'filter/primitiveUnits'</a> on the <a
edahlstr@0 2782 href="#FilterElement"><span class="element-name">'filter'</span></a> element.
edahlstr@0 2783 The processing of the <span class="attr-name">preserveAspectRatio</span>
edahlstr@0 2784 attribute on the <span class="element-name">'feImage'</span> element is
edahlstr@0 2785 identical to that of the <a href="struct.html#ImageElement"><span
edahlstr@0 2786 class="element-name">'image'</span></a> element.</p>
edahlstr@0 2787
edahlstr@0 2788 <p><span class="requirement" id="assert_hqImageResampling">When the referenced image must be resampled to match the device coordinate
edahlstr@0 2789 system, it is recommended that high quality viewers make use of appropriate
edahlstr@0 2790 interpolation techniques, for example bilinear or bicubic.</span> Depending on the
edahlstr@0 2791 speed of the available interpolents, this choice may be affected by the <span
edahlstr@0 2792 class="prop-name">'image-rendering'</span> property setting.</p>
edahlstr@0 2793
edahlstr@0 2794 <div class="adef-list">
edahlstr@0 2795 <p><em>Attribute definitions:</em></p>
edahlstr@0 2796 <dl>
edahlstr@0 2797 <dt id="feImageHrefAttribute"><span
edahlstr@0 2798 class="adef">xlink:href</span> =
edahlstr@0 2799 "<span class="attr-value">&lt;IRI&gt;</span>"</dt>
ed@17 2800 <dd>An <a>IRI reference</a>
edahlstr@0 2801 to an image resource or to an element.
edahlstr@0 2802 <br />
edahlstr@0 2803 <span class="anim-target">Animatable: yes.</span></dd>
ed@17 2804 <dt id="feImageElementPreserveAspectRatioAttribute">
ed@17 2805 <span class="adef">preserveAspectRatio</span> = "<span class='attr-value'>[defer] &lt;align&gt; [&lt;meetOrSlice&gt;]</span>"
ed@17 2806 </dt>
ed@17 2807 <dd>
ed@17 2808 <p>
ed@17 2809 See <a>'preserveAspectRatio'</a>.
ed@17 2810 </p>
ed@17 2811 <p>
ed@17 2812 The lacuna value for <a>'preserveAspectRatio'</a> is <span class="attr-value">xMidYMid meet</span>.
ed@17 2813 </p>
ed@17 2814 <p><span class="anim-target"><a href="animate.html#Animatable">Animatable</a>: yes.</span></p>
ed@17 2815 </dd>
edahlstr@0 2816 </dl>
edahlstr@0 2817 </div>
edahlstr@0 2818
ed@23 2819 <p><span class="example-ref">Example feImage</span> illustrates how images are placed relative
ed@23 2820 to an object. From left to right:</p>
ed@23 2821 <ul>
ed@23 2822 <li>
ed@23 2823 The default placement of an image. Note that the image is
ed@23 2824 centered in the <a>filter region</a> and has the maximum size that will
ed@23 2825 fit in the region consistent with preserving the aspect ratio.
ed@23 2826 </li>
ed@23 2827 <li>
ed@23 2828 The image stretched to fit the bounding box of an object.
ed@23 2829 </li>
ed@23 2830 <li>
ed@23 2831 The image placed using user coordinates. Note that the image is
ed@23 2832 first centered in a box the size of the <a>filter region</a> and has the
ed@23 2833 maximum size that will fit in the box consistent with preserving
ed@23 2834 the aspect ratio. This box is then shifted by the given <a>'x'</a> and
ed@23 2835 <a>'y'</a> values relative to the viewport the object is in.
ed@23 2836 </li>
ed@23 2837 </ul>
ed@23 2838
ed@23 2839 <edit:example href='examples/feImage-01.svg' name='feImage' description='Examples of feImage use' image='yes' link='yes'/>
ed@23 2840 </edit:with>
ed@23 2841
edahlstr@0 2842 <h2 id="feMergeElement">Filter primitive <span
edahlstr@0 2843 class="element-name">'feMerge'</span></h2>
edahlstr@0 2844
edahlstr@0 2845 <edit:elementsummary name='feMerge'/>
edahlstr@0 2846 <edit:elementsummary name='feMergeNode'/>
edahlstr@0 2847
edahlstr@0 2848 <p>This filter primitive composites input image layers on top of each other
edahlstr@0 2849 using the <em>over</em> operator with <em>Input1</em> (corresponding to the
edahlstr@0 2850 first <a href="#feMergeNodeElement"><span
edahlstr@0 2851 class="element-name">'feMergeNode'</span></a> child element) on the bottom
edahlstr@0 2852 and the last specified input, <em>InputN</em> (corresponding to the last <a
edahlstr@0 2853 href="#feMergeNodeElement"><span
edahlstr@0 2854 class="element-name">'feMergeNode'</span></a> child element), on top.</p>
edahlstr@0 2855
edahlstr@0 2856 <p>Many effects produce a number of intermediate layers in order to create
edahlstr@0 2857 the final output image. This filter allows us to collapse those into a single
edahlstr@0 2858 image. Although this could be done by using n-1 Composite-filters, it is more
edahlstr@0 2859 convenient to have this common operation available in this form, and offers
edahlstr@0 2860 the implementation some additional flexibility.</p>
edahlstr@0 2861
edahlstr@0 2862 <p>Each 'feMerge' element can have any number of 'feMergeNode' subelements,
edahlstr@0 2863 each of which has an <a href="#CommonAttributes"><span
edahlstr@0 2864 class="attr-name">in</span></a> attribute.</p>
edahlstr@0 2865
edahlstr@0 2866 <p>The canonical implementation of feMerge is to render the entire effect
edahlstr@0 2867 into one RGBA layer, and then render the resulting layer on the output
edahlstr@0 2868 device. In certain cases (in particular if the output device itself is a
edahlstr@0 2869 continuous tone device), and since merging is associative, it might be a
edahlstr@0 2870 sufficient approximation to evaluate the effect one layer at a time and
edahlstr@0 2871 render each layer individually onto the output device bottom to top.</p>
edahlstr@0 2872
edahlstr@0 2873 <p>If the topmost image input is <a href="#SourceGraphic"><span
edahlstr@0 2874 class="attr-value">SourceGraphic</span></a> and this <span
edahlstr@0 2875 class="element-name">'feMerge'</span> is the last filter primitive in the
edahlstr@0 2876 filter, the implementation is encouraged to render the layers up to that
edahlstr@0 2877 point, and then render the <a href="#SourceGraphic"><span
edahlstr@0 2878 class="attr-value">SourceGraphic</span></a> directly from its vector
edahlstr@0 2879 description on top.</p>
edahlstr@0 2880
edahlstr@0 2881 <p id="feMergeNode"><a href="#AnExample">The example</a> at the start of this chapter makes
edahlstr@0 2882 use of the <span class="element-name">feMerge</span> filter primitive to
edahlstr@0 2883 composite two intermediate filter results together.</p>
edahlstr@0 2884
edahlstr@0 2885 <h2 id="feMorphologyElement">Filter primitive <span
edahlstr@0 2886 class="element-name">'feMorphology'</span></h2>
edahlstr@0 2887
edahlstr@0 2888 <edit:elementsummary name='feMorphology'/>
ed@17 2889 <edit:with element='feMorphology'>
edahlstr@0 2890
edahlstr@0 2891 <p>This filter primitive performs "fattening" or "thinning" of artwork. It is
edahlstr@0 2892 particularly useful for fattening or thinning an alpha channel.</p>
edahlstr@0 2893
edahlstr@0 2894 <p>The dilation (or erosion) kernel is a rectangle with a width of
edahlstr@0 2895 2*<em>x-radius</em> and a height of 2*<em>y-radius</em>. In dilation, the
edahlstr@0 2896 output pixel is the individual component-wise maximum of the corresponding
edahlstr@0 2897 R,G,B,A values in the input image's kernel rectangle. In erosion, the output
edahlstr@0 2898 pixel is the individual component-wise minimum of the corresponding R,G,B,A
edahlstr@0 2899 values in the input image's kernel rectangle.</p>
edahlstr@0 2900
edahlstr@0 2901 <p>Frequently this operation will take place on alpha-only images, such as
edahlstr@0 2902 that produced by the built-in input, <a href="#SourceAlpha"><span
edahlstr@0 2903 class="attr-value">SourceAlpha</span></a>. In that case, the implementation
edahlstr@0 2904 might want to optimize the single channel case.</p>
edahlstr@0 2905
ed@26 2906 <p>If the input has infinite extent and is constant (e.g <span class="attr-value"><a href="#FillPaint">FillPaint</a></span>
ed@26 2907 where the fill is a solid color), this operation has no effect.
ed@26 2908 If the input has infinite extent and the filter result
ed@26 2909 is the input to an <a>'feTile'</a>, the filter is evaluated with
ed@26 2910 periodic boundary conditions.</p>
edahlstr@0 2911
edahlstr@0 2912 <p>Because <span class="element-name">'feMorphology'</span> operates on
edahlstr@0 2913 premultipied color values, it will always result in color values less than or
edahlstr@0 2914 equal to the alpha channel.</p>
edahlstr@0 2915
edahlstr@0 2916 <div class="adef-list">
edahlstr@0 2917 <p><em>Attribute definitions:</em></p>
edahlstr@0 2918 <dl>
edahlstr@0 2919 <dt id="feMorphologyOperatorAttribute"><span
edahlstr@0 2920 class="adef">operator</span> = "<em>erode | dilate</em>"</dt>
edahlstr@0 2921 <dd>A keyword indicating whether to erode (i.e., thin) or dilate (fatten)
ed@17 2922 the source graphic.
ed@17 2923 The lacuna value for <a>'operator'</a> is <span class="attr-value">erode</span>.
ed@17 2924 <br />
edahlstr@0 2925 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2926 <dt id="feMorphologyRadiusAttribute"><span class="adef">radius</span> =
edahlstr@0 2927 "<em><a>&lt;number-optional-number&gt;</a></em>"</dt>
edahlstr@0 2928 <dd>The radius (or radii) for the operation. If two <a>&lt;number&gt;</a>
edahlstr@0 2929 s are provided, the first number represents a x-radius and the second
edahlstr@0 2930 value represents a y-radius. If one number is provided, then that value
edahlstr@0 2931 is used for both X and Y. The values are in the coordinate system
edahlstr@0 2932 established by attribute <a>'filter/primitiveUnits'</a> on the <a
edahlstr@0 2933 href="#FilterElement"><span class="element-name">'filter'</span></a>
edahlstr@0 2934 element.<br />
edahlstr@0 2935 A negative or zero value disables the effect of the given filter
edahlstr@0 2936 primitive (i.e., the result is a transparent black image).<br />
edahlstr@0 2937 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 2938 <span class="attr-value">0</span> were specified.<br />
edahlstr@0 2939 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2940 </dl>
edahlstr@0 2941 </div>
ed@17 2942 </edit:with>
edahlstr@0 2943
edahlstr@0 2944 <edit:example href="examples/feMorphology.svg" image="yes" link="yes"/>
edahlstr@0 2945
edahlstr@0 2946 <h2 id="feOffsetElement">Filter primitive <span
edahlstr@0 2947 class="element-name">'feOffset'</span></h2>
edahlstr@0 2948
edahlstr@0 2949 <edit:elementsummary name='feOffset'/>
edahlstr@0 2950
edahlstr@0 2951 <p>This filter primitive offsets the input image relative to its current
edahlstr@0 2952 position in the image space by the specified vector.</p>
edahlstr@0 2953
edahlstr@0 2954 <p>This is important for effects like drop shadows.</p>
edahlstr@0 2955
edahlstr@0 2956 <p>When applying this filter, the destination location may be offset by a
edahlstr@0 2957 fraction of a pixel in device space. <span class="requirement" id="assert_hqFeOffsetInterpolation">In this case a high quality viewer
edahlstr@0 2958 should make use of appropriate interpolation techniques, for example bilinear
edahlstr@0 2959 or bicubic.</span> This is especially recommended for dynamic viewers where this
edahlstr@0 2960 interpolation provides visually smoother movement of images. For static
edahlstr@0 2961 viewers this is less of a concern. Close attention should be made to the
edahlstr@0 2962 <span class="prop-name">'image-rendering'</span> property setting to
edahlstr@0 2963 determine the authors intent.</p>
edahlstr@0 2964
edahlstr@0 2965 <div class="adef-list">
edahlstr@0 2966 <p><em>Attribute definitions:</em></p>
edahlstr@0 2967 <dl>
edahlstr@0 2968 <dt id="feOffsetDxAttribute"><span
edahlstr@0 2969 class="adef">dx</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 2970 <dd>The amount to offset the input graphic along the x-axis. The offset
edahlstr@0 2971 amount is expressed in the coordinate system established by attribute
edahlstr@0 2972 <a>'filter/primitiveUnits'</a> on the <a>'filter element'</a>
edahlstr@0 2973 element.<br />
edahlstr@0 2974 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 2975 <span class="attr-value">0</span> were specified.<br />
edahlstr@0 2976 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2977 <dt id="feOffsetDyAttribute"><span
edahlstr@0 2978 class="adef">dy</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 2979 <dd>The amount to offset the input graphic along the y-axis. The offset
edahlstr@0 2980 amount is expressed in the coordinate system established by attribute
edahlstr@0 2981 <a>'filter/primitiveUnits'</a> on the <a
edahlstr@0 2982 href="#FilterElement"><span class="element-name">'filter'</span></a>
edahlstr@0 2983 element.<br />
edahlstr@0 2984 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 2985 <span class="attr-value">0</span> were specified.<br />
edahlstr@0 2986 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 2987 </dl>
edahlstr@0 2988 </div>
edahlstr@0 2989
edahlstr@0 2990 <p><a href="#AnExample">The example</a> at the start of this chapter makes
edahlstr@0 2991 use of the <span class="element-name">feOffset</span> filter primitive to
edahlstr@0 2992 offset the drop shadow from the original source graphic.</p>
edahlstr@0 2993
edahlstr@0 2994 <h2 id="feSpecularLightingElement">Filter primitive <span
edahlstr@0 2995 class="element-name">'feSpecularLighting'</span></h2>
edahlstr@0 2996
edahlstr@0 2997 <edit:elementsummary name='feSpecularLighting'/>
edahlstr@0 2998
edahlstr@0 2999 <p>This filter primitive lights a source graphic using the alpha channel as a
edahlstr@0 3000 bump map. The resulting image is an RGBA image based on the light color. The
edahlstr@0 3001 lighting calculation follows the standard specular component of the Phong
edahlstr@0 3002 lighting model. The resulting image depends on the light color, light
edahlstr@0 3003 position and surface geometry of the input bump map. The result of the
edahlstr@0 3004 lighting calculation is added. The filter primitive assumes that the viewer
edahlstr@0 3005 is at infinity in the z direction (i.e., the unit vector in the eye direction
edahlstr@0 3006 is (0,0,1) everywhere).</p>
edahlstr@0 3007
edahlstr@0 3008 <p>This filter primitive produces an image which contains the specular
edahlstr@0 3009 reflection part of the lighting calculation. Such a map is intended to be
edahlstr@0 3010 combined with a texture using the <em>add</em> term of the
edahlstr@0 3011 <em>arithmetic</em> <a href="#feCompositeElement"><span
edahlstr@0 3012 class="element-name">'feComposite'</span></a> method. Multiple light sources
edahlstr@0 3013 can be simulated by adding several of these light maps before applying it to
edahlstr@0 3014 the texture image.</p>
edahlstr@0 3015
edahlstr@0 3016 <p>The resulting RGBA image is computed as follows:</p>
edahlstr@0 3017
edahlstr@0 3018 <p class="filterformula">S<sub>r</sub> = k<sub>s</sub> * pow(N.H,
edahlstr@0 3019 specularExponent) * L<sub>r<br />
edahlstr@0 3020 </sub> S<sub>g</sub> = k<sub>s</sub> * pow(N.H, specularExponent) *
edahlstr@0 3021 L<sub>g<br />
edahlstr@0 3022 </sub> S<sub>b</sub> = k<sub>s</sub> * pow(N.H, specularExponent) *
edahlstr@0 3023 L<sub>b<br />
edahlstr@0 3024 </sub> S<sub>a</sub> = max(S<sub>r,</sub> S<sub>g,</sub> S<sub>b</sub>)</p>
edahlstr@0 3025
edahlstr@0 3026 <p>where</p>
edahlstr@0 3027 <dl>
edahlstr@0 3028 <dd>k<sub>s</sub> = specular lighting constant<br />
edahlstr@0 3029 N = surface normal unit vector, a function of x and y<br />
edahlstr@0 3030 H = "halfway" unit vector between eye unit vector and light unit
edahlstr@0 3031 vector<br />
edahlstr@0 3032 <br />
edahlstr@0 3033 L<sub>r</sub>,L<sub>g</sub>,L<sub>b</sub> = RGB components of light</dd>
edahlstr@0 3034 </dl>
edahlstr@0 3035
edahlstr@0 3036 <p>See <a href="#feDiffuseLighting"><span
edahlstr@0 3037 class="element-name">'feDiffuseLighting'</span></a> for definition of N and
edahlstr@0 3038 (L<sub>r</sub>, L<sub>g</sub>, L<sub>b</sub>).</p>
edahlstr@0 3039
edahlstr@0 3040 <p>The definition of H reflects our assumption of the constant eye vector E =
edahlstr@0 3041 (0,0,1):</p>
edahlstr@0 3042
edahlstr@0 3043 <p class="filterformula">H = (L + E) / Norm(L+E)</p>
edahlstr@0 3044
edahlstr@0 3045 <p>where L is the light unit vector.</p>
edahlstr@0 3046
edahlstr@0 3047 <p>Unlike the <a href="#feDiffuseLighting"><span
edahlstr@0 3048 class="element-name">'feDiffuseLighting'</span></a>, the <span
edahlstr@0 3049 class="element-name">'feSpecularLighting'</span> filter produces a non-opaque
edahlstr@0 3050 image. This is due to the fact that the specular result
edahlstr@0 3051 (S<sub>r</sub>,S<sub>g</sub>,S<sub>b</sub>,S<sub>a</sub>) is meant to be
edahlstr@0 3052 added to the textured image. The alpha channel of the result is the max of
edahlstr@0 3053 the color components, so that where the specular light is zero, no additional
edahlstr@0 3054 coverage is added to the image and a fully white highlight will add
edahlstr@0 3055 opacity.</p>
edahlstr@0 3056
edahlstr@0 3057 <p>The <a href="#feDiffuseLighting"><span
edahlstr@0 3058 class="element-name">'feDiffuseLighting'</span></a> and <span
edahlstr@0 3059 class="element-name">'feSpecularLighting'</span> filters will often be
edahlstr@0 3060 applied together. An implementation may detect this and calculate both maps
edahlstr@0 3061 in one pass, instead of two.</p>
edahlstr@0 3062
edahlstr@0 3063 <div class="adef-list">
edahlstr@0 3064 <p><em>Attribute definitions:</em></p>
edahlstr@0 3065 <dl>
edahlstr@0 3066 <dt id="feSpecularLightingSurfaceScaleAttribute"><span
edahlstr@0 3067 class="adef">surfaceScale</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3068 <dd>height of surface when A<sub>in</sub> = 1.<br />
edahlstr@0 3069 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 3070 <span class="attr-value">1</span> were specified.<br />
edahlstr@0 3071 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 3072 <dt id="feSpecularLightingSpecularConstantAttribute"><span
edahlstr@0 3073 class="adef">specularConstant</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3074 <dd>ks in Phong lighting model. In SVG, this can be any non-negative
edahlstr@0 3075 number.<br />
edahlstr@0 3076 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 3077 <span class="attr-value">1</span> were specified.<br />
edahlstr@0 3078 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 3079 <dt id="feSpecularLightingSpecularExponentAttribute"><span
edahlstr@0 3080 class="adef">specularExponent</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3081 <dd>Exponent for specular term, larger is more "shiny". Range 1.0 to
edahlstr@0 3082 128.0.<br />
edahlstr@0 3083 If the attribute is not specified, then the effect is as if a value of
edahlstr@0 3084 <span class="attr-value">1</span> were specified.<br />
edahlstr@0 3085 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 3086 <dt id="feSpecularLightingKernelUnitLengthAttribute"><span
edahlstr@0 3087 class="adef">kernelUnitLength</span> = "<span
edahlstr@0 3088 class="attr-value"><a>&lt;number-optional-number&gt;</a></span>"</dt>
edahlstr@0 3089 <dd>The first number is the &lt;dx&gt; value. The second number is the
edahlstr@0 3090 &lt;dy&gt; value. If the &lt;dy&gt; value is not specified, it defaults
edahlstr@0 3091 to the same value as &lt;dx&gt;. Indicates the intended distance in
edahlstr@0 3092 current filter units (i.e., units as determined by the value of
edahlstr@0 3093 attribute <a>'filter/primitiveUnits'</a>) for <code>dx</code> and
edahlstr@0 3094 <code>dy</code>, respectively, in the <a
edahlstr@0 3095 href="#SurfaceNormalCalculations">surface normal calculation
edahlstr@0 3096 formulas</a>. By specifying value(s) for <span
edahlstr@0 3097 class="attr-name">kernelUnitLength</span>, the kernel becomes defined
edahlstr@0 3098 in a scalable, abstract coordinate system. If <span
edahlstr@0 3099 class="attr-name">kernelUnitLength</span> is not specified, the
edahlstr@0 3100 <code>dx</code> and <code>dy</code> values should represent very small
edahlstr@0 3101 deltas relative to a given <code>(x,y)</code> position, which might be
edahlstr@0 3102 implemented in some cases as one pixel in the intermediate image
edahlstr@0 3103 offscreen bitmap, which is a pixel-based coordinate system, and thus
edahlstr@0 3104 potentially not scalable. For some level of consistency across display
edahlstr@0 3105 media and user agents, it is necessary that a value be provided for at
edahlstr@0 3106 least one of <span class="attr-name">filterRes</span> and <span
edahlstr@0 3107 class="attr-name">kernelUnitLength</span>. Discussion of intermediate
edahlstr@0 3108 images are in the <a href="#Introduction">Introduction</a> and in the
ed@25 3109 description of attribute <a>'filter/filterRes'</a>.<br />
edahlstr@0 3110 If a negative or zero value is specified the default value will be used
edahlstr@0 3111 instead. <br />
edahlstr@0 3112 <span class="anim-target">Animatable: yes.</span></dd>
edahlstr@0 3113 </dl>
edahlstr@0 3114 </div>
edahlstr@0 3115
ed@25 3116 <p>The light source is defined by one of the child elements <a>'feDistantLight'</a>,
ed@25 3117 <a>'fePointLight'</a> or <a>'feDistantLight'</a>. The light color is
ed@25 3118 specified by property <a>'lighting-color'</a>.</p>
edahlstr@0 3119
edahlstr@0 3120 <p><a href="#AnExample">The example</a> at the start of this chapter makes
edahlstr@0 3121 use of the <span class="element-name">feSpecularLighting</span> filter
edahlstr@0 3122 primitive to achieve a highly reflective, 3D glowing effect.</p>
edahlstr@0 3123
edahlstr@0 3124 <h2 id="feTileElement">Filter primitive <span
edahlstr@0 3125 class="element-name">'feTile'</span></h2>
edahlstr@0 3126
edahlstr@0 3127 <edit:elementsummary name='feTile'/>
edahlstr@0 3128
edahlstr@0 3129 <p>This filter primitive fills a target rectangle with a repeated, tiled
edahlstr@0 3130 pattern of an input image.
ed@23 3131 The target rectangle is as large as the <a>filter primitive subregion</a> established
edahlstr@0 3132 by the <span class="element-name">'feTile'</span> element.
edahlstr@0 3133 </p>
edahlstr@0 3134
ed@23 3135 <p>Typically, the input image has been defined with its own <a>filter primitive subregion</a> in order to
edahlstr@0 3136 define a reference tile. <span class="element-name">'feTile'</span>
edahlstr@0 3137 replicates the reference tile in both X and Y to completely fill the target
edahlstr@0 3138 rectangle. The top/left corner of each given tile is at location
edahlstr@0 3139 <code>(x+i*width,y+j*height)</code>, where <code>(x,y)</code> represents the
ed@23 3140 top/left of the input image's <a>filter primitive subregion</a>, <code>width</code>
edahlstr@0 3141 and <code>height</code> represent the width and height of the input image's
ed@23 3142 <a>filter primitive subregion</a>, and <code>i</code> and <code>j</code> can be any
ed@23 3143 integer value. In most cases, the input image will have a smaller <a>filter
ed@23 3144 primitive subregion</a> than the <span class="element-name">'feTile'</span> in
edahlstr@0 3145 order to achieve a repeated pattern effect.</p>
edahlstr@0 3146
edahlstr@0 3147 <p class="requirement" id="assertTileArtifacts">Implementers must take appropriate measures in constructing the tiled
edahlstr@0 3148 image to avoid artifacts between tiles, particularly in situations where the
edahlstr@0 3149 user to device transform includes shear and/or rotation. Unless care is
edahlstr@0 3150 taken, interpolation can lead to edge pixels in the tile having opacity
edahlstr@0 3151 values lower or higher than expected due to the interaction of painting
edahlstr@0 3152 adjacent tiles which each have partial overlap with particular pixels.</p>
edahlstr@0 3153
edahlstr@0 3154 <div class="adef-list">
edahlstr@0 3155   </div>
edahlstr@0 3156
edahlstr@0 3157 <h2 id="feTurbulenceElement">Filter primitive <span
edahlstr@0 3158 class="element-name">'feTurbulence'</span></h2>
edahlstr@0 3159
edahlstr@0 3160 <edit:with element="feTurbulence">
edahlstr@0 3161
edahlstr@6 3162 <p class="specissue">ISSUE: Consider phasing out this C algorithm in favor of Simplex noise, which is more HW friendly.</p>
edahlstr@6 3163
edahlstr@0 3164 <p>This filter primitive creates an image using the Perlin turbulence
edahlstr@0 3165 function. It allows the synthesis of artificial textures like clouds or
edahlstr@0 3166 marble. For a detailed description the of the Perlin turbulence function, see
edahlstr@0 3167 "Texturing and Modeling", Ebert et al, AP Professional, 1994. The resulting
edahlstr@0 3168 image will fill the entire <a>filter primitive subregion</a> for this filter primitive.</p>
edahlstr@0 3169
edahlstr@0 3170 <p>It is possible to create bandwidth-limited noise by synthesizing only one
edahlstr@0 3171 octave.</p>
edahlstr@0 3172
ed@32 3173 <p>The C code below shows the exact algorithm used for this filter effect.
ed@32 3174 The <a>filter primitive subregion</a> is to be passed as the arguments fTileX,
ed@32 3175 fTileY, fTileWidth and fTileHeight.</p>
edahlstr@0 3176
edahlstr@0 3177 <p>For fractalSum, you get a turbFunctionResult that is aimed at a range of
edahlstr@0 3178 -1 to 1 (the actual result might exceed this range in some cases). To convert
edahlstr@0 3179 to a color value, use the formula <code>colorValue = ((turbFunctionResult *
edahlstr@0 3180 255) + 255) / 2</code>, then clamp to the range 0 to 255.</p>
edahlstr@0 3181
edahlstr@0 3182 <p>For turbulence, you get a turbFunctionResult that is aimed at a range of 0
edahlstr@0 3183 to 1 (the actual result might exceed this range in some cases). To convert to
edahlstr@0 3184 a color value, use the formula <code>colorValue = (turbFunctionResult *
edahlstr@0 3185 255)</code>, then clamp to the range 0 to 255.</p>
edahlstr@0 3186
edahlstr@0 3187 <p>The following order is used for applying the pseudo random numbers. An
edahlstr@0 3188 initial seed value is computed based on the <a>'seed'</a> attribute.
edahlstr@0 3189 Then the implementation computes the lattice
edahlstr@0 3190 points for R, then continues getting additional pseudo random numbers
edahlstr@0 3191 relative to the last generated pseudo random number and computes the lattice
edahlstr@0 3192 points for G, and so on for B and A.</p>
edahlstr@0 3193
edahlstr@0 3194 <p>The generated color and alpha values are in the color space determined by
edahlstr@0 3195 the <a>'color-interpolation-filters'</a> property:</p>
edahlstr@0 3196 <pre class="svgsamplecompressed">/* Produces results in the range [1, 2**31 - 2].
edahlstr@0 3197 Algorithm is: r = (a * r) mod m
edahlstr@0 3198 where a = 16807 and m = 2**31 - 1 = 2147483647
edahlstr@0 3199 See [Park &amp; Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988
edahlstr@0 3200 To test: the algorithm should produce the result 1043618065
edahlstr@0 3201 as the 10,000th generated number if the original seed is 1.
edahlstr@0 3202 */
edahlstr@0 3203 #define RAND_m 2147483647 /* 2**31 - 1 */
edahlstr@0 3204 #define RAND_a 16807 /* 7**5; primitive root of m */
edahlstr@0 3205 #define RAND_q 127773 /* m / a */
edahlstr@0 3206 #define RAND_r 2836 /* m % a */
edahlstr@0 3207 long setup_seed(long lSeed)
edahlstr@0 3208 {
edahlstr@0 3209 if (lSeed &lt;= 0) lSeed = -(lSeed % (RAND_m - 1)) + 1;
edahlstr@0 3210 if (lSeed &gt; RAND_m - 1) lSeed = RAND_m - 1;
edahlstr@0 3211 return lSeed;
edahlstr@0 3212 }
edahlstr@0 3213 long random(long lSeed)
edahlstr@0 3214 {
edahlstr@0 3215 long result;
edahlstr@0 3216 result = RAND_a * (lSeed % RAND_q) - RAND_r * (lSeed / RAND_q);
edahlstr@0 3217 if (result &lt;= 0) result += RAND_m;
edahlstr@0 3218 return result;
edahlstr@0 3219 }
edahlstr@0 3220 #define BSize 0x100
edahlstr@0 3221 #define BM 0xff
edahlstr@0 3222 #define PerlinN 0x1000
edahlstr@0 3223 #define NP 12 /* 2^PerlinN */
edahlstr@0 3224 #define NM 0xfff
edahlstr@0 3225 static uLatticeSelector[BSize + BSize + 2];
edahlstr@0 3226 static double fGradient[4][BSize + BSize + 2][2];
edahlstr@0 3227 struct StitchInfo
edahlstr@0 3228 {
edahlstr@0 3229 int nWidth; // How much to subtract to wrap for stitching.
edahlstr@0 3230 int nHeight;
edahlstr@0 3231 int nWrapX; // Minimum value to wrap.
edahlstr@0 3232 int nWrapY;
edahlstr@0 3233 };
edahlstr@0 3234 static void init(long lSeed)
edahlstr@0 3235 {
edahlstr@0 3236 double s;
edahlstr@0 3237 int i, j, k;
edahlstr@0 3238 lSeed = setup_seed(lSeed);
edahlstr@0 3239 for(k = 0; k &lt; 4; k++)
edahlstr@0 3240 {
edahlstr@0 3241 for(i = 0; i &lt; BSize; i++)
edahlstr@0 3242 {
edahlstr@0 3243 uLatticeSelector[i] = i;
edahlstr@0 3244 for (j = 0; j &lt; 2; j++)
edahlstr@0 3245 fGradient[k][i][j] = (double)(((lSeed = random(lSeed)) % (BSize + BSize)) - BSize) / BSize;
edahlstr@0 3246 s = double(sqrt(fGradient[k][i][0] * fGradient[k][i][0] + fGradient[k][i][1] * fGradient[k][i][1]));
edahlstr@0 3247 fGradient[k][i][0] /= s;
edahlstr@0 3248 fGradient[k][i][1] /= s;
edahlstr@0 3249 }
edahlstr@0 3250 }
edahlstr@0 3251 while(--i)
edahlstr@0 3252 {
edahlstr@0 3253 k = uLatticeSelector[i];
edahlstr@0 3254 uLatticeSelector[i] = uLatticeSelector[j = (lSeed = random(lSeed)) % BSize];
edahlstr@0 3255 uLatticeSelector[j] = k;
edahlstr@0 3256 }
edahlstr@0 3257 for(i = 0; i &lt; BSize + 2; i++)
edahlstr@0 3258 {
edahlstr@0 3259 uLatticeSelector[BSize + i] = uLatticeSelector[i];
edahlstr@0 3260 for(k = 0; k &lt; 4; k++)
edahlstr@0 3261 for(j = 0; j &lt; 2; j++)
edahlstr@0 3262 fGradient[k][BSize + i][j] = fGradient[k][i][j];
edahlstr@0 3263 }
edahlstr@0 3264 }
edahlstr@0 3265 #define s_curve(t) ( t * t * (3. - 2. * t) )
edahlstr@0 3266 #define lerp(t, a, b) ( a + t * (b - a) )
edahlstr@0 3267 double noise2(int nColorChannel, double vec[2], StitchInfo *pStitchInfo)
edahlstr@0 3268 {
edahlstr@0 3269 int bx0, bx1, by0, by1, b00, b10, b01, b11;
edahlstr@0 3270 double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
edahlstr@0 3271 register i, j;
edahlstr@0 3272 t = vec[0] + PerlinN;
edahlstr@0 3273 bx0 = (int)t;
edahlstr@0 3274 bx1 = bx0+1;
edahlstr@0 3275 rx0 = t - (int)t;
edahlstr@0 3276 rx1 = rx0 - 1.0f;
edahlstr@0 3277 t = vec[1] + PerlinN;
edahlstr@0 3278 by0 = (int)t;
edahlstr@0 3279 by1 = by0+1;
edahlstr@0 3280 ry0 = t - (int)t;
edahlstr@0 3281 ry1 = ry0 - 1.0f;
edahlstr@0 3282 // If stitching, adjust lattice points accordingly.
edahlstr@0 3283 if(pStitchInfo != NULL)
edahlstr@0 3284 {
edahlstr@0 3285 if(bx0 &gt;= pStitchInfo-&gt;nWrapX)
edahlstr@0 3286 bx0 -= pStitchInfo-&gt;nWidth;
edahlstr@0 3287 if(bx1 &gt;= pStitchInfo-&gt;nWrapX)
edahlstr@0 3288 bx1 -= pStitchInfo-&gt;nWidth;
edahlstr@0 3289 if(by0 &gt;= pStitchInfo-&gt;nWrapY)
edahlstr@0 3290 by0 -= pStitchInfo-&gt;nHeight;
edahlstr@0 3291 if(by1 &gt;= pStitchInfo-&gt;nWrapY)
edahlstr@0 3292 by1 -= pStitchInfo-&gt;nHeight;
edahlstr@0 3293 }
edahlstr@0 3294 bx0 &amp;= BM;
edahlstr@0 3295 bx1 &amp;= BM;
edahlstr@0 3296 by0 &amp;= BM;
edahlstr@0 3297 by1 &amp;= BM;
edahlstr@0 3298 i = uLatticeSelector[bx0];
edahlstr@0 3299 j = uLatticeSelector[bx1];
edahlstr@0 3300 b00 = uLatticeSelector[i + by0];
edahlstr@0 3301 b10 = uLatticeSelector[j + by0];
edahlstr@0 3302 b01 = uLatticeSelector[i + by1];
edahlstr@0 3303 b11 = uLatticeSelector[j + by1];
edahlstr@0 3304 sx = double(s_curve(rx0));
edahlstr@0 3305 sy = double(s_curve(ry0));
edahlstr@0 3306 q = fGradient[nColorChannel][b00]; u = rx0 * q[0] + ry0 * q[1];
edahlstr@0 3307 q = fGradient[nColorChannel][b10]; v = rx1 * q[0] + ry0 * q[1];
edahlstr@0 3308 a = lerp(sx, u, v);
edahlstr@0 3309 q = fGradient[nColorChannel][b01]; u = rx0 * q[0] + ry1 * q[1];
edahlstr@0 3310 q = fGradient[nColorChannel][b11]; v = rx1 * q[0] + ry1 * q[1];
edahlstr@0 3311 b = lerp(sx, u, v);
edahlstr@0 3312 return lerp(sy, a, b);
edahlstr@0 3313 }
ed@32 3314 double turbulence(int nColorChannel, double *point, double <a href="#feTurbulenceBaseFrequencyAttribute">fBaseFreqX</a>, double <a href="#feTurbulenceBaseFrequencyAttribute">fBaseFreqY</a>,
ed@32 3315 int <a href="#feTurbulenceNumOctavesAttribute">nNumOctaves</a>, bool bFractalSum, bool bDoStitching,
ed@32 3316 double <a href="#FilterPrimitiveSubRegion">fTileX</a>, double <a href="#FilterPrimitiveSubRegion">fTileY</a>, double <a href="#FilterPrimitiveSubRegion">fTileWidth</a>, double <a href="#FilterPrimitiveSubRegion">fTileHeight</a>)
edahlstr@0 3317 {
edahlstr@0 3318 StitchInfo stitch;
edahlstr@0 3319 StitchInfo *pStitchInfo = NULL; // Not stitching when NULL.
edahlstr@0 3320 // Adjust the base frequencies if necessary for stitching.
edahlstr@0 3321 if(bDoStitching)
edahlstr@0 3322 {
edahlstr@0 3323 // When stitching tiled turbulence, the frequencies must be adjusted
edahlstr@0 3324 // so that the tile borders will be continuous.
edahlstr@0 3325 if(fBaseFreqX != 0.0)
edahlstr@0 3326 {
edahlstr@0 3327 double fLoFreq = double(floor(fTileWidth * fBaseFreqX)) / fTileWidth;
edahlstr@0 3328 double fHiFreq = double(ceil(fTileWidth * fBaseFreqX)) / fTileWidth;
edahlstr@0 3329 if(fBaseFreqX / fLoFreq &lt; fHiFreq / fBaseFreqX)
edahlstr@0 3330 fBaseFreqX = fLoFreq;
edahlstr@0 3331 else
edahlstr@0 3332 fBaseFreqX = fHiFreq;
edahlstr@0 3333 }
edahlstr@0 3334 if(fBaseFreqY != 0.0)
edahlstr@0 3335 {
edahlstr@0 3336 double fLoFreq = double(floor(fTileHeight * fBaseFreqY)) / fTileHeight;
edahlstr@0 3337 double fHiFreq = double(ceil(fTileHeight * fBaseFreqY)) / fTileHeight;
edahlstr@0 3338 if(fBaseFreqY / fLoFreq &lt; fHiFreq / fBaseFreqY)
edahlstr@0 3339 fBaseFreqY = fLoFreq;
edahlstr@0 3340 else
edahlstr@0 3341 fBaseFreqY = fHiFreq;
edahlstr@0 3342 }
edahlstr@0 3343 // Set up initial stitch values.
edahlstr@0 3344 pStitchInfo = &amp;stitch;
edahlstr@0 3345 stitch.nWidth = int(fTileWidth * fBaseFreqX + 0.5f);
edahlstr@0 3346 stitch.nWrapX = fTileX * fBaseFreqX + PerlinN + stitch.nWidth;
edahlstr@0 3347 stitch.nHeight = int(fTileHeight * fBaseFreqY + 0.5f);
edahlstr@0 3348 stitch.nWrapY = fTileY * fBaseFreqY + PerlinN + stitch.nHeight;
edahlstr@0 3349 }
edahlstr@0 3350 double fSum = 0.0f;
edahlstr@0 3351 double vec[2];
edahlstr@0 3352 vec[0] = point[0] * fBaseFreqX;
edahlstr@0 3353 vec[1] = point[1] * fBaseFreqY;
edahlstr@0 3354 double ratio = 1;
edahlstr@0 3355 for(int nOctave = 0; nOctave &lt; nNumOctaves; nOctave++)
edahlstr@0 3356 {
edahlstr@0 3357 if(bFractalSum)
edahlstr@0 3358 fSum += double(noise2(nColorChannel, vec, pStitchInfo) / ratio);
edahlstr@0 3359 else
edahlstr@0 3360 fSum += double(fabs(noise2(nColorChannel, vec, pStitchInfo)) / ratio);
edahlstr@0 3361 vec[0] *= 2;
edahlstr@0 3362 vec[1] *= 2;
edahlstr@0 3363 ratio *= 2;
edahlstr@0 3364 if(pStitchInfo != NULL)
edahlstr@0 3365 {
edahlstr@0 3366 // Update stitch values. Subtracting PerlinN before the multiplication and
edahlstr@0 3367 // adding it afterward simplifies to subtracting it once.
edahlstr@0 3368 stitch.nWidth *= 2;
edahlstr@0 3369 stitch.nWrapX = 2 * stitch.nWrapX - PerlinN;
edahlstr@0 3370 stitch.nHeight *= 2;
edahlstr@0 3371 stitch.nWrapY = 2 * stitch.nWrapY - PerlinN;
edahlstr@0 3372 }
edahlstr@0 3373 }
edahlstr@0 3374 return fSum;
edahlstr@0 3375 }</pre>
edahlstr@0 3376
edahlstr@0 3377 <div class="adef-list">
edahlstr@0 3378 <p><em>Attribute definitions:</em></p>
edahlstr@0 3379 <dl>
edahlstr@0 3380 <dt id="feTurbulenceBaseFrequencyAttribute"><span
edahlstr@0 3381 class="adef">baseFrequency</span> =
edahlstr@0 3382 "<em><a>&lt;number-optional-number&gt;</a></em>"</dt>
edahlstr@0 3383 <dd>
dino@13 3384 <p>The base frequency (frequencies) parameter(s) for the noise function.
edahlstr@0 3385 If two <a>&lt;number&gt;</a>s are provided, the first number represents a base frequency in the X
edahlstr@0 3386 direction and the second value represents a base frequency in the Y
edahlstr@0 3387 direction. If one number is provided, then that value is used for both
edahlstr@0 3388 X and Y.</p>
dino@13 3389 <p>The <a>lacuna value</a> for <a>'baseFrequency'</a> is <span class="attr-value">0</span>.</p>
dino@13 3390 <p>Negative values are <a>unsupported</a>.</p>
dino@13 3391 <p><span class="anim-target">Animatable: yes.</span></p>
edahlstr@0 3392 </dd>
edahlstr@0 3393 <dt id="feTurbulenceNumOctavesAttribute"><span
edahlstr@0 3394 class="adef">numOctaves</span> = "<em><a>&lt;integer&gt;</a></em>"</dt>
edahlstr@0 3395 <dd>
dino@13 3396 <p>The numOctaves parameter for the noise function.</p>
dino@13 3397 <p><span class="requirement" id="assert_turbulenceNumOctavesLacunaValue">The <a>lacuna value</a> for <a>'numOctaves'</a> is <span class="attr-value">1</span>.</span></p>
dino@13 3398 <p><span class="requirement" id="assert_turbulenceNumOctavesUnsupportedValue">Negative values are <a>unsupported</a>.</span></p>
dino@13 3399 <p><span class="requirement" id="assert_turbulenceNumOctavesAnimatable"><span class="anim-target">Animatable: yes.</span></span></p>
dino@13 3400 </dd>
edahlstr@0 3401 <dt id="feTurbulenceSeedAttribute">
edahlstr@0 3402 <span class="adef">seed</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3403 <dd>
dino@13 3404 <p>The starting number for the pseudo random number generator.</p>
dino@13 3405 <p><span class="requirement" id="assert_turbulenceSeedLacunaValue">The <a>lacuna value</a> for <a>'seed'</a> is <span class="attr-value">0</span>.</span></p>
dino@13 3406 <p><span class="requirement" id="assert_turbulenceSeedTruncation">When the seed number is handed over to the algorithm above it must first be
dino@13 3407 truncated, i.e. rounded to the closest integer value towards zero.</span></p>
dino@13 3408 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3409 </dd>
edahlstr@0 3410 <dt id="feTurbulenceStitchTilesAttribute"><span
edahlstr@0 3411 class="adef">stitchTiles</span> = "<em>stitch | noStitch</em>"</dt>
edahlstr@0 3412 <dd>
dino@13 3413 <p>If <span class="attr-value">stitchTiles="noStitch"</span>, no attempt
edahlstr@0 3414 it made to achieve smooth transitions at the border of tiles which
edahlstr@0 3415 contain a turbulence function. Sometimes the result will show clear
edahlstr@0 3416 discontinuities at the tile borders.<br />
edahlstr@0 3417 If <span class="attr-value">stitchTiles="stitch"</span>, then the user
edahlstr@0 3418 agent will automatically adjust baseFrequency-x and baseFrequency-y
edahlstr@0 3419 values such that the <a>'feTurbulence'</a> node's width and height (i.e., the
edahlstr@0 3420 width and height of the current subregion) contains an integral number
edahlstr@0 3421 of the Perlin tile width and height for the first octave. The
edahlstr@0 3422 baseFrequency will be adjusted up or down depending on which way has
edahlstr@0 3423 the smallest relative (not absolute) change as follows: Given the
edahlstr@0 3424 frequency, calculate <code>lowFreq=floor(width*frequency)/width</code>
edahlstr@0 3425 and <code>hiFreq=ceil(width*frequency)/width</code>. If
edahlstr@0 3426 frequency/lowFreq &lt; hiFreq/frequency then use lowFreq, else use
edahlstr@0 3427 hiFreq. While generating turbulence values, generate lattice vectors as
edahlstr@0 3428 normal for Perlin Noise, except for those lattice points that lie on
edahlstr@0 3429 the right or bottom edges of the active area (the size of the resulting
edahlstr@0 3430 tile). In those cases, copy the lattice vector from the opposite edge
edahlstr@0 3431 of the active area.</p>
ed@17 3432 <p><span class="requirement" id="assert_turbulenceStitchTilesLacunaValue">The <a>lacuna value</a> for <a>'stitchTiles'</a> is <span class="attr-value">noStitch</span>.</span></p>
edahlstr@0 3433 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3434 </dd>
edahlstr@0 3435 <dt id="feTurbulenceTypeAttribute">
edahlstr@0 3436 <span class="adef">type</span> = "<em>fractalNoise | turbulence</em>"</dt>
edahlstr@0 3437 <dd>
dino@13 3438 <p>Indicates whether the filter primitive should perform a noise or
edahlstr@0 3439 turbulence function.</p>
ed@17 3440 <p><span class="requirement" id="assert_turbulenceTypeLacunaValue">The <a>lacuna value</a> for <a>'type'</a> is <span class="attr-value">turbulence</span>.</span></p>
dino@13 3441 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3442 </dd>
edahlstr@0 3443 </dl>
edahlstr@0 3444 </div>
edahlstr@0 3445
edahlstr@0 3446 <edit:example href="examples/feTurbulence.svg" image="yes" link="yes"/>
edahlstr@0 3447 </edit:with>
edahlstr@0 3448
edahlstr@0 3449 <h2 id="feDropShadowElement">Filter primitive <span
edahlstr@0 3450 class="element-name">'feDropShadow'</span></h2>
edahlstr@0 3451
edahlstr@0 3452 <edit:elementsummary name='feDropShadow'/>
edahlstr@0 3453
edahlstr@0 3454 <p>This filter creates a drop shadow of the input image. It is a shorthand
edahlstr@0 3455 filter, and is defined in terms of combinations of other <a>filter primitives</a>.
edahlstr@0 3456 The expectation is that it can be optimized more easily by
edahlstr@0 3457 implementations.</p>
edahlstr@0 3458
edahlstr@0 3459 <p>The result of a <a>'feDropShadow'</a> filter
edahlstr@0 3460 primitive is equivalent to the following:
edahlstr@0 3461
edahlstr@0 3462 <pre class="examplesource">
edahlstr@0 3463 &lt;feGaussianBlur in="<b>alpha-channel-of-feDropShadow-in</b>" stdDeviation="<b>stdDeviation-of-feDropShadow</b>"/&gt;
edahlstr@0 3464 &lt;feOffset dx="<b>dx-of-feDropShadow</b>" dy="<b>dy-of-feDropShadow</b>" result="offsetblur"/&gt;
edahlstr@0 3465 &lt;feFlood flood-color="<b>flood-color-of-feDropShadow</b>" flood-opacity="<b>flood-opacity-of-feDropShadow</b>"/&gt;
edahlstr@0 3466 &lt;feComposite in2="offsetblur" operator="in"/&gt;
edahlstr@0 3467 &lt;feMerge&gt;
edahlstr@0 3468 &lt;feMergeNode/&gt;
edahlstr@0 3469 &lt;feMergeNode in="<b>in-of-feDropShadow</b>"/&gt;
edahlstr@0 3470 &lt;/feMerge&gt;
edahlstr@0 3471 </pre>
edahlstr@0 3472 </p>
edahlstr@0 3473
edahlstr@0 3474 <p>
edahlstr@0 3475 The above divided into steps:
edahlstr@0 3476 <ol>
edahlstr@0 3477 <li>Take the alpha channel of the input to the <a>'feDropShadow'</a> filter primitive and the <a>'feDropShadow/stdDeviation'</a> on the <a>'feDropShadow'</a> and do processing as if the
edahlstr@0 3478 following <a>'feGaussianBlur'</a> was applied:
dino@13 3479 <pre class="examplesource"> &lt;feGaussianBlur in="<b>alpha-channel-of-feDropShadow-in</b>" stdDeviation="<b>stdDeviation-of-feDropShadow</b>"/&gt;</pre>
edahlstr@0 3480 <br />
edahlstr@0 3481 </li>
edahlstr@0 3482 <li>Offset the result of step 1 by <a>'feDropShadow/dx'</a> and <a>'feDropShadow/dy'</a> as
edahlstr@0 3483 specified on the <a>'feDropShadow'</a>
edahlstr@0 3484 element, equivalent to applying an <a>'feOffset'</a> with these parameters:
dino@13 3485 <pre class="examplesource"> &lt;feOffset dx="<b>dx-of-feDropShadow</b>" dy="<b>dy-of-feDropShadow</b>" result="offsetblur"/&gt;</pre>
edahlstr@0 3486 <br />
edahlstr@0 3487 </li>
edahlstr@0 3488 <li>Do processing as if an <a>'feFlood'</a> element with <a>'flood-color'</a> and
dino@13 3489 <a>'flood-opacity'</a> as specified on the <a>'feDropShadow'</a> was applied:
dino@13 3490 <pre class="examplesource"> &lt;feFlood flood-color="<b>flood-color-of-feDropShadow</b>" flood-opacity="<b>flood-opacity-of-feDropShadow</b>"/&gt;</pre>
edahlstr@0 3491 <br />
edahlstr@0 3492 </li>
edahlstr@0 3493 <li>Composite the result of the <a href="#feFloodElement"><span
edahlstr@0 3494 class="element-name">'feFlood'</span></a> in step 3 with the result of
edahlstr@0 3495 the <a href="#feOffsetElement"><span
edahlstr@0 3496 class="element-name">'feOffset'</span></a> in step 2 as if an <a>'feComposite'</a> filter primitive with <a
edahlstr@0 3497 href="#feCompositeOperatorAttribute"><span
edahlstr@0 3498 class="attr-name">operator</span></a>='in' was applied:
dino@13 3499 <pre class="examplesource"> &lt;feComposite in2="offsetblur" operator="in"/&gt;</pre>
edahlstr@0 3500 <br />
edahlstr@0 3501 </li>
edahlstr@0 3502 <li>Finally merge the result of the previous step, doing processing as if
edahlstr@0 3503 the following <a>'feMerge'</a> was performed:
dino@13 3504 <pre class="examplesource"> &lt;feMerge&gt;
dino@13 3505 &lt;feMergeNode/&gt;
dino@13 3506 &lt;feMergeNode in="<b>in-of-feDropShadow</b>"/&gt;
dino@13 3507 &lt;/feMerge&gt;</pre>
edahlstr@0 3508 </li>
edahlstr@0 3509 </ol>
edahlstr@0 3510 </p>
edahlstr@0 3511
edahlstr@0 3512 <p class="note implementation">Note that while the definition of the <span
edahlstr@0 3513 class="element-name">'feDropShadow'</span> filter primitive says that it can
edahlstr@0 3514 be expanded into an equivalent tree it is not required that it is implemented
edahlstr@0 3515 like that. The expectation is that user agents can optimize the handling by not having to do all the steps separately.
edahlstr@0 3516 </p>
edahlstr@0 3517
edahlstr@0 3518 <p>Beyond the DOM interface <a
edahlstr@0 3519 href="#InterfaceSVGFEDropShadowElement">SVGFEDropShadowElement</a> there is no way
edahlstr@0 3520 of accessing the internals of the <a>'feDropShadow'</a> filter primitive, meaning <span class="requirement" id="assert_dropShadowShadowTrees">if the
edahlstr@0 3521 filter primitive is implemented as an equivalent tree then that tree must not
edahlstr@0 3522 be exposed to the DOM.</span> </p>
edahlstr@0 3523
edahlstr@0 3524 <div class="adef-list">
edahlstr@0 3525 <p><em>Attribute definitions:</em></p>
edahlstr@0 3526 <dl>
edahlstr@0 3527 <dt id="feDropShadowDxAttribute">
edahlstr@0 3528 <span class="adef">dx</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3529 <dd>
dino@13 3530 <p>The x offset of the drop shadow.</p>
dino@13 3531 <p>The <a>lacuna value</a> for <a>'feDropShadow/dx'</a> is <span class="attr-value">2</span>.</p>
dino@13 3532 <p>This attribute is then forwarded to the <a>'feOffset/dx'</a> attribute of the internal <a>'feOffset'</a> element.</p>
dino@13 3533 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3534 </dd>
edahlstr@0 3535 <dt id="feDropShadowDyAttribute">
edahlstr@0 3536 <span class="adef">dy</span> = "<em><a>&lt;number&gt;</a></em>"</dt>
edahlstr@0 3537 <dd>
dino@13 3538 <p>The y offset of the drop shadow.</p>
dino@13 3539 <p>The <a>lacuna value</a> for <a>'feDropShadow/dy'</a> is <span class="attr-value">2</span>. </p>
dino@13 3540 <p>This attribute is then forwarded to the <a>'feOffset/dy'</a> attribute of the internal <a>'feOffset'</a> element.</p>
dino@13 3541 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3542 </dd>
edahlstr@0 3543 <dt id="feDropShadowStdDeviationAttribute"><span
edahlstr@0 3544 class="adef">stdDeviation</span> =
edahlstr@0 3545 "<em><a>&lt;number-optional-number&gt;</a></em>"</dt>
edahlstr@0 3546 <dd>
dino@13 3547 <p>The standard deviation for the blur operation in the drop shadow.</p>
dino@13 3548 <p>The <a>lacuna value</a> for <a>'feDropShadow/stdDeviation'</a> is <span class="attr-value">2</span>.</p>
dino@13 3549 <p>This attribute is then forwarded to the <a>'feGaussianBlur/stdDeviation'</a> attribute of the internal
dino@13 3550 <a>'feGaussianBlur'</a> element.</p>
dino@13 3551 <p><span class="anim-target">Animatable: yes.</span></p>
dino@13 3552 </dd>
edahlstr@0 3553 </dl>
edahlstr@0 3554 </div>
edahlstr@0 3555
edahlstr@0 3556 <div class="note">
edahlstr@0 3557 <h2 id="feDiffuseSpecularElement">Filter primitive <span
edahlstr@0 3558 class="element-name">'feDiffuseSpecular'</span></h2>
dino@33 3559 The WG is looking at providing a shorthand for diffuse+specular.
edahlstr@0 3560 </div>
edahlstr@0 3561
edahlstr@0 3562 <div class="note">
edahlstr@0 3563 <h2 id="feCustomElement">Filter primitive <span
edahlstr@0 3564 class="element-name">'feCustom'</span></h2>
dino@33 3565 The WG is considering a proposal to add a filter primitive that would reference a
dino@33 3566 programmable operation, similar to an OpenCL kernel or GLSL fragment shader. At
dino@33 3567 this time, the WG is intending to <strong>not</strong> include such a feature
dino@33 3568 in the current version of this specification. If you feel it is necessary, please
dino@33 3569 submit feedback to the WG (by email, described in the introduction) with your
dino@33 3570 reasons and, preferably, use cases.
edahlstr@0 3571 </div>
edahlstr@0 3572
dino@33 3573 <h2 id="FilterCSSImageValue">The filter CSS &lt;image&gt; value</h2>
dino@33 3574
dino@33 3575 <p>
dino@33 3576 The filter() function produces a CSS &lt;image&gt; value. It has the following syntax:
dino@33 3577 </p>
dino@33 3578
dino@33 3579 <h4 class='no-toc' id='filter-syntax'>
dino@33 3580 filter() syntax</h4>
dino@33 3581
dino@33 3582 <pre class='prod'><code><dfn>&lt;filter></dfn> = filter(
dino@33 3583 &lt;image>,
dino@33 3584 none | &lt;filter-function&gt; [ &lt;filter-function&gt; ]*
dino@33 3585 )
dino@33 3586 </code></pre>
dino@33 3587
dino@33 3588 <p>
dino@33 3589 The function takes two parameters. The first is a CSS &lt;image&gt; value. The second
dino@33 3590 is the value of a <span class="prop-name">filter</span> property. The function take the
dino@33 3591 input image parameter and apply the filter rules, returning a processing image.
dino@33 3592 </p>
dino@33 3593
edahlstr@4 3594 <h2 id="RelaxNG">RelaxNG Schema for Filter Effects 1.0</h2>
edahlstr@4 3595
edahlstr@4 3596 <p>The schema for Filter Effects 1.0 is written in <a
edahlstr@0 3597 href="http://www.y12.doe.gov/sgml/sc34/document/0362_files/relaxng-is.pdf">RelaxNG</a>
edahlstr@0 3598 [<a href="#ref-RNG">RelaxNG</a>], a namespace-aware schema language that uses
edahlstr@0 3599 the datatypes from <a
edahlstr@0 3600 href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">XML Schema Part
edahlstr@0 3601 2</a> [<a href="#ref-Schema2">Schema2</a>]. This allows namespaces and
edahlstr@0 3602 modularity to be much more naturally expressed than using DTD syntax. The
edahlstr@4 3603 RelaxNG schema for Filter Effects 1.0 may be imported by other RelaxNG schemas,
edahlstr@0 3604 or combined with other schemas in other languages into a multi-namespace,
edahlstr@0 3605 multi-grammar schema using <a
edahlstr@0 3606 href="http://www.asahi-net.or.jp/~eb2m-mrt/dsdl/">Namespace-based Validation
edahlstr@0 3607 Dispatching Language</a> [<a href="#ref-NVDL">NVDL</a>].</p>
edahlstr@0 3608
edahlstr@0 3609 <p>Unlike a DTD, the schema used for validation is not hardcoded into the
edahlstr@0 3610 document instance. There is no equivalent to the DOCTYPE declaration. Simply
edahlstr@0 3611 point your editor or other validation tool to the IRI of the schema (or your
edahlstr@0 3612 local cached copy, as you prefer).</p>
edahlstr@0 3613
edahlstr@0 3614 <p>
edahlstr@0 3615 The RNG is under construction, and only the individual RNG snippets are available at this time. They have not yet been integrated into a functional schema. The individual RNG files are available <a href="rng">here</a>.
edahlstr@0 3616 </p>
edahlstr@0 3617
dino@13 3618
ed@14 3619 <h2 id="ShorthandEquivalents">Shorthands defined in terms of the <span class="element-name">'filter'</span> element</h2>
dino@13 3620
dino@13 3621 <p>
dino@13 3622 Below are the equivalents for each of the filter functions expressed in terms of
dino@13 3623 the 'filter element' element. The parameters from the function are labelled with
dino@13 3624 brackets in the following style: [amount].
dino@13 3625 </p>
dino@13 3626
dino@13 3627 <h3 id="grayscaleEquivalent">grayscale</h3>
dino@13 3628
dino@13 3629 <pre class="examplesource"> &lt;filter id="grayscale"&gt;
dino@13 3630 &lt;feColorMatrix type="matrix"
dino@36 3631 values="(0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
dino@36 3632 (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
dino@36 3633 (0.2127 * [amount]) (0.7152 * [amount]) (0.0722 * [amount]) 0 0
dino@13 3634 0 0 0 1 0"/&gt;
dino@13 3635 &lt;/filter&gt; </pre>
dino@13 3636
dino@13 3637 <h3 id="sepiaEquivalent">sepia</h3>
dino@13 3638
dino@13 3639 <pre class="examplesource"> &lt;filter id="sepia"&gt;
dino@13 3640 &lt;feColorMatrix type="matrix"
dino@13 3641 values="(0.393 * [amount]) (0.769 * [amount]) (0.189 * [amount]) 0 0
dino@13 3642 (0.349 * [amount]) (0.686 * [amount]) (0.168 * [amount]) 0 0
dino@13 3643 (0.272 * [amount]) (0.534 * [amount]) (0.131 * [amount]) 0 0
dino@13 3644 0 0 0 1 0"/&gt;
dino@13 3645 &lt;/filter&gt; </pre>
dino@13 3646
dino@13 3647 <h3 id="saturateEquivalent">saturate</h3>
dino@13 3648
dino@13 3649 <pre class="examplesource"> &lt;filter id="saturate"&gt;
dino@13 3650 &lt;feColorMatrix type="saturate"
dino@13 3651 values="(1 - [amount])"/&gt;
dino@13 3652 &lt;/filter&gt; </pre>
dino@13 3653
dino@13 3654 <h3 id="huerotateEquivalent">hue-rotate</h3>
dino@13 3655
dino@13 3656 <pre class="examplesource"> &lt;filter id="hue-rotate"&gt;
dino@13 3657 &lt;feColorMatrix type="hueRotate"
dino@13 3658 values="[angle]"/&gt;
dino@13 3659 &lt;/filter&gt; </pre>
dino@13 3660
dino@13 3661 <h3 id="invertEquivalent">invert</h3>
dino@13 3662
dino@13 3663 <pre class="examplesource"> &lt;filter id="invert"&gt;
dino@13 3664 &lt;feComponentTransfer&gt;
dino@13 3665 &lt;feFuncR type="table" tableValues="[amount] (1 - [amount])"/&gt;
dino@13 3666 &lt;feFuncG type="table" tableValues="[amount] (1 - [amount])"/&gt;
dino@13 3667 &lt;feFuncB type="table" tableValues="[amount] (1 - [amount])"/&gt;
dino@13 3668 &lt;/feComponentTransfer&gt;
dino@13 3669 &lt;/filter&gt; </pre>
dino@13 3670
dino@36 3671 <h3 id="opacityEquivalent">opacity</h3>
dino@36 3672
dino@36 3673 <pre class="examplesource"> &lt;filter id="opacity"&gt;
dino@36 3674 &lt;feComponentTransfer&gt;
dino@36 3675 &lt;feFuncA type="table" tableValues="0 [amount]"/&gt;
dino@36 3676 &lt;/feComponentTransfer&gt;
dino@36 3677 &lt;/filter&gt; </pre>
dino@36 3678
dino@13 3679 <h3 id="gammaEquivalent">gamma</h3>
dino@13 3680
dino@13 3681 <pre class="examplesource"> &lt;filter id="gamma"&gt;
dino@13 3682 &lt;feComponentTransfer&gt;
dino@13 3683 &lt;feFuncR type="gamma" amplitude="[amplitude]" exponent="[exponent]" offset="[offset]"/&gt;
dino@13 3684 &lt;feFuncG type="gamma" amplitude="[amplitude]" exponent="[exponent]" offset="[offset]"/&gt;
dino@13 3685 &lt;feFuncB type="gamma" amplitude="[amplitude]" exponent="[exponent]" offset="[offset]"/&gt;
dino@13 3686 &lt;/feComponentTransfer&gt;
dino@13 3687 &lt;/filter&gt; </pre>
dino@13 3688
dino@13 3689 <h3 id="blurEquivalent">blur</h3>
dino@13 3690
dino@13 3691 <pre class="examplesource"> &lt;filter id="blur"&gt;
dino@13 3692 &lt;feGaussianBlur stdDeviation="[radiusX radiusY]"&gt;
dino@13 3693 &lt;/filter&gt; </pre>
dino@13 3694
dino@34 3695 <h3 id="sharpenEquivalent">sharpen</h3>
dino@13 3696
dino@13 3697 <pre class="examplesource"> &lt;filter id="unsharp"&gt;
dino@13 3698 &lt;feUnsharpMask stdDeviation="[radius]" threshold="[threshold]" amount="[amount]"&gt;
dino@13 3699 &lt;/filter&gt; </pre>
dino@13 3700
dino@33 3701 <h3 id="dropshadowEquivalent">drop-shadow</h3>
dino@33 3702
dino@33 3703 <pre class="examplesource"> &lt;filter id="drop-shadow"&gt;
dino@33 3704 &lt;feGaussianBlur in="[alpha-channel-of-input]" stdDeviation="[radius]"/&gt;
dino@33 3705 &lt;feOffset dx="[offset-x]" dy="[offset-y]" result="offsetblur"/&gt;
dino@33 3706 &lt;feFlood flood-color="[color]"/&gt;
dino@33 3707 &lt;feComposite in2="offsetblur" operator="in"/&gt;
dino@33 3708 &lt;feMerge&gt;
dino@33 3709 &lt;feMergeNode/&gt;
dino@33 3710 &lt;feMergeNode in="input-image"/&gt;
dino@33 3711 &lt;/feMerge&gt;
dino@33 3712 &lt;/filter&gt; </pre>
dino@33 3713
edahlstr@0 3714 <h2 id="DOMInterfaces">DOM interfaces</h2>
dino@13 3715
edahlstr@0 3716 <div class="note">
edahlstr@0 3717 The interfaces below will be made available in a IDL file for an upcoming draft.
edahlstr@0 3718 </div>
edahlstr@0 3719
edahlstr@0 3720 <h3 id="InterfaceImageData">Interface ImageData</h3>
edahlstr@0 3721
edahlstr@0 3722 <edit:interface name='::svg::ImageData'/>
edahlstr@0 3723
edahlstr@0 3724 <h3 id="InterfaceSVGFilterElement">Interface SVGFilterElement</h3>
edahlstr@0 3725
edahlstr@0 3726 <edit:with element='filter'>
edahlstr@0 3727 <edit:interface name='::svg::SVGFilterElement'/>
edahlstr@0 3728 </edit:with>
edahlstr@0 3729
edahlstr@0 3730 <h3 id="InterfaceSVGFilterPrimitiveStandardAttributes">Interface SVGFilterPrimitiveStandardAttributes</h3>
edahlstr@0 3731
edahlstr@0 3732 <edit:with element='feTile'>
edahlstr@0 3733 <edit:interface name='::svg::SVGFilterPrimitiveStandardAttributes'/>
edahlstr@0 3734 </edit:with>
edahlstr@0 3735
edahlstr@0 3736 <h3 id="InterfaceSVGFEBlendElement">Interface SVGFEBlendElement</h3>
edahlstr@0 3737
edahlstr@0 3738 <edit:with element='feBlend'>
edahlstr@0 3739 <edit:interface name='::svg::SVGFEBlendElement'/>
edahlstr@0 3740 </edit:with>
edahlstr@0 3741
edahlstr@0 3742 <h3 id="InterfaceSVGFEColorMatrixElement">Interface SVGFEColorMatrixElement</h3>
edahlstr@0 3743
edahlstr@0 3744 <edit:with element='feColorMatrix'>
edahlstr@0 3745 <edit:interface name='::svg::SVGFEColorMatrixElement'/>
edahlstr@0 3746 </edit:with>
edahlstr@0 3747
edahlstr@0 3748 <h3 id="InterfaceSVGFEComponentTransferElement">Interface SVGFEComponentTransferElement</h3>
edahlstr@0 3749
edahlstr@0 3750 <edit:with element='feComponentTransfer'>
edahlstr@0 3751 <edit:interface name='::svg::SVGFEComponentTransferElement'/>
edahlstr@0 3752 </edit:with>
edahlstr@0 3753
edahlstr@0 3754 <h3 id="InterfaceSVGComponentTransferFunctionElement">Interface SVGComponentTransferFunctionElement</h3>
edahlstr@0 3755
edahlstr@0 3756 <edit:with element='feFuncR'>
edahlstr@0 3757 <edit:interface name='::svg::SVGComponentTransferFunctionElement'/>
edahlstr@0 3758 </edit:with>
edahlstr@0 3759
edahlstr@0 3760 <h3 id="InterfaceSVGFEFuncRElement">Interface SVGFEFuncRElement</h3>
edahlstr@0 3761
edahlstr@0 3762 <edit:with element='feFuncR'>
edahlstr@0 3763 <edit:interface name='::svg::SVGFEFuncRElement'/>
edahlstr@0 3764 </edit:with>
edahlstr@0 3765
edahlstr@0 3766 <h3 id="InterfaceSVGFEFuncGElement">Interface SVGFEFuncGElement</h3>
edahlstr@0 3767
edahlstr@0 3768 <edit:with element='feFuncG'>
edahlstr@0 3769 <edit:interface name='::svg::SVGFEFuncGElement'/>
edahlstr@0 3770 </edit:with>
edahlstr@0 3771
edahlstr@0 3772 <h3 id="InterfaceSVGFEFuncBElement">Interface SVGFEFuncBElement</h3>
edahlstr@0 3773
edahlstr@0 3774 <edit:with element='feFuncB'>
edahlstr@0 3775 <edit:interface name='::svg::SVGFEFuncBElement'/>
edahlstr@0 3776 </edit:with>
edahlstr@0 3777
edahlstr@0 3778 <h3 id="InterfaceSVGFEFuncAElement">Interface SVGFEFuncAElement</h3>
edahlstr@0 3779
edahlstr@0 3780 <edit:with element='feFuncA'>
edahlstr@0 3781 <edit:interface name='::svg::SVGFEFuncAElement'/>
edahlstr@0 3782 </edit:with>
edahlstr@0 3783
edahlstr@0 3784 <h3 id="InterfaceSVGFECompositeElement">Interface SVGFECompositeElement</h3>
edahlstr@0 3785
edahlstr@0 3786 <edit:with element='feComposite'>
edahlstr@0 3787 <edit:interface name='::svg::SVGFECompositeElement'/>
edahlstr@0 3788 </edit:with>
edahlstr@0 3789
edahlstr@0 3790 <h3 id="InterfaceSVGFEConvolveMatrixElement">Interface SVGFEConvolveMatrixElement</h3>
edahlstr@0 3791
edahlstr@0 3792 <edit:with element='feConvolveMatrix'>
edahlstr@0 3793 <edit:interface name='::svg::SVGFEConvolveMatrixElement'/>
edahlstr@0 3794 </edit:with>
edahlstr@0 3795
edahlstr@0 3796 <h3 id="InterfaceSVGFEDiffuseLightingElement">Interface SVGFEDiffuseLightingElement</h3>
edahlstr@0 3797
edahlstr@0 3798 <edit:with element='feDiffuseLighting'>
edahlstr@0 3799 <edit:interface name='::svg::SVGFEDiffuseLightingElement'/>
edahlstr@0 3800 </edit:with>
edahlstr@0 3801
edahlstr@0 3802 <h3 id="InterfaceSVGFEDistantLightElement">Interface SVGFEDistantLightElement</h3>
edahlstr@0 3803
edahlstr@0 3804 <edit:with element='feDistantLight'>
edahlstr@0 3805 <edit:interface name='::svg::SVGFEDistantLightElement'/>
edahlstr@0 3806 </edit:with>
edahlstr@0 3807
edahlstr@0 3808 <h3 id="InterfaceSVGFEPointLightElement">Interface SVGFEPointLightElement</h3>
edahlstr@0 3809
edahlstr@0 3810 <edit:with element='fePointLight'>
edahlstr@0 3811 <edit:interface name='::svg::SVGFEPointLightElement'/>
edahlstr@0 3812 </edit:with>
edahlstr@0 3813
edahlstr@0 3814 <h3 id="InterfaceSVGFESpotLightElement">Interface SVGFESpotLightElement</h3>
edahlstr@0 3815
edahlstr@0 3816 <edit:with element='feSpotLight'>
edahlstr@0 3817 <edit:interface name='::svg::SVGFESpotLightElement'/>
edahlstr@0 3818 </edit:with>
edahlstr@0 3819
edahlstr@0 3820 <h3 id="InterfaceSVGFEDisplacementMapElement">Interface SVGFEDisplacementMapElement</h3>
edahlstr@0 3821
edahlstr@0 3822 <edit:with element='feDisplacementMap'>
edahlstr@0 3823 <edit:interface name='::svg::SVGFEDisplacementMapElement'/>
edahlstr@0 3824 </edit:with>
edahlstr@0 3825
edahlstr@0 3826 <h3 id="InterfaceSVGFEFloodElement">Interface SVGFEFloodElement</h3>
edahlstr@0 3827
edahlstr@0 3828 <edit:with element='feFlood'>
edahlstr@0 3829 <edit:interface name='::svg::SVGFEFloodElement'/>
edahlstr@0 3830 </edit:with>
edahlstr@0 3831
edahlstr@0 3832 <h3 id="InterfaceSVGFEGaussianBlurElement">Interface SVGFEGaussianBlurElement</h3>
edahlstr@0 3833
edahlstr@0 3834 <edit:with element='feGaussianBlur'>
edahlstr@0 3835 <edit:interface name='::svg::SVGFEGaussianBlurElement'/>
edahlstr@0 3836 </edit:with>
edahlstr@0 3837
edahlstr@0 3838 <h3 id="InterfaceSVGFEImageElement">Interface SVGFEImageElement</h3>
edahlstr@0 3839
edahlstr@0 3840 <edit:with element='feImage'>
edahlstr@0 3841 <edit:interface name='::svg::SVGFEImageElement'/>
edahlstr@0 3842 </edit:with>
edahlstr@0 3843
edahlstr@0 3844 <h3 id="InterfaceSVGFEMergeElement">Interface SVGFEMergeElement</h3>
edahlstr@0 3845
edahlstr@0 3846 <edit:with element='feMerge'>
edahlstr@0 3847 <edit:interface name='::svg::SVGFEMergeElement'/>
edahlstr@0 3848 </edit:with>
edahlstr@0 3849
edahlstr@0 3850 <h3 id="InterfaceSVGFEMergeNodeElement">Interface SVGFEMergeNodeElement</h3>
edahlstr@0 3851
edahlstr@0 3852 <edit:with element='feMergeNode'>
edahlstr@0 3853 <edit:interface name='::svg::SVGFEMergeNodeElement'/>
edahlstr@0 3854 </edit:with>
edahlstr@0 3855
edahlstr@0 3856 <h3 id="InterfaceSVGFEMorphologyElement">Interface SVGFEMorphologyElement</h3>
edahlstr@0 3857
edahlstr@0 3858 <edit:with element='feMorphology'>
edahlstr@0 3859 <edit:interface name='::svg::SVGFEMorphologyElement'/>
edahlstr@0 3860 </edit:with>
edahlstr@0 3861
edahlstr@0 3862 <h3 id="InterfaceSVGFEOffsetElement">Interface SVGFEOffsetElement</h3>
edahlstr@0 3863
edahlstr@0 3864 <edit:with element='feOffset'>
edahlstr@0 3865 <edit:interface name='::svg::SVGFEOffsetElement'/>
edahlstr@0 3866 </edit:with>
edahlstr@0 3867
edahlstr@0 3868 <h3 id="InterfaceSVGFESpecularLightingElement">Interface SVGFESpecularLightingElement</h3>
edahlstr@0 3869
edahlstr@0 3870 <edit:with element='feSpecularLighting'>
edahlstr@0 3871 <edit:interface name='::svg::SVGFESpecularLightingElement'/>
edahlstr@0 3872 </edit:with>
edahlstr@0 3873
edahlstr@0 3874 <h3 id="InterfaceSVGFETileElement">Interface SVGFETileElement</h3>
edahlstr@0 3875
edahlstr@0 3876 <edit:with element='feTile'>
edahlstr@0 3877 <edit:interface name='::svg::SVGFETileElement'/>
edahlstr@0 3878 </edit:with>
edahlstr@0 3879
edahlstr@0 3880 <h3 id="InterfaceSVGFETurbulenceElement">Interface SVGFETurbulenceElement</h3>
edahlstr@0 3881
edahlstr@0 3882 <edit:with element='feTurbulence'>
edahlstr@0 3883 <edit:interface name='::svg::SVGFETurbulenceElement'/>
edahlstr@0 3884 </edit:with>
edahlstr@0 3885
edahlstr@0 3886 <h3 id="InterfaceSVGFEDropShadowElement">Interface SVGFEDropShadowElement</h3>
edahlstr@0 3887
edahlstr@0 3888 <edit:with element='feDropShadow'>
edahlstr@0 3889 <edit:interface name='::svg::SVGFEDropShadowElement'/>
edahlstr@0 3890 </edit:with>
edahlstr@0 3891
edahlstr@0 3892 <h2 id="references1">References</h2>
edahlstr@0 3893 <h3 id="normref">Normative References</h3>
edahlstr@0 3894 <dl>
edahlstr@0 3895 <dt id="ref-CSS21"><strong class="normref">[CSS21]</strong></dt>
edahlstr@0 3896 <dd><strong>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</strong>,
dino@13 3897 Bert Bos, Tantek Çelik, Ian Hickson, Håkon Wium Lie, eds.,
dino@13 3898 W3C, 23 April 2009, (Candidate Recommendation) </dd>
edahlstr@0 3899
edahlstr@0 3900 <dt id="ref-NVDL"><strong class="normref">[NVDL]</strong></dt>
edahlstr@0 3901 <dd><strong>Document Schema Definition Languages (DSDL) — Part 4:
edahlstr@0 3902 Namespace-based Validation Dispatching Language — NVDL. ISO/IEC FCD
edahlstr@0 3903 19757-4</strong>, See <a
edahlstr@0 3904 href="http://www.asahi-net.or.jp/~eb2m-mrt/dsdl/">http://www.asahi-net.or.jp/~eb2m-mrt/dsdl/</a>
edahlstr@0 3905 </dd>
edahlstr@0 3906
edahlstr@0 3907 <dt id="ref-PORTERDUFF"><strong class="normref">[PORTERDUFF]</strong></dt>
edahlstr@0 3908 <dd><strong>Compositing Digital Images</strong>, T. Porter, T. Duff,
edahlstr@0 3909 SIGGRAPH '84 Conference Proceedings, Association for Computing
edahlstr@0 3910 Machinery, Volume 18, Number 3, July 1984. </dd>
ed@27 3911 <dt id="ref-SVG-COMPOSITING"><strong class="normref">[SVG-COMPOSITING]</strong></dt>
ed@27 3912 <dd>
ed@27 3913 <cite class="w3cwd"><a href="http://www.w3.org/TR/2009/WD-SVGCompositing-20090430/">SVG Compositing Specification</a></cite>,
ed@27 3914 A. Grasso, ed.
ed@27 3915 World Wide Web Consortium, 30 April 2009.
ed@27 3916 <br/>This edition of SVG Compositing is http://www.w3.org/TR/2009/WD-SVGCompositing-20090430/.
ed@27 3917 <br/>The <a href="http://www.w3.org/TR/SVGCompositing/">latest edition of SVG Compositing</a> is available at
ed@27 3918 http://www.w3.org/TR/SVGCompositing/.
ed@27 3919 </dd>
edahlstr@0 3920 <dt id="ref-RNG"><strong class="normref">[RelaxNG]</strong></dt>
edahlstr@0 3921 <dd><strong>Document Schema Definition Languages (DSDL) — Part 2:
edahlstr@0 3922 Regular grammar- based validation — RELAX NG. ISO/IEC FDIS
edahlstr@0 3923 19757-2:2002(E)</strong>, J. Clark, <span class="ruby"><span
edahlstr@0 3924 xml:lang="ja" lang="ja" class="rb">村田 真</span> <span
edahlstr@0 3925 class="rp">(</span><span class="rt"><span
edahlstr@0 3926 class="familyname">Murata</span> M.</span><span
edahlstr@0 3927 class="rp">)</span></span>, eds., 12 December 2002. See <a
edahlstr@0 3928 href="http://www.y12.doe.gov/sgml/sc34/document/0362_files/relaxng-is.pdf">http://www.y12.doe.gov/sgml/sc34/document/0362_files/relaxng-is.pdf</a>
edahlstr@0 3929 </dd>
edahlstr@0 3930 <dt id="ref-Schema2"><strong class="normref">[Schema2]</strong></dt>
edahlstr@0 3931 <dd><strong>XML Schema Part 2: Datatypes Second Edition</strong>, P.
edahlstr@0 3932 Biron, A. Malhotra, eds. W3C, 28 October 2004 (Recommendation). Latest
edahlstr@0 3933 version available at <a
edahlstr@0 3934 href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</a>.
edahlstr@0 3935 See also <a
edahlstr@0 3936 href="http://www.w3.org/TR/2005/NOTE-xml11schema10-20050511/">Processing
edahlstr@0 3937 XML 1.1 documents with XML Schema 1.0 processors</a>. </dd>
edahlstr@0 3938 <dt id="ref-svg11"><strong class="normref">[SVG11]</strong></dt>
edahlstr@0 3939 <dd><strong>Scalable Vector Graphics (SVG) 1.1 Specification</strong>,
edahlstr@0 3940 Dean Jackson editor, W3C, 14 January 2003 (Recommendation). See <a
edahlstr@0 3941 href="http://www.w3.org/TR/2003/REC-SVG11-20030114/">http://www.w3.org/TR/2003/REC-SVG11-20030114/</a>
edahlstr@0 3942 </dd>
edahlstr@0 3943 <dt id="ref-svgt12"><strong class="normref">[SVGT12]</strong></dt>
edahlstr@0 3944 <dd><strong>Scalable Vector Graphics (SVG) Tiny 1.2 Specification</strong>,
edahlstr@0 3945 Dean Jackson editor, W3C, 22 December 2008 (Recommendation). See <a
edahlstr@0 3946 href="http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/">http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/</a>
edahlstr@0 3947 </dd>
edahlstr@0 3948 </dl>
edahlstr@0 3949
edahlstr@0 3950 <h3 id="informref">Informative References</h3>
edahlstr@0 3951 <dl>
edahlstr@0 3952 <dt id="ref-html5"><strong class="informref">[HTML5]</strong></dt>
edahlstr@0 3953 <dd><strong>HTML5</strong>, Ian Hickson editor, Google,
edahlstr@0 3954 10 June 2008 (Working Draft). See <a
edahlstr@0 3955 href="http://www.w3.org/TR/2008/WD-html5-20080610/">http://www.w3.org/TR/2008/WD-html5-20080610/</a>
edahlstr@0 3956 </dd>
edahlstr@0 3957 </dl>
edahlstr@0 3958
edahlstr@0 3959 <h2 id="changes">Changes</h2>
edahlstr@0 3960 <p>For changes since the last published draft, see the public <a href="http://dev.w3.org/cvsweb/SVG/modules/filters/publish/">cvs log</a>.</p>
edahlstr@0 3961 </body>
edahlstr@0 3962 </html>

mercurial