GetItem() публичный Метод

public GetItem ( uint index ) : ISvgNumber
index uint
Результат ISvgNumber
Пример #1
0
 /// <summary>
 /// Gets the element at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index of the element to get or set.</param>
 /// <returns>The element at the specified index.</returns>
 public ISvgAnimatedNumber this[uint index]
 {
     get {
         if (_animVal != null && _baseVal != null && _animVal.NumberOfItems == _baseVal.NumberOfItems)
         {
             return(new SvgAnimatedNumber(_baseVal.GetItem(index).Value, _animVal.GetItem(index).Value));
         }
         return(null);
     }
 }
Пример #2
0
        private DoubleCollection GetDashArray(double strokeWidth)
        {
            string dashArrayText = _element.GetPropertyValue("stroke-dasharray");
            if (String.IsNullOrEmpty(dashArrayText))
            {
                return null;
            }

            if (dashArrayText == "none")
            {
                return null;
            }
            else
            {
                SvgNumberList list = new SvgNumberList(dashArrayText);

                uint len = list.NumberOfItems;
                //float[] fDashArray = new float[len];
                DoubleCollection dashArray = new DoubleCollection((int)len);

                for (uint i = 0; i < len; i++)
                {
                    //divide by strokeWidth to take care of the difference between Svg and WPF
                    dashArray.Add(list.GetItem(i).Value / strokeWidth);
                }

                return dashArray;
            }
        }
Пример #3
0
        private float[] getDashArray(float strokeWidth)
        {
            string dashArray = _element.GetPropertyValue("stroke-dasharray");

            if(dashArray.Length == 0 || dashArray == "none")
            {
                return null;
            }
            else
            {
                SvgNumberList list = new SvgNumberList(dashArray);

                uint len = list.NumberOfItems;
                float[] fDashArray = new float[len];

                for(uint i = 0; i<len; i++)
                {
                    //divide by strokeWidth to take care of the difference between Svg and GDI+
                    fDashArray[i] = list.GetItem(i).Value / strokeWidth;
                }

                if(len % 2 == 1)
                {
                    //odd number of values, duplicate
                    float[] tmpArray = new float[len*2];
                    fDashArray.CopyTo(tmpArray, 0);
                    fDashArray.CopyTo(tmpArray, (int)len);

                    fDashArray = tmpArray;
                }

                return fDashArray;
            }
        }