default namespace = "http://www.w3.org/2000/svg"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"


## 
##     SVG 1.1 Filter Module
##     file: svg-filter.rng
## 
##     This is SVG, a language for describing two-dimensional graphics in XML.
##     Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved.
##
##     Modifications Copyright 2007 Mozilla Foundation
## 
##     $Id$
##   

## 
##     Filter
## 
##         filter, feBlend, feColorMatrix, feComponentTransfer, feComposite,
##         feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feFlood,
##         feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset,
##         feSpecularLighting, feTile, feTurbulence, feDistantLight, fePointLight,
##         feSpotLight, feFuncR, feFuncG, feFuncB, feFuncA
## 
##     This module declares markup to provide support for filter effect.
##   
[ xml:lang = "en" ]
grammar {
    include "svg-basic-filter.rnc"
    
    ## 
    ##       extend SVG.FilterPrimitive.class
    ##     
    SVG.FilterPrimitive.class |=
        feConvolveMatrix
        | feDiffuseLighting
        | feDisplacementMap
        | feMorphology
        | feSpecularLighting
        | feTurbulence
        | feDropShadow
    a:documentation [
        "\x{a}" ~
        "    feConvolveMatrix: Filter Effect Convolve Matrix Element\x{a}" ~
        "  "
    ]
    SVG.feConvolveMatrix.content = (animate | set)*
    feConvolveMatrix =
        element feConvolveMatrix {
            attlist.feConvolveMatrix, SVG.feConvolveMatrix.content
        }
    attlist.feConvolveMatrix &=
        SVG.Core.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        attribute order { NumberOptionalNumber.datatype },
        attribute kernelMatrix { text },
        attribute divisor { Number.datatype }?,
        attribute bias { Number.datatype }?,
        attribute targetX { Integer.datatype }?,
        attribute targetY { Integer.datatype }?,
        [ a:defaultValue = "duplicate" ]
        attribute edgeMode { string "duplicate" | string "wrap" | string "none" }?,
        attribute kernelUnitLength { NumberOptionalNumber.datatype }?,
        attribute preserveAlpha { Boolean.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feDiffuseLighting: Filter Effect Diffuse Lighting Element\x{a}" ~
        "  "
    ]
    SVG.feDiffuseLighting.content =
        (feDistantLight | fePointLight | feSpotLight),
        (animate | set | animateColor)*
    feDiffuseLighting =
        element feDiffuseLighting {
            attlist.feDiffuseLighting, SVG.feDiffuseLighting.content
        }
    attlist.feDiffuseLighting &=
        SVG.Core.attrib,
        SVG.Style.attrib,
        SVG.Color.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        attribute lighting-color { SVGColor.datatype }?,
        attribute surfaceScale { Number.datatype }?,
        attribute diffuseConstant { Number.datatype }?,
        attribute kernelUnitLength { NumberOptionalNumber.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feDisplacementMap: Filter Effect Displacement Map Element\x{a}" ~
        "  "
    ]
    SVG.feDisplacementMap.content = (animate | set)*
    feDisplacementMap =
        element feDisplacementMap {
            attlist.feDisplacementMap, SVG.feDisplacementMap.content
        }
    attlist.feDisplacementMap &=
        SVG.Core.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        attribute in2 { text },
        attribute scale { Number.datatype }?,
        [ a:defaultValue = "A" ]
        attribute xChannelSelector { string "R" | string "G" | string "B" | string "A" }?,
        [ a:defaultValue = "A" ]
        attribute yChannelSelector { string "R" | string "G" | string "B" | string "A" }?
    a:documentation [
        "\x{a}" ~
        "    feMorphology: Filter Effect Morphology Element\x{a}" ~
        "  "
    ]
    SVG.feMorphology.content = (animate | set)*
    feMorphology =
        element feMorphology {
            attlist.feMorphology, SVG.feMorphology.content
        }
    attlist.feMorphology &=
        SVG.Core.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        [ a:defaultValue = "erode" ]
        attribute operator { string "erode" | string "dilate" }?,
        attribute radius { NumberOptionalNumber.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feSpecularLighting: Filter Effect Specular Lighting Element\x{a}" ~
        "  "
    ]
    SVG.feSpecularLighting.content =
        (feDistantLight | fePointLight | feSpotLight),
        (animate | set | animateColor)*
    feSpecularLighting =
        element feSpecularLighting {
            attlist.feSpecularLighting, SVG.feSpecularLighting.content
        }
    attlist.feSpecularLighting &=
        SVG.Core.attrib,
        SVG.Style.attrib,
        SVG.Color.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        attribute lighting-color { SVGColor.datatype }?,
        attribute surfaceScale { Number.datatype }?,
        attribute specularConstant { Number.datatype }?,
        attribute specularExponent { Number.datatype }?,
        attribute kernelUnitLength { NumberOptionalNumber.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feTurbulence: Filter Effect Turbulence Element\x{a}" ~
        "  "
    ]
    SVG.feTurbulence.content = (animate | set)*
    feTurbulence =
        element feTurbulence {
            attlist.feTurbulence, SVG.feTurbulence.content
        }
    attlist.feTurbulence &=
        SVG.Core.attrib,
        SVG.FilterColor.attrib,
        SVG.FilterPrimitive.attrib,
        attribute baseFrequency { NumberOptionalNumber.datatype }?,
        attribute numOctaves { Integer.datatype }?,
        attribute seed { Number.datatype }?,
        [ a:defaultValue = "noStitch" ]
        attribute stitchTiles { string "stitch" | string "noStitch" }?,
        [ a:defaultValue = "turbulence" ]
        attribute type { string "fractalNoise" | string "turbulence" }?
    a:documentation [
        "\x{a}" ~
        "    feDistantLight: Filter Effect Distant Light Element\x{a}" ~
        "  "
    ]
    SVG.feDistantLight.content = (animate | set)*
    feDistantLight =
        element feDistantLight {
            attlist.feDistantLight, SVG.feDistantLight.content
        }
    attlist.feDistantLight &=
        SVG.Core.attrib,
        attribute azimuth { Number.datatype }?,
        attribute elevation { Number.datatype }?
    a:documentation [
        "\x{a}" ~
        "    fePointLight: Filter Effect Point Light Element\x{a}" ~
        "  "
    ]
    SVG.fePointLight.content = (animate | set)*
    fePointLight =
        element fePointLight {
            attlist.fePointLight, SVG.fePointLight.content
        }
    attlist.fePointLight &=
        SVG.Core.attrib,
        attribute x { Number.datatype }?,
        attribute y { Number.datatype }?,
        attribute z { Number.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feSpotLight: Filter Effect Spot Light Element\x{a}" ~
        "  "
    ]
    SVG.feSpotLight.content = (animate | set)*
    feSpotLight =
        element feSpotLight {
            attlist.feSpotLight, SVG.feSpotLight.content
        }
    attlist.feSpotLight &=
        SVG.Core.attrib,
        attribute x { Number.datatype }?,
        attribute y { Number.datatype }?,
        attribute z { Number.datatype }?,
        attribute pointsAtX { Number.datatype }?,
        attribute pointsAtY { Number.datatype }?,
        attribute pointsAtZ { Number.datatype }?,
        attribute specularExponent { Number.datatype }?,
        attribute limitingConeAngle { Number.datatype }?
    a:documentation [
        "\x{a}" ~
        "    feDropShadow: Filter Effects Drop Shadow\x{a}" ~
        "  "
    ]
    SVG.feDropShadow.content = (animate | set)*
    SVG.feDropShadow.content &= SVG.Description.class*
    SVG.feDropShadow.content &= SVG.Script.class*
    feDropShadow =
        element feDropShadow {
            attlist.feDropShadow, SVG.feDropShadow.content
        }
    attlist.feDropShadow &=
        SVG.Core.attrib,
        SVG.Presentation.attrib,
        SVG.Style.attrib,
        SVG.FilterPrimitiveWithIn.attrib,
        attribute stdDeviation { NumberOptionalNumber.datatype }?,
        attribute dx { Number.datatype }?,
        attribute dy { Number.datatype }?
}
