AppendLinearGradient() public method

public AppendLinearGradient ( SVGLinearGradientElement, linearGradElement ) : void
linearGradElement SVGLinearGradientElement,
return void
Example #1
0
    public void GetElementList(List <ISVGDrawable> elementList, SVGPaintable paintable,
                               SVGGraphics render, SVGTransformList summaryTransformList)
    {
        bool exitFlag = false;

        while (!exitFlag && Next())
        {
            if (Node is BlockCloseNode)
            {
                exitFlag = true;
                continue;
            }

            switch (Node.Name)
            {
            case SVGNodeName.Rect:     elementList.Add(new SVGRectElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.Line:     elementList.Add(new SVGLineElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.Circle:   elementList.Add(new SVGCircleElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.Ellipse:  elementList.Add(new SVGEllipseElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.PolyLine: elementList.Add(new SVGPolylineElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.Polygon:  elementList.Add(new SVGPolygonElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.Path:     elementList.Add(new SVGPathElement(Node.Attributes, summaryTransformList, paintable, render)); break;

            case SVGNodeName.SVG:      elementList.Add(new SVGSVGElement(this, summaryTransformList, paintable, render)); break;

            case SVGNodeName.G:        elementList.Add(new SVGGElement(this, summaryTransformList, paintable, render)); break;

            case SVGNodeName.LinearGradient: paintable.AppendLinearGradient(new SVGLinearGradientElement(this, Node.Attributes)); break;

            case SVGNodeName.RadialGradient: paintable.AppendRadialGradient(new SVGRadialGradientElement(this, Node.Attributes)); break;

            case SVGNodeName.Defs:  GetElementList(elementList, paintable, render, summaryTransformList); break;

            case SVGNodeName.Title: GetElementList(elementList, paintable, render, summaryTransformList); break;

            case SVGNodeName.Desc:  GetElementList(elementList, paintable, render, summaryTransformList); break;
            }
        }
    }
Example #2
0
    public void GetElementList(List<ISVGDrawable> elementList, SVGPaintable paintable,
                             SVGGraphics render, SVGTransformList summaryTransformList)
    {
        bool exitFlag = false;
        while(!exitFlag && Next()) {
          if(Node is BlockCloseNode) {
        exitFlag = true;
        continue;
          }

          switch(Node.Name) {
          case SVGNodeName.Rect:     elementList.Add(new SVGRectElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.Line:     elementList.Add(new SVGLineElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.Circle:   elementList.Add(new SVGCircleElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.Ellipse:  elementList.Add(new SVGEllipseElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.PolyLine: elementList.Add(new SVGPolylineElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.Polygon:  elementList.Add(new SVGPolygonElement(Node.Attributes, summaryTransformList, paintable, render)); break;
          case SVGNodeName.Path:     elementList.Add(new SVGPathElement(Node.Attributes, summaryTransformList, paintable, render)); break;

          case SVGNodeName.SVG:      elementList.Add(new SVGSVGElement(this, summaryTransformList, paintable, render)); break;
          case SVGNodeName.G:        elementList.Add(new SVGGElement(this, summaryTransformList, paintable, render)); break;

          case SVGNodeName.LinearGradient: paintable.AppendLinearGradient(new SVGLinearGradientElement(this, Node.Attributes)); break;
          case SVGNodeName.RadialGradient: paintable.AppendRadialGradient(new SVGRadialGradientElement(this, Node.Attributes)); break;

          case SVGNodeName.Defs:  GetElementList(elementList, paintable, render, summaryTransformList); break;
          case SVGNodeName.Title: GetElementList(elementList, paintable, render, summaryTransformList); break;
          case SVGNodeName.Desc:  GetElementList(elementList, paintable, render, summaryTransformList); break;
          }
        }
    }
Example #3
0
        public void GetElementList(List<object> elementList, SVGPaintable paintable, SVGTransformList summaryTransformList)
        {
            bool exitFlag = false;
            while (!exitFlag && Next())
            {
                //while (Next())
                if (node is BlockCloseNode)
                {
                    exitFlag = true;
                    continue;
                }

                //Debug.Log(node.name);

                switch (node.name)
                {
                    case SVGNodeName.Rect:
                    {
                        elementList.Add(new SVGRectElement(node,
                                                   summaryTransformList,
                                                   paintable));
                        break;
                    }
                    case SVGNodeName.Line:
                    {
                        elementList.Add(new SVGLineElement(node,
                                                   summaryTransformList,
                                                   paintable));
                        break;
                    }
                    case SVGNodeName.Circle:
                    {
                        elementList.Add(new SVGCircleElement(node,
                                                     summaryTransformList,
                                                     paintable));
                        break;
                    }
                    case SVGNodeName.Ellipse:
                    {
                        elementList.Add(new SVGEllipseElement(node,
                                                      summaryTransformList,
                                                      paintable));
                        break;
                    }
                    case SVGNodeName.PolyLine:
                    {
                        elementList.Add(new SVGPolylineElement(node,
                                                       summaryTransformList,
                                                       paintable));
                        break;
                    }
                    case SVGNodeName.Polygon:
                    {
                        elementList.Add(new SVGPolygonElement(node,
                                                      summaryTransformList,
                                                      paintable));
                        break;
                    }
                    case SVGNodeName.Path:
                    {
                        elementList.Add(new SVGPathElement(node,
                                                   summaryTransformList,
                                                   paintable));
                        break;
                    }
                    case SVGNodeName.SVG:
                    {
                        if(node is InlineNode) break;
                        elementList.Add(new SVGElement(this,
                                                      summaryTransformList,
                                                      paintable));
                        break;
                    }
                    case SVGNodeName.Symbol:
                    {
                        if(node is InlineNode) break;
                        elementList.Add(new SVGElement(this,
                                                      summaryTransformList,
                                                      paintable));
                        break;
                    }
                    case SVGNodeName.G:
                    {
                        if(node is InlineNode) break;
                        elementList.Add(new SVGElement(this,
                                                summaryTransformList,
                                                paintable));
                        break;
                    }
                        /*
                    case SVGNodeName.ClipPath:
                        {
                            paintable.AppendClipPath(new SVGClipPathElement(this, node));
                            break;
                        }
                        */
                    case SVGNodeName.LinearGradient:
                    {
                        ResolveGradientLinks();                        
                        paintable.AppendLinearGradient(new SVGLinearGradientElement(this, node));
                        break;
                    }
                    case SVGNodeName.RadialGradient:
                    {
                        ResolveGradientLinks();
                        paintable.AppendRadialGradient(new SVGRadialGradientElement(this, node));
                        break;
                    }
                    case SVGNodeName.ConicalGradient:
                    {
                        ResolveGradientLinks();
                        paintable.AppendConicalGradient(new SVGConicalGradientElement(this, node));
                        break;
                    }
                    case SVGNodeName.Defs:
                    {
                        GetElementList(elementList, paintable, summaryTransformList);
                        break;
                    }
                    case SVGNodeName.Title:
                    {
                        GetElementList(elementList, paintable, summaryTransformList);
                        break;
                    }
                    case SVGNodeName.Desc:
                    {
                        GetElementList(elementList, paintable, summaryTransformList);
                        break;
                    }
                    case SVGNodeName.Style:
                    {                                        
                        paintable.AddCSS(node.content);                                         
                        break;
                    }
                    case SVGNodeName.Use:
                    {
//                            Debug.Log("Begin Use Command: " + node.attributes.GetValue("id"));
                        string xlink = node.attributes.GetValue("xlink:href");
                        if (!string.IsNullOrEmpty(xlink))
                        {
                            if (xlink [0] == '#') xlink = xlink.Remove(0, 1);
                            if (_defs.ContainsKey(xlink))
                            {
                                Node definitionNode = _defs [xlink];
                                if (definitionNode != null && definitionNode != node)
                                {
                                    List<Node> injectNodes = definitionNode.GetNodes();
                                    if (injectNodes != null && injectNodes.Count > 0)
                                    {
                                        nodes [idx] = new BlockOpenNode(SVGNodeName.Use, node.attributes, node.depth);
                                        injectNodes.Add(new BlockCloseNode(SVGNodeName.Use, new AttributeList(), node.depth));
                                        nodes.InsertRange(idx + 1, injectNodes);

                                        elementList.Add(new SVGElement(this,
                                                                    summaryTransformList,
                                                                    paintable));
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }      
Example #4
0
        public void GetElementList(List <object> elementList, SVGPaintable paintable, SVGTransformList summaryTransformList)
        {
            bool exitFlag = false;

            while (!exitFlag && Next())
            {
                //while (Next())
                if (node is BlockCloseNode)
                {
                    exitFlag = true;
                    continue;
                }

                //Debug.Log(node.name);

                switch (node.name)
                {
                case SVGNodeName.Rect:
                {
                    elementList.Add(new SVGRectElement(node,
                                                       summaryTransformList,
                                                       paintable));
                    break;
                }

                case SVGNodeName.Line:
                {
                    elementList.Add(new SVGLineElement(node,
                                                       summaryTransformList,
                                                       paintable));
                    break;
                }

                case SVGNodeName.Circle:
                {
                    elementList.Add(new SVGCircleElement(node,
                                                         summaryTransformList,
                                                         paintable));
                    break;
                }

                case SVGNodeName.Ellipse:
                {
                    elementList.Add(new SVGEllipseElement(node,
                                                          summaryTransformList,
                                                          paintable));
                    break;
                }

                case SVGNodeName.PolyLine:
                {
                    elementList.Add(new SVGPolylineElement(node,
                                                           summaryTransformList,
                                                           paintable));
                    break;
                }

                case SVGNodeName.Polygon:
                {
                    elementList.Add(new SVGPolygonElement(node,
                                                          summaryTransformList,
                                                          paintable));
                    break;
                }

                case SVGNodeName.Path:
                {
                    elementList.Add(new SVGPathElement(node,
                                                       summaryTransformList,
                                                       paintable));
                    break;
                }

                case SVGNodeName.SVG:
                {
                    if (node is InlineNode)
                    {
                        break;
                    }
                    elementList.Add(new SVGElement(this,
                                                   summaryTransformList,
                                                   paintable));
                    break;
                }

                case SVGNodeName.Symbol:
                {
                    if (node is InlineNode)
                    {
                        break;
                    }
                    elementList.Add(new SVGElement(this,
                                                   summaryTransformList,
                                                   paintable));
                    break;
                }

                case SVGNodeName.G:
                {
                    if (node is InlineNode)
                    {
                        break;
                    }
                    elementList.Add(new SVGElement(this,
                                                   summaryTransformList,
                                                   paintable));
                    break;
                }

                /*
                 * case SVGNodeName.ClipPath:
                 * {
                 *  paintable.AppendClipPath(new SVGClipPathElement(this, node));
                 *  break;
                 * }
                 */
                case SVGNodeName.LinearGradient:
                {
                    ResolveGradientLinks();
                    paintable.AppendLinearGradient(new SVGLinearGradientElement(this, node));
                    break;
                }

                case SVGNodeName.RadialGradient:
                {
                    ResolveGradientLinks();
                    paintable.AppendRadialGradient(new SVGRadialGradientElement(this, node));
                    break;
                }

                case SVGNodeName.ConicalGradient:
                {
                    ResolveGradientLinks();
                    paintable.AppendConicalGradient(new SVGConicalGradientElement(this, node));
                    break;
                }

                case SVGNodeName.Defs:
                {
                    GetElementList(elementList, paintable, summaryTransformList);
                    break;
                }

                case SVGNodeName.Title:
                {
                    GetElementList(elementList, paintable, summaryTransformList);
                    break;
                }

                case SVGNodeName.Desc:
                {
                    GetElementList(elementList, paintable, summaryTransformList);
                    break;
                }

                case SVGNodeName.Style:
                {
                    paintable.AddCSS(node.content);
                    break;
                }

                case SVGNodeName.Use:
                {
//                            Debug.Log("Begin Use Command: " + node.attributes.GetValue("id"));
                    string xlink = node.attributes.GetValue("xlink:href");
                    if (!string.IsNullOrEmpty(xlink))
                    {
                        if (xlink [0] == '#')
                        {
                            xlink = xlink.Remove(0, 1);
                        }
                        if (_defs.ContainsKey(xlink))
                        {
                            Node definitionNode = _defs [xlink];
                            if (definitionNode != null && definitionNode != node)
                            {
                                List <Node> injectNodes = definitionNode.GetNodes();
                                if (injectNodes != null && injectNodes.Count > 0)
                                {
                                    nodes [idx] = new BlockOpenNode(SVGNodeName.Use, node.attributes, node.depth);
                                    injectNodes.Add(new BlockCloseNode(SVGNodeName.Use, new AttributeList(), node.depth));
                                    nodes.InsertRange(idx + 1, injectNodes);

                                    elementList.Add(new SVGElement(this,
                                                                   summaryTransformList,
                                                                   paintable));
                                }
                            }
                        }
                    }
                    break;
                }
                }
            }
        }