コード例 #1
0
ファイル: SVGPaintable.cs プロジェクト: suntabu/svgimporter
        void InitDefaults()
        {
            isStrokeWidth = false;

            this._visibility      = SVGVisibility.Visible;
            this._display         = SVGDisplay.Inline;
            this._overflow        = SVGOverflow.visible;
            this._clipPathUnits   = SVGClipPathUnits.UserSpaceOnUse;
            this._clipRule        = SVGClipRule.nonzero;
            this._opacity         = 1f;
            this._fillOpacity     = 1f;
            this._strokeOpacity   = 1f;
            this._fillColor       = new SVGColor();
            this._strokeColor     = new SVGColor();
            this._strokeWidth     = new SVGLength(1);
            this._strokeLineJoin  = SVGStrokeLineJoinMethod.Miter;
            this._strokeLineCap   = SVGStrokeLineCapMethod.Butt;
            this._fillRule        = SVGFillRule.NonZero;
            this._miterLimit      = new SVGLength(4);
            this._dashArray       = null;
            this._dashOfset       = new SVGLength(0);
            this._cssStyle        = new Dictionary <string, Dictionary <string, string> >();
            this._clipPathList    = new List <List <Vector2> >();
            this._linearGradList  = new Dictionary <string, SVGLinearGradientElement>();
            this._radialGradList  = new Dictionary <string, SVGRadialGradientElement>();
            this._conicalGradList = new Dictionary <string, SVGConicalGradientElement>();
        }
コード例 #2
0
ファイル: SVGPaintable.cs プロジェクト: suntabu/svgimporter
        private void SetDisplay(string displayType)
        {
            if (_display == SVGDisplay.None)
            {
                return;
            }

            switch (displayType)
            {
            case "inline":
                _display = SVGDisplay.Inline;;
                break;

            case "block":
                _display = SVGDisplay.Block;
                break;

            case "flex":
                _display = SVGDisplay.Flex;
                break;

            case "inline-block":
                _display = SVGDisplay.InlineBlock;
                break;

            case "inline-flex":
                _display = SVGDisplay.InlineFlex;
                break;

            case "inline-table":
                _display = SVGDisplay.InlineTable;
                break;

            case "list-item":
                _display = SVGDisplay.ListItem;
                break;

            case "run-in":
                _display = SVGDisplay.RunIn;
                break;

            case "table":
                _display = SVGDisplay.Table;
                break;

            case "table-caption":
                _display = SVGDisplay.TableCaption;
                break;

            case "table-column-group":
                _display = SVGDisplay.TableColumnGroup;
                break;

            case "table-header-group":
                _display = SVGDisplay.TableHeaderGroup;
                break;

            case "table-footer-group":
                _display = SVGDisplay.TableFooterGroup;
                break;

            case "table-row-group":
                _display = SVGDisplay.TableRowGroup;
                break;

            case "table-cell":
                _display = SVGDisplay.TableCell;
                break;

            case "table-column":
                _display = SVGDisplay.TableColumn;
                break;

            case "table-row":
                _display = SVGDisplay.TableRow;
                break;

            case "none":
                _display = SVGDisplay.None;
                break;
            }
        }
コード例 #3
0
ファイル: SVGPaintable.cs プロジェクト: suntabu/svgimporter
        public SVGPaintable(SVGPaintable inheritPaintable, Node node)
        {
            InitDefaults();

            if (inheritPaintable != null)
            {
                this._visibility      = inheritPaintable.visibility;
                this._display         = inheritPaintable.display;
                this._clipRule        = inheritPaintable.clipRule;
                this._viewport        = inheritPaintable._viewport;
                this._fillRule        = inheritPaintable._fillRule;
                this._cssStyle        = inheritPaintable._cssStyle;
                this._clipPathList    = CloneClipPathList(inheritPaintable._clipPathList);
                this._linearGradList  = inheritPaintable._linearGradList;
                this._radialGradList  = inheritPaintable._radialGradList;
                this._conicalGradList = inheritPaintable._conicalGradList;
            }

            if (inheritPaintable != null)
            {
                if (IsFillX() == false)
                {
                    if (inheritPaintable.IsLinearGradiantFill())
                    {
                        this._gradientID = inheritPaintable.gradientID;
                    }
                    else if (inheritPaintable.IsRadialGradiantFill())
                    {
                        this._gradientID = inheritPaintable.gradientID;
                    }
                    else
                    {
                        this._fillColor = inheritPaintable.fillColor;
                    }
                }

                if (!IsStroke() && inheritPaintable.IsStroke())
                {
                    this._strokeColor = inheritPaintable.strokeColor;
                }

                if (_strokeLineCap == SVGStrokeLineCapMethod.Unknown)
                {
                    _strokeLineCap = inheritPaintable.strokeLineCap;
                }

                if (_strokeLineJoin == SVGStrokeLineJoinMethod.Unknown)
                {
                    _strokeLineJoin = inheritPaintable.strokeLineJoin;
                }

                if (isStrokeWidth == false)
                {
                    this._strokeWidth.NewValueSpecifiedUnits(inheritPaintable.strokeWidth);
                }
            }

            Initialize(node.attributes);
            ReadCSS(node);

            if (inheritPaintable != null)
            {
                _opacity       *= inheritPaintable._opacity;
                _fillOpacity   *= inheritPaintable._fillOpacity;
                _strokeOpacity *= inheritPaintable._strokeOpacity;
            }
        }
コード例 #4
0
        private void SetDisplay(string displayType)
        {
            if(_display == SVGDisplay.None) return;

            switch(displayType)
            {
                case "inline":
                    _display = SVGDisplay.Inline;;
                    break;
                case "block":
                    _display = SVGDisplay.Block;
                    break;
                case "flex":
                    _display = SVGDisplay.Flex;
                    break;
                case "inline-block":
                    _display = SVGDisplay.InlineBlock;
                    break;
                case "inline-flex":
                    _display = SVGDisplay.InlineFlex;
                    break;
                case "inline-table":
                    _display = SVGDisplay.InlineTable;
                    break;
                case "list-item":
                    _display = SVGDisplay.ListItem;
                    break;
                case "run-in":
                    _display = SVGDisplay.RunIn;
                    break;
                case "table":
                    _display = SVGDisplay.Table;
                    break;
                case "table-caption":
                    _display = SVGDisplay.TableCaption;
                    break;
                case "table-column-group":
                    _display = SVGDisplay.TableColumnGroup;
                    break;
                case "table-header-group":
                    _display = SVGDisplay.TableHeaderGroup;
                    break;
                case "table-footer-group":
                    _display = SVGDisplay.TableFooterGroup;
                    break;
                case "table-row-group":
                    _display = SVGDisplay.TableRowGroup;
                    break;
                case "table-cell":
                    _display = SVGDisplay.TableCell;
                    break;
                case "table-column":
                    _display = SVGDisplay.TableColumn;
                    break;
                case "table-row":
                    _display = SVGDisplay.TableRow;
                    break;
                case "none":
                    _display = SVGDisplay.None;
                    break;
            }
        }
コード例 #5
0
        void InitDefaults()
        {
            isStrokeWidth = false;

            this._visibility = SVGVisibility.Visible;
            this._display = SVGDisplay.Inline;
            this._overflow = SVGOverflow.visible;
            this._clipPathUnits = SVGClipPathUnits.UserSpaceOnUse;
            this._clipRule = SVGClipRule.nonzero;
            this._opacity = 1f;
            this._fillOpacity = 1f;
            this._strokeOpacity = 1f;
            this._fillColor = new SVGColor();
            this._strokeColor = new SVGColor();
            this._strokeWidth = new SVGLength(1);
            this._strokeLineJoin = SVGStrokeLineJoinMethod.Miter;
            this._strokeLineCap = SVGStrokeLineCapMethod.Butt;
            this._fillRule = SVGFillRule.NonZero;
            this._miterLimit = new SVGLength(4);
            this._dashArray = null;
            this._dashOfset = new SVGLength(0);
            this._cssStyle = new Dictionary<string, Dictionary<string, string>>();
            this._clipPathList = new List<List<Vector2>>();
            this._linearGradList = new Dictionary<string, SVGLinearGradientElement>();
            this._radialGradList = new Dictionary<string, SVGRadialGradientElement>();
            this._conicalGradList = new Dictionary<string, SVGConicalGradientElement>();
        }
コード例 #6
0
        public SVGPaintable(SVGPaintable inheritPaintable, Node node)
        {
            InitDefaults();

            if(inheritPaintable != null)
            {
                this._visibility = inheritPaintable.visibility;
                this._display = inheritPaintable.display;
                this._clipRule = inheritPaintable.clipRule;
                this._viewport = inheritPaintable._viewport;
                this._fillRule = inheritPaintable._fillRule;
                this._cssStyle = inheritPaintable._cssStyle;
                this._clipPathList = CloneClipPathList(inheritPaintable._clipPathList);
                this._linearGradList = inheritPaintable._linearGradList;
                this._radialGradList = inheritPaintable._radialGradList;
                this._conicalGradList = inheritPaintable._conicalGradList;
            }

            Initialize(node.attributes);

            if(inheritPaintable != null)
            {
                if (IsFillX() == false)
                {
                    if (inheritPaintable.IsLinearGradiantFill())
                    {
                        this._gradientID = inheritPaintable.gradientID;
                    } else if (inheritPaintable.IsRadialGradiantFill())
                    {
                        this._gradientID = inheritPaintable.gradientID;
                    } else
                        this._fillColor = inheritPaintable.fillColor;
                }

                if (!IsStroke() && inheritPaintable.IsStroke())
                {
                    this._strokeColor = inheritPaintable.strokeColor;
                }

                if (_strokeLineCap == SVGStrokeLineCapMethod.Unknown)
                {
                    _strokeLineCap = inheritPaintable.strokeLineCap;
                }

                if (_strokeLineJoin == SVGStrokeLineJoinMethod.Unknown)
                {
                    _strokeLineJoin = inheritPaintable.strokeLineJoin;
                }

                if (isStrokeWidth == false)
                    this._strokeWidth.NewValueSpecifiedUnits(inheritPaintable.strokeWidth);

                _opacity *= inheritPaintable._opacity;
                _fillOpacity *= inheritPaintable._fillOpacity;
                _strokeOpacity *= inheritPaintable._strokeOpacity;
            }

            ReadCSS(node);
        }