Exemplo n.º 1
0
        public static object GetDefaultValue(SvgElement element, string attributename)
        {
            string  text1;
            DomType type1 = DomTypeFunc.GetTypeOfAttributeName(attributename);

            if ((text1 = attributename) != null)
            {
                text1 = string.IsInterned(text1);
                if (((text1 == "fill-opacity") || (text1 == "opacity")) || (((text1 == "stroke-opacity") || (text1 == "stroke-width")) || (text1 == "stop-opacity")))
                {
                    return(1f);
                }
            }
            switch (type1)
            {
            case DomType.SvgNumber:
            {
                return(0f);
            }

            case DomType.SvgString:
            {
                return(string.Empty);
            }

            case DomType.SvgColor:
            {
                return(string.Empty);
            }
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
 public static void CreateAnimateValues(ISvgElement svgelement, int time, int maxbegin)
 {
     if (svgelement is SvgElement)
     {
         SvgElement element1 = (SvgElement)svgelement;
         element1.AnimateNameValues.Clear();
         Hashtable hashtable1 = new Hashtable(0x10);
         int       num1       = 0;
         int       num2       = 0;
         int       num3       = 0;
         SvgElementCollection.ISvgElementEnumerator enumerator1 = element1.AnimateList.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current;
             if (animate1.Begin < maxbegin)
             {
                 string text1 = animate1.GetAttribute("additive").Trim();
                 if (((text1 == null) || (text1 == string.Empty)) && (animate1 is MotionAnimate))
                 {
                     text1 = "sum";
                 }
                 bool    flag1 = text1 == "sum";
                 string  text2 = animate1.AttributeName;
                 int     num4  = animate1.Begin;
                 DomType type1 = DomTypeFunc.GetTypeOfAttributeName(text2);
                 object  obj1  = animate1.GetAnimateResult((float)time, type1);
                 if ((obj1 != null) && (obj1.ToString() != string.Empty))
                 {
                     if (element1.AnimateNameValues.ContainsKey(text2))
                     {
                         AnimateInfo info1 = (AnimateInfo)element1.AnimateNameValues[text2];
                         info1.Add(obj1, num4, flag1);
                     }
                     else
                     {
                         AnimateInfo info2 = new AnimateInfo();
                         info2.Add(obj1, num4, flag1);
                         element1.AnimateNameValues.Add(text2, info2);
                     }
                 }
                 if (num1 == 0)
                 {
                     num2 = num4;
                     num3 = num4 + animate1.Duration;
                     continue;
                 }
                 num2 = Math.Min(animate1.Begin, num2);
                 num3 = Math.Max((int)(num4 + animate1.Duration), num3);
             }
         }
         foreach (string text3 in element1.AnimateNameValues.Keys)
         {
             DomType type2 = DomTypeFunc.GetTypeOfAttributeName(text3);
             if (element1.SvgAttributes.ContainsKey(text3))
             {
                 object obj2 = element1.SvgAttributes[text3];
                 object obj3 = AnimFunc.GetAnimateValue(element1, text3, type2, obj2);
                 if (element1.SvgAnimAttributes.ContainsKey(text3))
                 {
                     element1.SvgAnimAttributes[text3] = obj3;
                 }
                 else
                 {
                     element1.SvgAnimAttributes.Add(text3, obj3);
                 }
                 continue;
             }
             object obj4 = null;
             object obj5 = AnimFunc.GetAnimateValue(element1, text3, type2, obj4);
             if (element1.SvgAnimAttributes.ContainsKey(text3))
             {
                 element1.SvgAnimAttributes[text3] = obj5;
                 continue;
             }
             element1.SvgAnimAttributes.Add(text3, obj5);
         }
     }
 }