private void ParseStdDeviation()
        {
            if (!this.HasAttribute("stdDeviation"))
            {
                _stdDeviationX = new SvgAnimatedNumber(0.0);
                _stdDeviationY = new SvgAnimatedNumber(0.0);
            }
            var stdDeviation = this.GetAttribute("stdDeviation");

            if (string.IsNullOrWhiteSpace(stdDeviation))
            {
                _stdDeviationX = new SvgAnimatedNumber(0.0);
                _stdDeviationY = new SvgAnimatedNumber(0.0);
            }

            var stdDeviationParts = _reSeparators.Split(stdDeviation);

            if (stdDeviationParts == null || stdDeviationParts.Length == 0)
            {
                _stdDeviationX = new SvgAnimatedNumber(0.0);
                _stdDeviationY = new SvgAnimatedNumber(0.0);
            }
            if (stdDeviationParts.Length == 1)
            {
                var stdDeviationValue = SvgNumber.ParseNumber(stdDeviationParts[0]);
                _stdDeviationX = new SvgAnimatedNumber(stdDeviationValue);
                _stdDeviationY = new SvgAnimatedNumber(stdDeviationValue);
            }
            else if (stdDeviationParts.Length == 2)
            {
                _stdDeviationX = new SvgAnimatedNumber(SvgNumber.ParseNumber(stdDeviationParts[0]));
                _stdDeviationY = new SvgAnimatedNumber(SvgNumber.ParseNumber(stdDeviationParts[1]));
            }
        }
Example #2
0
        private void ParseRadius()
        {
            if (!this.HasAttribute("radius"))
            {
                _radiusX = new SvgAnimatedNumber(0);
                _radiusY = new SvgAnimatedNumber(0);
            }
            var radius = this.GetAttribute("radius");

            if (string.IsNullOrWhiteSpace(radius))
            {
                _radiusX = new SvgAnimatedNumber(0);
                _radiusY = new SvgAnimatedNumber(0);
            }

            var radiusParts = _reSeparators.Split(radius);

            if (radiusParts == null || radiusParts.Length == 0)
            {
                _radiusX = new SvgAnimatedNumber(0);
                _radiusY = new SvgAnimatedNumber(0);
            }
            if (radiusParts.Length == 1)
            {
                var radiusValue = SvgNumber.ParseNumber(radiusParts[0]);
                _radiusX = new SvgAnimatedNumber(radiusValue);
                _radiusY = new SvgAnimatedNumber(radiusValue);
            }
            else if (radiusParts.Length == 2)
            {
                _radiusX = new SvgAnimatedNumber(SvgNumber.ParseNumber(radiusParts[0]));
                _radiusY = new SvgAnimatedNumber(SvgNumber.ParseNumber(radiusParts[1]));
            }
        }
Example #3
0
        private void ParseBaseFrequency()
        {
            if (!this.HasAttribute("baseFrequency"))
            {
                _baseFrequencyX = new SvgAnimatedNumber(0.0);
                _baseFrequencyY = new SvgAnimatedNumber(0.0);
            }
            var baseFrequency = this.GetAttribute("baseFrequency");

            if (string.IsNullOrWhiteSpace(baseFrequency))
            {
                _baseFrequencyX = new SvgAnimatedNumber(0.0);
                _baseFrequencyY = new SvgAnimatedNumber(0.0);
            }

            var baseFrequencyParts = _reSeparators.Split(baseFrequency);

            if (baseFrequencyParts == null || baseFrequencyParts.Length == 0)
            {
                _baseFrequencyX = new SvgAnimatedNumber(0.0);
                _baseFrequencyY = new SvgAnimatedNumber(0.0);
            }
            if (baseFrequencyParts.Length == 1)
            {
                var baseFrequencyValue = SvgNumber.ParseNumber(baseFrequencyParts[0]);
                _baseFrequencyX = new SvgAnimatedNumber(baseFrequencyValue);
                _baseFrequencyY = new SvgAnimatedNumber(baseFrequencyValue);
            }
            else if (baseFrequencyParts.Length == 2)
            {
                _baseFrequencyX = new SvgAnimatedNumber(SvgNumber.ParseNumber(baseFrequencyParts[0]));
                _baseFrequencyY = new SvgAnimatedNumber(SvgNumber.ParseNumber(baseFrequencyParts[1]));
            }
        }
        private void ParseKernelUnitLength()
        {
            if (!this.HasAttribute("kernelUnitLength"))
            {
                return;
            }
            var kernelUnitLength = this.GetAttribute("kernelUnitLength");

            if (string.IsNullOrWhiteSpace(kernelUnitLength))
            {
                return;
            }

            var kernelUnitLengthParts = _reSeparators.Split(kernelUnitLength);

            if (kernelUnitLengthParts == null || kernelUnitLengthParts.Length == 0)
            {
                return;
            }
            if (kernelUnitLengthParts.Length == 1)
            {
                var kernelUnitLengthValue = SvgNumber.ParseNumber(kernelUnitLengthParts[0]);
                _kernelUnitLengthX = new SvgAnimatedNumber(kernelUnitLengthValue);
                _kernelUnitLengthY = new SvgAnimatedNumber(kernelUnitLengthValue);
            }
            else if (kernelUnitLengthParts.Length == 2)
            {
                _kernelUnitLengthX = new SvgAnimatedNumber(SvgNumber.ParseNumber(kernelUnitLengthParts[0]));
                _kernelUnitLengthY = new SvgAnimatedNumber(SvgNumber.ParseNumber(kernelUnitLengthParts[1]));
            }
        }
Example #5
0
        public override void HandleAttributeChange(XmlAttribute attribute)
        {
            if (attribute.NamespaceURI.Length == 0)
            {
                switch (attribute.LocalName)
                {
                case "d":
                    _pathSegList = null;
                    Invalidate();
                    return;

                case "pathLength":
                    _pathLength = null;
                    Invalidate();
                    return;

                case "marker-start":
                case "marker-mid":
                case "marker-end":
                // Color.attrib, Paint.attrib
                case "color":
                case "fill":
                case "fill-rule":
                case "stroke":
                case "stroke-dasharray":
                case "stroke-dashoffset":
                case "stroke-linecap":
                case "stroke-linejoin":
                case "stroke-miterlimit":
                case "stroke-width":
                // Opacity.attrib
                case "opacity":
                case "stroke-opacity":
                case "fill-opacity":
                // Graphics.attrib
                case "display":
                case "image-rendering":
                case "shape-rendering":
                case "text-rendering":
                case "visibility":
                    Invalidate();
                    break;

                case "transform":
                    Invalidate();
                    break;
                }
                base.HandleAttributeChange(attribute);
            }
        }
 public void SetStdDeviation(float stdDeviationX, float stdDeviationY)
 {
     _stdDeviationX = new SvgAnimatedNumber(stdDeviationX);
     _stdDeviationY = new SvgAnimatedNumber(stdDeviationY);
 }
Example #7
0
 public override void HandleAttributeChange(XmlAttribute attribute)
 {
     if(attribute.NamespaceURI.Length == 0)
     {
         switch(attribute.LocalName)
         {
             case "d":
                 pathSegList = null;
     Invalidate();
                 return;
             case "pathLength":
                 _pathLength = null;
     Invalidate();
     return;
       case "marker-start":
       case "marker-mid":
       case "marker-end":
     // Color.attrib, Paint.attrib
       case "color":
       case "fill":
       case "fill-rule":
       case "stroke":
       case "stroke-dasharray":
       case "stroke-dashoffset":
       case "stroke-linecap":
       case "stroke-linejoin":
       case "stroke-miterlimit":
       case "stroke-width":
     // Opacity.attrib
       case "opacity":
       case "stroke-opacity":
       case "fill-opacity":
     // Graphics.attrib
       case "display":
       case "image-rendering":
       case "shape-rendering":
       case "text-rendering":
       case "visibility":
     Invalidate();
     break;
       case "transform":
     Invalidate();
     break;
     }
     base.HandleAttributeChange(attribute);
       }
 }