Пример #1
0
        /// <summary>
        /// Sets the values for attribute <c>'filterRes'</c>.
        /// </summary>
        /// <param name="filterResX">The X component of attribute <c>'filterRes'</c>.</param>
        /// <param name="filterResY">The Y component of attribute <c>'filterRes'</c>. </param>
        public void SetFilterRes(ulong filterResX, ulong filterResY)
        {
            _filterResX = new SvgAnimatedInteger(filterResX);
            _filterResY = new SvgAnimatedInteger(filterResY);

            this.SetAttribute("filterRes", string.Format("{0} {1}", filterResX, filterResY));
        }
Пример #2
0
        // <filter id = "edgeFilter" >
        //     < feConvolveMatrix filterRes="100 100" style="color-interpolation-filters:sRGB"
        //            order="3" kernelMatrix="0 -1 0   -1 4 -1   0 -1 0" preserveAlpha="true"/>
        // </filter>
        private void ParseFilterRes()
        {
            if (!this.HasAttribute("filterRes"))
            {
                return;
            }
            var filterRes = this.GetAttribute("filterRes");

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

            var filterResParts = _reSeparators.Split(filterRes);

            if (filterResParts == null || filterResParts.Length == 0)
            {
                return;
            }
            if (filterResParts.Length == 1)
            {
                var filterResValue = SvgNumber.ParseNumber(filterResParts[0]);
                _filterResX = new SvgAnimatedInteger(filterResValue);
                _filterResY = new SvgAnimatedInteger(filterResValue);
            }
            else if (filterResParts.Length == 2)
            {
                _filterResX = new SvgAnimatedInteger(SvgNumber.ParseNumber(filterResParts[0]));
                _filterResY = new SvgAnimatedInteger(SvgNumber.ParseNumber(filterResParts[1]));
            }
        }
        private void ParseOrder()
        {
            if (!this.HasAttribute("order"))
            {
                return;
            }
            var order = this.GetAttribute("order");

            if (string.IsNullOrWhiteSpace(order))
            {
                _orderX = new SvgAnimatedInteger(3.0);
                _orderY = new SvgAnimatedInteger(3.0);
                return;
            }

            var orderParts = _reSeparators.Split(order);

            if (orderParts == null || orderParts.Length == 0)
            {
                _orderX = new SvgAnimatedInteger(3.0);
                _orderY = new SvgAnimatedInteger(3.0);
                return;
            }
            if (orderParts.Length == 1)
            {
                var orderValue = SvgNumber.ParseNumber(orderParts[0]);
                _orderX = new SvgAnimatedInteger(orderValue);
                _orderY = new SvgAnimatedInteger(orderValue);
            }
            else if (orderParts.Length == 2)
            {
                _orderX = new SvgAnimatedInteger(SvgNumber.ParseNumber(orderParts[0]));
                _orderY = new SvgAnimatedInteger(SvgNumber.ParseNumber(orderParts[1]));
            }
        }