Exemplo n.º 1
0
		public static SvgNumber ParseNumber(this XmlElement element, string attributeName, SvgNumber defaultValue)
		{
			var attribute = element.GetAttribute(attributeName);
			if (string.IsNullOrEmpty(attribute)) return defaultValue;

			return element.ParseNumber(attributeName);
		}
Exemplo n.º 2
0
		internal static bool TryParse(string numberText, float min, float max, out SvgNumber result)
		{
			var ptr = new StringPtr(numberText);
			ptr.AdvanceNumber();
			if (ptr.Index != numberText.Length)
			{
				result = 0.0F;
				return false;
			}

			result = Math.Min(Math.Max(float.Parse(numberText), min), max);
			return true;
		}
Exemplo n.º 3
0
		internal static bool TryParse(string numberText, out SvgNumber result)
		{
			var ptr = new StringPtr(numberText);
			ptr.AdvanceNumber();
			if (ptr.Index != numberText.Length)
			{
				result = 0.0F;
				return false;
			}

			result = float.Parse(numberText, System.Globalization.CultureInfo.InvariantCulture);
			return true;
		}
Exemplo n.º 4
0
        internal static bool TryParse(string numberText, float min, float max, out SvgNumber result)
        {
            var ptr = new StringPtr(numberText);

            ptr.AdvanceNumber();
            if (ptr.Index != numberText.Length)
            {
                result = 0.0F;
                return(false);
            }

            result = Math.Min(Math.Max(float.Parse(numberText), min), max);
            return(true);
        }
Exemplo n.º 5
0
        internal static bool TryParse(string numberText, out SvgNumber result)
        {
            var ptr = new StringPtr(numberText);

            ptr.AdvanceNumber();
            if (ptr.Index != numberText.Length)
            {
                result = 0.0F;
                return(false);
            }

            result = float.Parse(numberText, System.Globalization.CultureInfo.InvariantCulture);
            return(true);
        }