Inheritance: SvgVisualElement
Ejemplo n.º 1
0
        static void CreateSvgImage(SvgElement parentNode, HtmlElement elem)
        {
            SvgImageSpec spec     = new SvgImageSpec();
            SvgImage     svgImage = new SvgImage(spec, elem);

            parentNode.AddChild(svgImage);
            foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
            {
                WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;
                switch (wellknownName)
                {
                case WebDom.WellknownName.Svg_X:
                {
                    spec.X = UserMapUtil.ParseGenericLength(attr.Value);
                }
                break;

                case WebDom.WellknownName.Svg_Y:
                {
                    spec.Y = UserMapUtil.ParseGenericLength(attr.Value);
                }
                break;

                case WebDom.WellknownName.Width:
                {
                    spec.Width = UserMapUtil.ParseGenericLength(attr.Value);
                }
                break;

                case WebDom.WellknownName.Height:
                {
                    spec.Height = UserMapUtil.ParseGenericLength(attr.Value);
                }
                break;

                case WebDom.WellknownName.Svg_Fill:
                {
                    spec.ActualColor = CssValueParser.GetActualColor(attr.Value);
                }
                break;

                case WebDom.WellknownName.Svg_Stroke:
                {
                    spec.StrokeColor = CssValueParser.GetActualColor(attr.Value);
                }
                break;

                case WebDom.WellknownName.Svg_Stroke_Width:
                {
                    spec.StrokeWidth = UserMapUtil.ParseGenericLength(attr.Value);
                }
                break;

                case WebDom.WellknownName.Svg_Transform:
                {
                    //TODO: parse svg transform function
                }
                break;

                case WellknownName.Href:
                {
                    //image src***
                    spec.ImageSrc = attr.Value;
                }
                break;

                default:
                {
                }
                break;
                }
            }
        }
Ejemplo n.º 2
0
 static void CreateSvgImage(SvgElement parentNode, HtmlElement elem)
 {
     SvgImageSpec spec = new SvgImageSpec();
     SvgImage svgImage = new SvgImage(spec, elem);
     parentNode.AddChild(svgImage);
     foreach (WebDom.DomAttribute attr in elem.GetAttributeIterForward())
     {
         WebDom.WellknownName wellknownName = (WebDom.WellknownName)attr.LocalNameIndex;
         switch (wellknownName)
         {
             case WebDom.WellknownName.Svg_X:
                 {
                     spec.X = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Y:
                 {
                     spec.Y = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Width:
                 {
                     spec.Width = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Height:
                 {
                     spec.Height = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Fill:
                 {
                     spec.ActualColor = CssValueParser.GetActualColor(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Stroke:
                 {
                     spec.StrokeColor = CssValueParser.GetActualColor(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Stroke_Width:
                 {
                     spec.StrokeWidth = UserMapUtil.ParseGenericLength(attr.Value);
                 }
                 break;
             case WebDom.WellknownName.Svg_Transform:
                 {
                     //TODO: parse svg transform function    
                 }
                 break;
             case WellknownName.Href:
                 {
                     //image src***
                     spec.ImageSrc = attr.Value;
                 }
                 break;
             default:
                 {
                 }
                 break;
         }
     }
 }