Example #1
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>();
        }
Example #2
0
        private void SetVisibility(string visibilityType)
        {
            switch (visibilityType)
            {
            case "visible":
                _visibility = SVGVisibility.Visible;
                break;

            case "hidden":
                _visibility = SVGVisibility.Hidden;
                break;

            case "collapse":
                _visibility = SVGVisibility.Collapse;
                break;
            }
        }
Example #3
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;
            }

            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;
            }
        }
 private void SetVisibility(string visibilityType)
 {
     switch(visibilityType)
     {
         case "visible":
             _visibility = SVGVisibility.Visible;
             break;
         case "hidden":
             _visibility = SVGVisibility.Hidden;
             break;
         case "collapse":
             _visibility = SVGVisibility.Collapse;
             break;
     }
 }
        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>();
        }
        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);
        }