예제 #1
0
		internal SvgRectElement(INode parent, XmlElement element)
			: base(parent, element)
		{
			this._stylableHelper = new SvgStylableHelper(this, element);
			this._transformableHelper = new SvgTransformableHelper(element);

			this.X = element.ParseCoordinate("x", 0.0F);
			this.Y = element.ParseCoordinate("y", 0.0F);
			this.Width = element.ParseLength("width", 0.0F);
			this.Height = element.ParseLength("height", 0.0F);

			SvgLength rx, ry;
			var fx = element.TryParseLength("rx", out rx);
			if (fx && rx < 0.0F) fx = false;

			var fy = element.TryParseLength("ry", out ry);
			if (fy && ry < 0.0F) fy = false;

			if (!fx && !fy)
			{
				rx = 0.0F;
				ry = 0.0F;
			}
			else if (fx && !fy)
			{
				ry = rx;
			}
			else if (!fx && fy)
			{
				rx = ry;
			}

			var hw = this.Width / 2.0F;
			if (rx > hw) rx = hw;

			var hh = this.Height / 2.0F;
			if (ry > hh) ry = hh;

			this.RoundedX = rx;
			this.RoundedY = ry;
		}