コード例 #1
0
ファイル: SVGPaintable.cs プロジェクト: WaylandGod/UnitySVG
    /***********************************************************************************/
    //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"
    }
コード例 #2
0
        public SVGGradientElement(SVGParser xmlImp, Node node)
        {
            _attrList = node.attributes;
            _xmlImp = xmlImp;
            _stopList = new List<SVGStopElement>();
            _id = _attrList.GetValue("id");
            _gradientUnits = SVGGradientUnit.ObjectBoundingBox;
            if (_attrList.GetValue("gradiantUnits") == "userSpaceOnUse")
            {
                _gradientUnits = SVGGradientUnit.UserSpaceOnUse;
            }

            _gradientTransform = new SVGTransformList(_attrList.GetValue("gradientTransform"));

            //------
            // TODO: It's probably a bug that the value is not innoculated for CaSe
            // VaRiAtIoN in GetValue, below:
            _spreadMethod = SVGSpreadMethod.Pad;
            if (_attrList.GetValue("spreadMethod") == "reflect")
            {
                _spreadMethod = SVGSpreadMethod.Reflect;
            } else if (_attrList.GetValue("spreadMethod") == "repeat")
            {
                _spreadMethod = SVGSpreadMethod.Repeat;
            }

            if(node is BlockOpenNode)
            {
                GetElementList();
            }
        }
コード例 #3
0
        public SVGGradientElement(SVGParser xmlImp, Node node)
        {
            _attrList      = node.attributes;
            _xmlImp        = xmlImp;
            _stopList      = new List <SVGStopElement>();
            _id            = _attrList.GetValue("id");
            _gradientUnits = SVGGradientUnit.ObjectBoundingBox;
            if (_attrList.GetValue("gradiantUnits") == "userSpaceOnUse")
            {
                _gradientUnits = SVGGradientUnit.UserSpaceOnUse;
            }

            _gradientTransform = new SVGTransformList(_attrList.GetValue("gradientTransform"));

            //------
            // TODO: It's probably a bug that the value is not innoculated for CaSe
            // VaRiAtIoN in GetValue, below:
            _spreadMethod = SVGSpreadMethod.Pad;
            if (_attrList.GetValue("spreadMethod") == "reflect")
            {
                _spreadMethod = SVGSpreadMethod.Reflect;
            }
            else if (_attrList.GetValue("spreadMethod") == "repeat")
            {
                _spreadMethod = SVGSpreadMethod.Repeat;
            }

            if (node is BlockOpenNode)
            {
                GetElementList();
            }
        }
コード例 #4
0
ファイル: SVGStopElement.cs プロジェクト: pjezek/UnitySVG
 /***************************************************************************/
 public SVGStopElement(AttributeList attrList)
 {
     _stopColor = new SVGColor(attrList.GetValue("stop-color"));
     string temp = attrList.GetValue("offset").Trim();
     if(temp != "") {
       if(temp.EndsWith("%")) {
     _offset = SVGNumber.ParseToFloat(temp.TrimEnd(new char[1]{'%'}));
       } else {
     _offset = SVGNumber.ParseToFloat(temp)* 100;
       }
     }
 }
コード例 #5
0
 /***************************************************************************/
 public SVGStopElement(AttributeList attrList)
 {
     _stopColor = new SVGColor(attrList.GetValue("stop-color"));
     string temp = attrList.GetValue("offset").Trim();
     if(temp != "") {
       if(temp.EndsWith("%")) {
     _offset = float.Parse(temp.TrimEnd(new char[1] { '%' }), System.Globalization.CultureInfo.InvariantCulture);
       } else {
     _offset = float.Parse(temp, System.Globalization.CultureInfo.InvariantCulture)* 100;
       }
     }
 }
コード例 #6
0
 //================================================================================
 public SVGCircleElement(AttributeList attrList,
                         SVGTransformList inheritTransformList,
                         SVGPaintable inheritPaintable,
                         SVGGraphics _render) : base(inheritTransformList)
 {
     this._attrList  = attrList;
     this._render    = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._cx        = new SVGLength(attrList.GetValue("cx"));
     this._cy        = new SVGLength(attrList.GetValue("cy"));
     this._r         = new SVGLength(attrList.GetValue("r"));
 }
コード例 #7
0
 /***********************************************************************************/
 public SVGLineElement(AttributeList attrList,
                       SVGTransformList inheritTransformList,
                       SVGPaintable inheritPaintable,
                       SVGGraphics _render) : base(inheritTransformList)
 {
     this._attrList  = attrList;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._render    = _render;
     this._x1        = new SVGLength(attrList.GetValue("x1"));
     this._y1        = new SVGLength(attrList.GetValue("y1"));
     this._x2        = new SVGLength(attrList.GetValue("x2"));
     this._y2        = new SVGLength(attrList.GetValue("y2"));
 }
コード例 #8
0
ファイル: SVGSVGElement.cs プロジェクト: WaylandGod/UnitySVG
 /***********************************************************************************/
 public SVGSVGElement(SVGParser xmlImp,
                      SVGTransformList inheritTransformList,
                      SVGPaintable inheritPaintable,
                      SVGGraphics r) : base(inheritTransformList)
 {
     _render    = r;
     _xmlImp    = xmlImp;
     _attrList  = _xmlImp.Node.Attributes;
     _paintable = new SVGPaintable(inheritPaintable, _attrList);
     _width     = new SVGLength(_attrList.GetValue("width"));
     _height    = new SVGLength(_attrList.GetValue("height"));
     Initial();
 }
コード例 #9
0
 //================================================================================
 public SVGCircleElement(AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._render = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._cx = new SVGLength(attrList.GetValue("cx"));
     this._cy = new SVGLength(attrList.GetValue("cy"));
     this._r = new SVGLength(attrList.GetValue("r"));
 }
コード例 #10
0
 /***********************************************************************************/
 public SVGSVGElement(  SVGParser xmlImp,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics r)
     : base(inheritTransformList)
 {
     _render = r;
     _xmlImp = xmlImp;
     _attrList = _xmlImp.Node.Attributes;
     _paintable = new SVGPaintable(inheritPaintable, _attrList);
     _width = new SVGLength(_attrList.GetValue("width"));
     _height = new SVGLength(_attrList.GetValue("height"));
     Initial();
 }
コード例 #11
0
 /***********************************************************************************/
 public SVGLineElement(  AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._render = _render;
     this._x1 = new SVGLength(attrList.GetValue("x1"));
     this._y1 = new SVGLength(attrList.GetValue("y1"));
     this._x2 = new SVGLength(attrList.GetValue("x2"));
     this._y2 = new SVGLength(attrList.GetValue("y2"));
 }
コード例 #12
0
 public SVGClipPathElement(SVGParser xmlImp, Node node)
 {
     _attrList = node.attributes;
     _xmlImp   = xmlImp;
     _id       = _attrList.GetValue("id");
     GetElementList();
 }
コード例 #13
0
 public SVGClipPathElement(SVGParser xmlImp, Node node)
 {
     _attrList = node.attributes;
     _xmlImp = xmlImp;
     _id = _attrList.GetValue("id");
     GetElementList();
 }
コード例 #14
0
ファイル: SVGStopElement.cs プロジェクト: WaylandGod/UnitySVG
    /***************************************************************************/
    public SVGStopElement(AttributeList attrList)
    {
        _stopColor = new SVGColor(attrList.GetValue("stop-color"));
        string temp = attrList.GetValue("offset").Trim();

        if (temp != "")
        {
            if (temp.EndsWith("%"))
            {
                _offset = float.Parse(temp.TrimEnd(new char[1] {
                    '%'
                }), System.Globalization.CultureInfo.InvariantCulture);
            }
            else
            {
                _offset = float.Parse(temp, System.Globalization.CultureInfo.InvariantCulture) * 100;
            }
        }
    }
コード例 #15
0
    /***************************************************************************/
    public SVGRadialGradientElement(SVGParser xmlImp, AttributeList attrList)
        : base(xmlImp, attrList)
    {
        string temp;
        temp = attrList.GetValue("cx");
        _cx = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("cy");
        _cy = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("r");
        _r = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fx");
        _fx = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fy");
        _fy = new SVGLength((temp == "") ? "50%" : temp);
    }
コード例 #16
0
    /***************************************************************************/
    public SVGRadialGradientElement(SVGParser xmlImp, AttributeList attrList) : base(xmlImp, attrList)
    {
        string temp;

        temp = attrList.GetValue("cx");
        _cx  = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("cy");
        _cy  = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("r");
        _r   = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fx");
        _fx  = new SVGLength((temp == "") ? "50%" : temp);

        temp = attrList.GetValue("fy");
        _fy  = new SVGLength((temp == "") ? "50%" : temp);
    }
コード例 #17
0
        public SVGPathElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
        {
            _attrList = node.attributes;
            _paintable = new SVGPaintable(inheritPaintable, node);
            currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
            Rect viewport = _paintable.viewport;
            this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(_attrList, ref viewport, false)));
            paintable.SetViewport(viewport);

            Initial();
        }
コード例 #18
0
        public SVGPathElement(Node node, SVGTransformList inheritTransformList, SVGPaintable inheritPaintable = null) : base(inheritTransformList)
        {
            _attrList            = node.attributes;
            _paintable           = new SVGPaintable(inheritPaintable, node);
            currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
            Rect viewport = _paintable.viewport;

            this.currentTransformList.AppendItem(new SVGTransform(SVGTransformable.GetViewBoxTransform(_attrList, ref viewport, false)));
            paintable.SetViewport(viewport);
            Initial();
        }
コード例 #19
0
 /***********************************************************************************/
 public SVGGElement(SVGParser xmlImp,
                    SVGTransformList inheritTransformList,
                    SVGPaintable inheritPaintable,
                    SVGGraphics render) : base(inheritTransformList)
 {
     _render              = render;
     _xmlImp              = xmlImp;
     _attrList            = _xmlImp.Node.Attributes;
     _paintable           = new SVGPaintable(inheritPaintable, _attrList);
     _elementList         = new List <object>();
     currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
     GetElementList();
 }
コード例 #20
0
ファイル: SVGGElement.cs プロジェクト: pjezek/UnitySVG
 /***********************************************************************************/
 public SVGGElement(SVGParser xmlImp,
                   SVGTransformList inheritTransformList,
                   SVGPaintable inheritPaintable,
                   SVGGraphics render)
     : base(inheritTransformList)
 {
     _render = render;
     _xmlImp = xmlImp;
     _attrList = _xmlImp.Node.Attributes;
     _paintable = new SVGPaintable(inheritPaintable, _attrList);
     _elementList = new List<object>();
     currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));
     GetElementList();
 }
コード例 #21
0
 //================================================================================
 public SVGRectElement(AttributeList attrList,
                       SVGTransformList inheritTransformList,
                       SVGPaintable inheritPaintable,
                       SVGGraphics _render) : base(inheritTransformList)
 {
     this._attrList  = attrList;
     this._render    = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._x         = new SVGLength(attrList.GetValue("x"));
     this._y         = new SVGLength(attrList.GetValue("y"));
     this._width     = new SVGLength(attrList.GetValue("width"));
     this._height    = new SVGLength(attrList.GetValue("height"));
     this._rx        = new SVGLength(attrList.GetValue("rx"));
     this._ry        = new SVGLength(attrList.GetValue("ry"));
 }
コード例 #22
0
ファイル: SVGRectElement.cs プロジェクト: pjezek/UnitySVG
 //================================================================================
 public SVGRectElement(AttributeList attrList,
           SVGTransformList inheritTransformList,
           SVGPaintable inheritPaintable,
           SVGGraphics _render)
     : base(inheritTransformList)
 {
     this._attrList = attrList;
     this._render = _render;
     this._paintable = new SVGPaintable(inheritPaintable, this._attrList);
     this._x = new SVGLength(attrList.GetValue("x"));
     this._y = new SVGLength(attrList.GetValue("y"));
     this._width = new SVGLength(attrList.GetValue("width"));
     this._height = new SVGLength(attrList.GetValue("height"));
     this._rx = new SVGLength(attrList.GetValue("rx"));
     this._ry = new SVGLength(attrList.GetValue("ry"));
 }
コード例 #23
0
ファイル: SVGSVGElement.cs プロジェクト: WaylandGod/UnitySVG
    public SVGMatrix ViewBoxTransform()
    {
        if (this._cachedViewBoxTransform == null)
        {
            SVGMatrix matrix = new SVGMatrix();

            float x = 0.0f;
            float y = 0.0f;
            float w = 0.0f;
            float h = 0.0f;

            float attrWidth  = this._width.value;
            float attrHeight = this._height.value;

            if (_attrList.GetValue("viewBox") != "")
            {
                Rect r = this._viewport;
                x += -r.x;
                y += -r.y;
                w  = r.width;
                h  = r.height;
            }
            else
            {
                w = attrWidth;
                h = attrHeight;
            }

            float x_ratio = attrWidth / w;
            float y_ratio = attrHeight / h;

            matrix = matrix.ScaleNonUniform(x_ratio, y_ratio);
            matrix = matrix.Translate(x, y);
            _cachedViewBoxTransform = matrix;
        }
        return(this._cachedViewBoxTransform);
    }
コード例 #24
0
ファイル: SVGPaintable.cs プロジェクト: suntabu/svgimporter
        public void ReadCSS(Node node)
        {
            if (_cssStyle == null || _cssStyle.Count == 0)
            {
                return;
            }

            AttributeList attrList = node.attributes;

            string classString = attrList.GetValue("class");

            if (!string.IsNullOrEmpty(classString))
            {
                string[] classes = classString.Split(' ');
                for (int i = 0; i < classes.Length; i++)
                {
                    string className = "." + classes[i];
                    if (_cssStyle.ContainsKey(className))
                    {
                        ReadCSSElement(_cssStyle[className]);
                    }
                }
            }
        }
コード例 #25
0
        public static SVGMatrix GetViewBoxTransform(AttributeList attributeList, ref Rect viewport, bool negotiate = false)
        {
            SVGMatrix matrix = SVGMatrix.identity;

            float x = 0.0f;
            float y = 0.0f;
            float w = 0.0f;
            float h = 0.0f;

            string preserveAspectRatio = attributeList.GetValue("preserveAspectRatio");
            string viewBox             = attributeList.GetValue("viewBox");

            if (!string.IsNullOrEmpty(viewBox))
            {
                string[] viewBoxValues = SVGStringExtractor.ExtractTransformValue(viewBox);
                if (viewBoxValues.Length == 4)
                {
                    Rect contentRect = new Rect(
                        new SVGLength(viewBoxValues[0]).value,
                        new SVGLength(viewBoxValues[1]).value,
                        new SVGLength(viewBoxValues[2]).value,
                        new SVGLength(viewBoxValues[3]).value
                        );

                    SVGViewport.Align       align       = SVGViewport.Align.xMidYMid;
                    SVGViewport.MeetOrSlice meetOrSlice = SVGViewport.MeetOrSlice.Meet;

                    if (!string.IsNullOrEmpty(preserveAspectRatio))
                    {
                        string[] aspectRatioValues = SVGStringExtractor.ExtractStringArray(preserveAspectRatio);
                        align       = SVGViewport.GetAlignFromStrings(aspectRatioValues);
                        meetOrSlice = SVGViewport.GetMeetOrSliceFromStrings(aspectRatioValues);
                    }

                    Rect oldViewport = viewport;
                    viewport = SVGViewport.GetViewport(viewport, contentRect, align, meetOrSlice);

                    float sizeX = 0f, sizeY = 0f;
                    if (oldViewport.size.x != 0f)
                    {
                        sizeX = viewport.size.x / oldViewport.size.x;
                    }
                    if (oldViewport.size.y != 0f)
                    {
                        sizeY = viewport.size.y / oldViewport.size.y;
                    }

                    matrix.Scale(sizeX, sizeY);
                    matrix = matrix.Translate(viewport.x - oldViewport.x, viewport.y - oldViewport.y);
                }
            }
            else
            {
                if (negotiate)
                {
                    string attrXString      = attributeList.GetValue("x");
                    string attrYString      = attributeList.GetValue("y");
                    string attrWidthString  = attributeList.GetValue("width");
                    string attrHeightString = attributeList.GetValue("height");

                    SVGLength attrX = new SVGLength(SVGLengthType.PX, 0f), attrY = new SVGLength(SVGLengthType.PX, 0f),
                              attrWidth = new SVGLength(SVGLengthType.PX, 1f), attrHeight = new SVGLength(SVGLengthType.PX, 1f);

                    if (!string.IsNullOrEmpty(attrXString))
                    {
                        attrX = new SVGLength(attrXString);
                    }
                    if (!string.IsNullOrEmpty(attrYString))
                    {
                        attrY = new SVGLength(attrYString);
                    }
                    if (!string.IsNullOrEmpty(attrWidthString))
                    {
                        attrWidth = new SVGLength(attrWidthString);
                    }
                    if (!string.IsNullOrEmpty(attrHeightString))
                    {
                        attrHeight = new SVGLength(attrHeightString);
                    }


                    x = attrX.value;
                    y = attrY.value;
                    w = attrWidth.value;
                    h = attrHeight.value;

                    float x_ratio = 1f;
                    if (w != 0f)
                    {
                        x_ratio = attrWidth.value / w;
                    }

                    float y_ratio = 1f;
                    if (h != 0f)
                    {
                        y_ratio = attrHeight.value / h;
                    }

                    matrix   = matrix.Scale(x_ratio, y_ratio);
                    matrix   = matrix.Translate(x, y);
                    viewport = new Rect(x, y, w, h);

                    //                Debug.Log(string.Format("x: {0}, y: {1}, width: {2}, height: {3}, attrWidth: {4}, attrHeight: {5}", x, y, w, h, attrWidth, attrHeight));
                }
                //                Debug.Log(string.Format("x: {0}, y: {1}, width: {2}, height: {3}, attrWidth: {4}, attrHeight: {5}", x, y, w, h, attrWidth, attrHeight));
            }

            return(matrix);
        }
コード例 #26
0
        private void Initial()
        {
            string     _d               = _attrList.GetValue("d");
            SVGPathSeg lastSegment      = null;
            SVGPathSeg firstPathSegment = null;

            List <char>   _charList  = new List <char>();
            List <string> _valueList = new List <string>();

            SVGStringExtractor.ExtractPathSegList(_d, ref _charList, ref _valueList);
            _segList = new SVGPathSegList(_charList.Count);
            int i, j, paramsLength;

            for (i = 0; i < _charList.Count; i++)
            {
                //lastSegment = _segList.GetLastItem();
                char _char = _charList [i];

                string _value = _valueList [i];

                float[] parms = SVGStringExtractor.ExtractTransformValueAsPX(_value);
                paramsLength = parms.Length;

                switch (_char)
                {
                case 'Z':
                case 'z':
                    if (_segList.Count > 0 && firstPathSegment != null)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoAbs(firstPathSegment.currentPoint.x, firstPathSegment.currentPoint.y, lastSegment));
                    }
                    _segList.AppendItem(CreateSVGPathSegClosePath());
                    firstPathSegment = null;
                    break;

                case 'M':
                    if (lastSegment != null && lastSegment.type != SVGPathSegTypes.Close && lastSegment.type != SVGPathSegTypes.MoveTo_Abs && lastSegment.type != SVGPathSegTypes.MoveTo_Rel)
                    {
                        firstPathSegment = null;
                    }
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegMovetoAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'm':
                    if (lastSegment != null && lastSegment.type != SVGPathSegTypes.Close && lastSegment.type != SVGPathSegTypes.MoveTo_Abs && lastSegment.type != SVGPathSegTypes.MoveTo_Rel)
                    {
                        firstPathSegment = null;
                    }
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegMovetoRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'L':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'l':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'C':
                    if (paramsLength < 6)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 6)
                    {
                        if (paramsLength - j < 6)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'c':
                    if (paramsLength < 6)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 6)
                    {
                        if (paramsLength - j < 6)
                        {
                            continue;
                        }
//                            Debug.Log(string.Format("CubicCurveRel: {0}, {1}, {2}, {3}, {4}, {5}", parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5]));
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], parms [j + 4], parms [j + 5], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'S':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 's':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'Q':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'q':
                    if (paramsLength < 4)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 4)
                    {
                        if (paramsLength - j < 4)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'T':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothAbs(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 't':
                    if (paramsLength < 2)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 2)
                    {
                        if (paramsLength - j < 2)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothRel(parms [j], parms [j + 1], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'A':
                    if (paramsLength < 7)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 7)
                    {
                        if (paramsLength - j < 7)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegArcAbs(parms [j], parms [j + 1], parms [j + 2], parms [j + 3] == 1f, parms [j + 4] == 1f, parms [j + 5], parms [j + 6], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'a':
                    if (paramsLength < 7)
                    {
                        continue;
                    }
                    for (j = 0; j < paramsLength; j += 7)
                    {
                        if (paramsLength - j < 7)
                        {
                            continue;
                        }
                        lastSegment = _segList.AppendItem(new SVGPathSegArcRel(parms [j], parms [j + 1], parms [j + 2], parms [j + 3] == 1f, parms [j + 4] == 1f, parms [j + 5], parms [j + 6], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'H':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoHorizontalAbs(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'h':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoHorizontalRel(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'V':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoVerticalAbs(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;

                case 'v':
                    for (j = 0; j < paramsLength; j++)
                    {
                        lastSegment = _segList.AppendItem(new SVGPathSegLinetoVerticalRel(parms [j], lastSegment));
                        if (firstPathSegment == null)
                        {
                            firstPathSegment = lastSegment;
                        }
                    }
                    break;
                }
            }
        }
コード例 #27
0
 public void Killed(int enemyID)
 {
     fEnemies.SetValue(enemyID, fEnemies.GetValue(enemyID) + 1);
 }
コード例 #28
0
        public SVGStopElement(AttributeList attrList)
        {
            string colorString = attrList.GetValue("stop-color");        
            string offsetString = attrList.GetValue("offset");
            string stopOpacity =  attrList.GetValue("stop-opacity");

            string styleValue = attrList.GetValue("style");
            if(styleValue != null)
            {
                string[] styleValues = styleValue.Split(';');
                for(int i = 0; i < styleValues.Length; i++)
                {
                    if(styleValues[i].Contains("stop-color"))
                    {
                        colorString = styleValues[i].Split(':')[1];
                    } else if(styleValues[i].Contains("stop-opacity"))
                    {
                        stopOpacity = styleValues[i].Split(':')[1];
                    } else if(styleValues[i].Contains("offset"))
                    {
                        offsetString = styleValues[i].Split(':')[1];
                    }
                }
            }

            if(colorString == null)
            {
                colorString = "black";
            }

            if(offsetString == null)
            {
                offsetString = "0%";
            }

            _stopColor = new SVGColor(colorString);

            if(!string.IsNullOrEmpty(stopOpacity))
            {
                if (stopOpacity.EndsWith("%"))
                {
                    _stopColor.color.a = float.Parse(stopOpacity.TrimEnd(new char[1] { '%' }), System.Globalization.CultureInfo.InvariantCulture) * 0.01f;
                } else {
                    _stopColor.color.a = float.Parse(stopOpacity, System.Globalization.CultureInfo.InvariantCulture);
                }
            }

            string temp = offsetString.Trim();
            if (temp != "")
            {
                if (temp.EndsWith("%"))
                {
                    _offset = float.Parse(temp.TrimEnd(new char[1] { '%' }), System.Globalization.CultureInfo.InvariantCulture);
                } else
                {
                    _offset = float.Parse(temp, System.Globalization.CultureInfo.InvariantCulture) * 100;
                }
            }

//            Debug.Log("StopColor: "+_stopColor.color+", offset: "+_offset);
        }
コード例 #29
0
ファイル: SVGPathElement.cs プロジェクト: WaylandGod/UnitySVG
    /***********************************************************************************/
    private void Initial()
    {
        currentTransformList = new SVGTransformList(_attrList.GetValue("transform"));

        //-----------
        string _d = _attrList.GetValue("d");

        List <char>   _charList  = new List <char>();
        List <string> _valueList = new List <string>();

        SVGStringExtractor.ExtractPathSegList(_d, ref _charList, ref _valueList);
        _segList = new SVGPathSegList(_charList.Count);
        for (int i = 0; i < _charList.Count; i++)
        {
            char    _char  = _charList[i];
            string  _value = _valueList[i];
            float[] parms  = SVGStringExtractor.ExtractTransformValueAsPX(_value);
            switch (_char)
            {
            case 'Z':
            case 'z':
                _segList.AppendItem(CreateSVGPathSegClosePath());
                break;

            case 'M':
                _segList.AppendItem(new SVGPathSegMovetoAbs(parms[0], parms[1]));
                break;

            case 'm':
                _segList.AppendItem(new SVGPathSegMovetoRel(parms[0], parms[1]));
                break;

            case 'L':
                _segList.AppendItem(new SVGPathSegLinetoAbs(parms[0], parms[1]));
                break;

            case 'l':
                _segList.AppendItem(new SVGPathSegLinetoRel(parms[0], parms[1]));
                break;

            case 'C':
                _segList.AppendItem(new SVGPathSegCurvetoCubicAbs(parms[0], parms[1], parms[2], parms[3], parms[4], parms[5]));
                break;

            case 'c':
                _segList.AppendItem(new SVGPathSegCurvetoCubicRel(parms[0], parms[1], parms[2], parms[3], parms[4], parms[5]));
                break;

            case 'S':
                _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothAbs(parms[0], parms[1], parms[2], parms[3]));
                break;

            case 's':
                _segList.AppendItem(new SVGPathSegCurvetoCubicSmoothRel(parms[0], parms[1], parms[2], parms[3]));
                break;

            case 'Q':
                _segList.AppendItem(new SVGPathSegCurvetoQuadraticAbs(parms[0], parms[1], parms[2], parms[3]));
                break;

            case 'q':
                _segList.AppendItem(new SVGPathSegCurvetoQuadraticRel(parms[0], parms[1], parms[2], parms[3]));
                break;

            case 'T':
                _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothAbs(parms[0], parms[1]));
                break;

            case 't':
                _segList.AppendItem(new SVGPathSegCurvetoQuadraticSmoothRel(parms[0], parms[1]));
                break;

            case 'A':
                _segList.AppendItem(new SVGPathSegArcAbs(parms[0], parms[1], parms[2], parms[3] == 1f, parms[4] == 1f, parms[5], parms[6]));
                break;

            case 'a':
                _segList.AppendItem(new SVGPathSegArcRel(parms[0], parms[1], parms[2], parms[3] == 1f, parms[4] == 1f, parms[5], parms[6]));
                break;

            case 'H':
                _segList.AppendItem(new SVGPathSegLinetoHorizontalAbs(parms[0]));
                break;

            case 'h':
                _segList.AppendItem(new SVGPathSegLinetoHorizontalRel(parms[0]));
                break;

            case 'V':
                _segList.AppendItem(new SVGPathSegLinetoVerticalAbs(parms[0]));
                break;

            case 'v':
                _segList.AppendItem(new SVGPathSegLinetoVerticalRel(parms[0]));
                break;
            }
        }
    }
コード例 #30
0
        public static SVGMatrix GetRootViewBoxTransform(AttributeList attributeList, ref Rect viewport)
        {
            SVGMatrix matrix = new SVGMatrix();
            
            float x = 0.0f;
            float y = 0.0f;
            float w = 0.0f;
            float h = 0.0f;

            string attrXString = attributeList.GetValue("x");
            string attrYString = attributeList.GetValue("y");
            string attrWidthString = attributeList.GetValue("width");
            string attrHeightString = attributeList.GetValue("height");
            
            SVGLength   attrX = new SVGLength(SVGLengthType.PX, 0f), attrY = new SVGLength(SVGLengthType.PX, 0f), 
            attrWidth = new SVGLength(SVGLengthType.PX, 1f), attrHeight = new SVGLength(SVGLengthType.PX, 1f);
            
            if(!string.IsNullOrEmpty(attrXString))
            {
                attrX = new SVGLength(attrXString);
            }
            if(!string.IsNullOrEmpty(attrYString))
            {
                attrY = new SVGLength(attrYString);
            }
            if(!string.IsNullOrEmpty(attrWidthString))
            {
                attrWidth = new SVGLength(attrWidthString);
            }
            if(!string.IsNullOrEmpty(attrHeightString))
            {
                attrHeight = new SVGLength(attrHeightString);
            }
            
            string viewBox = attributeList.GetValue("viewBox");
            if (!string.IsNullOrEmpty(viewBox))
            {
                string[] _temp = SVGStringExtractor.ExtractTransformValue(viewBox);
                if (_temp.Length > 0)
                {
                    if(string.IsNullOrEmpty(attrXString))
                    {
                        attrX = new SVGLength(_temp [0]);
                    }
                }
                if (_temp.Length > 1)
                {
                    if(string.IsNullOrEmpty(attrYString))
                    {
                        attrY = new SVGLength(_temp [1]);
                    }
                }
                if (_temp.Length > 2)
                {
                    if(string.IsNullOrEmpty(attrWidthString))
                    {
                        attrWidth = new SVGLength(_temp [2]);
                    }
                }
                if (_temp.Length > 3)
                {
                    if(string.IsNullOrEmpty(attrHeightString))
                    {
                        attrHeight = new SVGLength(_temp [3]);
                    }
                }

                viewport = new Rect(attrX.value, attrY.value, attrWidth.value, attrHeight.value);                

                if(string.IsNullOrEmpty(attrXString))
                {        
                    viewport.x = attrX.value;
                }

                if(string.IsNullOrEmpty(attrYString))
                {        
                    viewport.y = attrY.value;
                }

                if(string.IsNullOrEmpty(attrWidthString))
                {        
                    viewport.width = attrWidth.value;
                }

                if(string.IsNullOrEmpty(attrHeightString))
                {        
                    viewport.height = attrHeight.value;
                }

            } else {
                viewport = new Rect(attrX.value, attrY.value, attrWidth.value, attrHeight.value);
            }

            return matrix;
        }
コード例 #31
0
 public static SVGMatrix GetViewBoxTransform(AttributeList attributeList, ref Rect viewport, bool negotiate = false)
 {
     SVGMatrix matrix = new SVGMatrix();
     
     float x = 0.0f;
     float y = 0.0f;
     float w = 0.0f;
     float h = 0.0f;
     
     string preserveAspectRatio = attributeList.GetValue("preserveAspectRatio");
     string viewBox = attributeList.GetValue("viewBox");
     if (!string.IsNullOrEmpty(viewBox))
     {
         string[] viewBoxValues = SVGStringExtractor.ExtractTransformValue(viewBox);
         if(viewBoxValues.Length == 4)
         {
             Rect contentRect = new Rect(
                 new SVGLength(viewBoxValues[0]).value,
                 new SVGLength(viewBoxValues[1]).value,
                 new SVGLength(viewBoxValues[2]).value,
                 new SVGLength(viewBoxValues[3]).value
                 );
             
             SVGViewport.Align align = SVGViewport.Align.xMidYMid;
             SVGViewport.MeetOrSlice meetOrSlice = SVGViewport.MeetOrSlice.Meet;
             
             if(!string.IsNullOrEmpty(preserveAspectRatio))
             {
                 string[] aspectRatioValues = SVGStringExtractor.ExtractStringArray(preserveAspectRatio);                        
                 align = SVGViewport.GetAlignFromStrings(aspectRatioValues);
                 meetOrSlice = SVGViewport.GetMeetOrSliceFromStrings(aspectRatioValues);
             }
             
             Rect oldViewport = viewport;
             viewport = SVGViewport.GetViewport(viewport, contentRect, align, meetOrSlice);
             
             float sizeX = 0f, sizeY = 0f;
             if(oldViewport.size.x != 0f)
                 sizeX = viewport.size.x / oldViewport.size.x;
             if(oldViewport.size.y != 0f)
                 sizeY = viewport.size.y / oldViewport.size.y;
             
             matrix.ScaleNonUniform(sizeX, sizeY);
             matrix = matrix.Translate(viewport.x - oldViewport.x, viewport.y - oldViewport.y);
         }
     } else {
         if(negotiate) 
         {
             string attrXString = attributeList.GetValue("x");
             string attrYString = attributeList.GetValue("y");
             string attrWidthString = attributeList.GetValue("width");
             string attrHeightString = attributeList.GetValue("height");
             
             SVGLength   attrX = new SVGLength(SVGLengthType.PX, 0f), attrY = new SVGLength(SVGLengthType.PX, 0f), 
             attrWidth = new SVGLength(SVGLengthType.PX, 1f), attrHeight = new SVGLength(SVGLengthType.PX, 1f);
             
             if(!string.IsNullOrEmpty(attrXString))
             {
                 attrX = new SVGLength(attrXString);
             }
             if(!string.IsNullOrEmpty(attrYString))
             {
                 attrY = new SVGLength(attrYString);
             }
             if(!string.IsNullOrEmpty(attrWidthString))
             {
                 attrWidth = new SVGLength(attrWidthString);
             }
             if(!string.IsNullOrEmpty(attrHeightString))
             {
                 attrHeight = new SVGLength(attrHeightString);
             }
             
             
             x = attrX.value;
             y = attrY.value;
             w = attrWidth.value;
             h = attrHeight.value;
             
             float x_ratio = 1f;
             if(w != 0f)
                 x_ratio = attrWidth.value / w;
             
             float y_ratio = 1f;
             if(h != 0f)
                 y_ratio = attrHeight.value / h;
             
             matrix = matrix.ScaleNonUniform(x_ratio, y_ratio);
             matrix = matrix.Translate(x, y);
             viewport = new Rect(x, y, w, h);
             
             //                Debug.Log(string.Format("x: {0}, y: {1}, width: {2}, height: {3}, attrWidth: {4}, attrHeight: {5}", x, y, w, h, attrWidth, attrHeight));
         }
         //                Debug.Log(string.Format("x: {0}, y: {1}, width: {2}, height: {3}, attrWidth: {4}, attrHeight: {5}", x, y, w, h, attrWidth, attrHeight));
     }
     
     return matrix;
 }
コード例 #32
0
ファイル: SVGStopElement.cs プロジェクト: suntabu/svgimporter
        public SVGStopElement(AttributeList attrList)
        {
            string colorString  = attrList.GetValue("stop-color");
            string offsetString = attrList.GetValue("offset");
            string stopOpacity  = attrList.GetValue("stop-opacity");

            string styleValue = attrList.GetValue("style");

            if (styleValue != null)
            {
                string[] styleValues = styleValue.Split(';');
                for (int i = 0; i < styleValues.Length; i++)
                {
                    if (styleValues[i].Contains("stop-color"))
                    {
                        colorString = styleValues[i].Split(':')[1];
                    }
                    else if (styleValues[i].Contains("stop-opacity"))
                    {
                        stopOpacity = styleValues[i].Split(':')[1];
                    }
                    else if (styleValues[i].Contains("offset"))
                    {
                        offsetString = styleValues[i].Split(':')[1];
                    }
                }
            }

            if (colorString == null)
            {
                colorString = "black";
            }

            if (offsetString == null)
            {
                offsetString = "0%";
            }

            _stopColor = new SVGColor(colorString);

            if (!string.IsNullOrEmpty(stopOpacity))
            {
                if (stopOpacity.EndsWith("%"))
                {
                    _stopColor.color.a = float.Parse(stopOpacity.TrimEnd(new char[1] {
                        '%'
                    }), System.Globalization.CultureInfo.InvariantCulture) * 0.01f;
                }
                else
                {
                    _stopColor.color.a = float.Parse(stopOpacity, System.Globalization.CultureInfo.InvariantCulture);
                }
            }

            string temp = offsetString.Trim();

            if (temp != "")
            {
                if (temp.EndsWith("%"))
                {
                    _offset = float.Parse(temp.TrimEnd(new char[1] {
                        '%'
                    }), System.Globalization.CultureInfo.InvariantCulture);
                }
                else
                {
                    _offset = float.Parse(temp, System.Globalization.CultureInfo.InvariantCulture) * 100;
                }
            }

//            Debug.Log("StopColor: "+_stopColor.color+", offset: "+_offset);
        }
コード例 #33
0
        public static SVGMatrix GetRootViewBoxTransform(AttributeList attributeList, ref Rect viewport)
        {
            SVGMatrix matrix = SVGMatrix.identity;

            string attrXString      = attributeList.GetValue("x");
            string attrYString      = attributeList.GetValue("y");
            string attrWidthString  = attributeList.GetValue("width");
            string attrHeightString = attributeList.GetValue("height");

            SVGLength attrX = new SVGLength(SVGLengthType.PX, 0f), attrY = new SVGLength(SVGLengthType.PX, 0f),
                      attrWidth = new SVGLength(SVGLengthType.PX, 1f), attrHeight = new SVGLength(SVGLengthType.PX, 1f);

            if (!string.IsNullOrEmpty(attrXString))
            {
                attrX = new SVGLength(attrXString);
            }
            if (!string.IsNullOrEmpty(attrYString))
            {
                attrY = new SVGLength(attrYString);
            }
            if (!string.IsNullOrEmpty(attrWidthString))
            {
                attrWidth = new SVGLength(attrWidthString);
            }
            if (!string.IsNullOrEmpty(attrHeightString))
            {
                attrHeight = new SVGLength(attrHeightString);
            }

            string viewBox = attributeList.GetValue("viewBox");

            if (!string.IsNullOrEmpty(viewBox))
            {
                string[] _temp = SVGStringExtractor.ExtractTransformValue(viewBox);
                if (_temp.Length > 0)
                {
                    if (string.IsNullOrEmpty(attrXString))
                    {
                        attrX = new SVGLength(_temp [0]);
                    }
                }
                if (_temp.Length > 1)
                {
                    if (string.IsNullOrEmpty(attrYString))
                    {
                        attrY = new SVGLength(_temp [1]);
                    }
                }
                if (_temp.Length > 2)
                {
                    if (string.IsNullOrEmpty(attrWidthString))
                    {
                        attrWidth = new SVGLength(_temp [2]);
                    }
                }
                if (_temp.Length > 3)
                {
                    if (string.IsNullOrEmpty(attrHeightString))
                    {
                        attrHeight = new SVGLength(_temp [3]);
                    }
                }

                viewport = new Rect(attrX.value, attrY.value, attrWidth.value, attrHeight.value);

                if (string.IsNullOrEmpty(attrXString))
                {
                    viewport.x = attrX.value;
                }

                if (string.IsNullOrEmpty(attrYString))
                {
                    viewport.y = attrY.value;
                }

                if (string.IsNullOrEmpty(attrWidthString))
                {
                    viewport.width = attrWidth.value;
                }

                if (string.IsNullOrEmpty(attrHeightString))
                {
                    viewport.height = attrHeight.value;
                }
            }
            else
            {
                viewport = new Rect(attrX.value, attrY.value, attrWidth.value, attrHeight.value);
            }

            return(matrix);
        }
コード例 #34
0
ファイル: SVGPaintable.cs プロジェクト: suntabu/svgimporter
 //style="fill: #ffffff; stroke:#000000; stroke-width:0.172"
 private void Initialize(AttributeList attrList)
 {
     ReadStyle(attrList.Get);
     ReadStyle(attrList.GetValue("style"));
 }
コード例 #35
0
ファイル: SVGPaintable.cs プロジェクト: pjezek/UnitySVG
    /***********************************************************************************/
    //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"
    }
コード例 #36
0
 //style="fill: #ffffff; stroke:#000000; stroke-width:0.172"
 private void Initialize(AttributeList attrList)
 {
     ReadStyle(attrList.Get);
     ReadStyle(attrList.GetValue("style"));
 }