ExtractUrl4Gradient() public static method

public static ExtractUrl4Gradient ( string inputText ) : string
inputText string
return string
Example #1
0
    private void Initialize(Dictionary <string, string> attrList)
    {
        isStrokeWidth = false;

        if (attrList.ContainsKey("fill"))
        {
            string fill = attrList["fill"];
            if (fill.Contains("url"))
            {
                _gradientID = SVGStringExtractor.ExtractUrl4Gradient(fill);
            }
            else
            {
                _fillColor = new SVGColor(fill);
            }
        }

        _strokeColor = new SVGColor(attrList.GetValue("stroke"));

        if (attrList.ContainsKey("stroke-width"))
        {
            isStrokeWidth = true;
            _strokeWidth  = new SVGLength(attrList["stroke-width"]);
        }


        SetStrokeLineCap(attrList.GetValue("stroke-linecap"));
        SetStrokeLineJoin(attrList.GetValue("stroke-linejoin"));

        if (!attrList.ContainsKey("stroke-width"))
        {
            _strokeWidth.NewValueSpecifiedUnits(1f);
        }
        SetStyle(attrList.GetValue("style"));
    }
Example #2
0
    private void SetStyle(string styleString)
    {
        Dictionary <string, string> _dictionary = new Dictionary <string, string>();

        SVGStringExtractor.ExtractStyleValue(styleString, ref _dictionary);
        if (_dictionary.ContainsKey("fill"))
        {
            string fill = _dictionary["fill"];
            if (fill.Contains("url"))
            {
                _gradientID = SVGStringExtractor.ExtractUrl4Gradient(fill);
            }
            else
            {
                _fillColor = new SVGColor(fill);
            }
        }
        if (_dictionary.ContainsKey("stroke"))
        {
            _strokeColor = new SVGColor(_dictionary["stroke"]);
        }
        if (_dictionary.ContainsKey("stroke-width"))
        {
            isStrokeWidth = true;
            _strokeWidth  = new SVGLength(_dictionary["stroke-width"]);
        }
        if (_dictionary.ContainsKey("stroke-linecap"))
        {
            SetStrokeLineCap(_dictionary["stroke-linecap"]);
        }
        if (_dictionary.ContainsKey("stroke-linejoin"))
        {
            SetStrokeLineJoin(_dictionary["stroke-linejoin"]);
        }
    }
Example #3
0
    /***********************************************************************************/
    //Khoi tao
    private void Initialize(AttributeList attrList)
    {
        isStrokeWidth = false;

        if (attrList.GetValue("fill").IndexOf("url") >= 0)
        {
            _gradientID = SVGStringExtractor.ExtractUrl4Gradient(attrList.GetValue("fill"));
        }
        else
        {
            _fillColor = new SVGColor(attrList.GetValue("fill"));
        }
        _strokeColor = new SVGColor(attrList.GetValue("stroke"));

        if (attrList.GetValue("stroke-width") != "")
        {
            isStrokeWidth = true;
        }
        _strokeWidth = new SVGLength(attrList.GetValue("stroke-width"));


        SetStrokeLineCap(attrList.GetValue("stroke-linecap"));
        SetStrokeLineJoin(attrList.GetValue("stroke-linejoin"));

        if (attrList.GetValue("stroke-width") == "")
        {
            _strokeWidth.NewValueSpecifiedUnits(1f);
        }
        Style(attrList.GetValue("style"));
        //style="fill: #ffffff; stroke:#000000; stroke-width:0.172"
    }