Beispiel #1
0
        private static bool ToBoolean(CssValue value)
        {
            if (value is CssBoolean cssBoolean)
            {
                return(cssBoolean.Value);
            }

            var text = value.ToString();

            return(text == "true" || text == "True");
        }
Beispiel #2
0
        private static bool ToBoolean(CssValue value)
        {
            if (value.Kind == NodeKind.Boolean) return ((CssBoolean)value).Value;

            return value.ToString().ToLower() == "true";
        }
Beispiel #3
0
		private static float GetAmount(CssValue value)
		{
			// TODO: consider value.kind

			var text = value.ToString();

			switch (value.Kind)
			{
				case NodeKind.Angle      : return (float.Parse(text.Replace("deg", "")) % 360) / 360;
				case NodeKind.Percentage : return ((CssMeasurement)value).Value / 100;
				case NodeKind.Number     : return ((CssNumber)value).Value;

				default: throw new Exception("Unknown numeric value:" + value.ToString());
			}
		}
Beispiel #4
0
		private static Rgba GetColor(CssValue value)
		    => Color.Rgba.Parse(value.ToString());
Beispiel #5
0
 private static Rgba32 GetColor(CssValue value) => Rgba32.Parse(value.ToString());