コード例 #1
0
ファイル: NumberPair.cs プロジェクト: Houzvicka/GO.Player
 public NumberPair(NumberPair src)
 {
     UnitMeasureHorizontal    = src.UnitMeasureHorizontal;
     IsRelativeFontVertical   = src.IsRelativeFontVertical;
     IsRelativeFontHorizontal = src.IsRelativeFontHorizontal;
     IsRelativeVertical       = src.IsRelativeVertical;
     IsRelativeHorizontal     = src.IsRelativeHorizontal;
     UnitMeasureVertical      = src.UnitMeasureVertical;
     IsRelativeFontVertical   = src.IsRelativeFontVertical;
     IsRelativeVertical       = src.IsRelativeVertical;
     m_horizontalValue        = src.m_horizontalValue;
     m_verticalValue          = src.m_verticalValue;
 }
コード例 #2
0
        /// <summary>
        /// Parse a padding thickness expression
        /// </summary>
        /// <param name="expression"></param>
        public PaddingThickness(string expression)
        {
            char[] whitespace = { ' ' };

            /// the spec implies no whitespace except between components
            /// and this will fail eg if someone does rgb(1, 2, 3)
            string[] components = expression.Split(whitespace);
            // NumberPair p;

            // double dummy = 0;

            if (components.Length == 4)
            { // If four <length> specifications are provided, then they apply to before, end, after, and start edges, respectively.

                p1 = new NumberPair(components[0] + " " + components[2]);
                //WidthBefore = p.First;
                //WidthEnd = p.Second;
                p2 = new NumberPair(components[3] + " " + components[1]);
                //WidthAfter = p.First;
                //WidthStart = p.Second;
            }
            else if (components.Length == 3)
            { // If three <length> specifications are provided, then the first applies to the
                // before edge, the second applies to the start and end edges, and the third 
                // applies to the after edge
                p1 = new NumberPair(components[0] + " " + components[2]);
                //WidthBefore = p.First;
                //WidthStart = WidthEnd = p.Second;
                p2 = new NumberPair(components[1] + components[1]);
                //WidthAfter = p.First;
            }
            else if (components.Length == 2)
            { // If the value consists of two <length> specifications, then the first applies 
                // to the before and after edges, and the second applies to the start and end edges
                p1 = new NumberPair(components[0] + " " + components[0]);
                p2 = new NumberPair(components[1] + " " + components[1]);
                //WidthBefore = WidthAfter = p.First;
                //WidthStart = WidthEnd = p.Second;
            }
            else if (components.Length == 1)
            {
                p1 = new NumberPair(components[0] + " " + components[0]);
                p2 = new NumberPair(components[0] + " " + components[0]);
                // WidthBefore = WidthAfter = WidthStart = WidthEnd = p.First;
            }
            else
            {
                throw new TimedTextException("invalid padding expression");
            }
        }
コード例 #3
0
        /// <summary>
        /// Parse a text outline expression
        /// </summary>
        /// <param name="expression"></param>
        public TextOutline(string expression)
        {
            ColorDefined = false;
            char[] sep = { ' ', ',' };

            if (expression == "none")
            {
                StrokeColor = Colors.Black;
                p           = new NumberPair("0px", true);
                return;
            }

            /// the spec implies no whitespace except between components
            /// and this will fail eg if someone does rgb(1, 2, 3)
            string[] components = expression.Split(sep, StringSplitOptions.RemoveEmptyEntries);

            try
            {
                // treat first component as a color
                StrokeColor  = ColorExpression.Parse(components[0]);
                ColorDefined = true;
            }
            catch (TimedTextException)
            {
            }

            if (components.Length == 3)
            {
                p = new NumberPair(components[1] + " " + components[2]);
            }
            else if (components.Length == 2 && !ColorDefined)
            {
                p = new NumberPair(components[0] + " " + components[1]);
            }
            else if (components.Length == 2 && ColorDefined)
            {
                p = new NumberPair(components[1] + " 0px");
            }
            else if (components.Length == 1)
            {
                p = new NumberPair(components[0] + " 0px");
            }
            else
            {
                throw new TimedTextException("invalid outline expression");
            }
        }
コード例 #4
0
 public NumberPair(NumberPair src)
 {
     UnitMeasureHorizontal = src.UnitMeasureHorizontal;
     IsRelativeFontVertical = src.IsRelativeFontVertical;
     IsRelativeFontHorizontal = src.IsRelativeFontHorizontal;
     IsRelativeVertical = src.IsRelativeVertical;
     IsRelativeHorizontal = src.IsRelativeHorizontal;
     UnitMeasureVertical = src.UnitMeasureVertical;
     IsRelativeFontVertical = src.IsRelativeFontVertical;
     IsRelativeVertical = src.IsRelativeVertical;
     m_horizontalValue = src.m_horizontalValue;
     m_verticalValue = src.m_verticalValue;
 }
コード例 #5
0
        /// <summary>
        /// Parse a padding thickness expression
        /// </summary>
        /// <param name="expression"></param>
        public PaddingThickness(string expression)
        {
            char[] whitespace = { ' ' };

            /// the spec implies no whitespace except between components
            /// and this will fail eg if someone does rgb(1, 2, 3)
            string[] components = expression.Split(whitespace);
            // NumberPair p;

            // double dummy = 0;

            if (components.Length == 4)
            { // If four <length> specifications are provided, then they apply to before, end, after, and start edges, respectively.

                p1 = new NumberPair(components[0] + " " + components[2]);
                //WidthBefore = p.First;
                //WidthEnd = p.Second;
                p2 = new NumberPair(components[3] + " " + components[1]);
                //WidthAfter = p.First;
                //WidthStart = p.Second;
            }
            else if (components.Length == 3)
            { // If three <length> specifications are provided, then the first applies to the
                // before edge, the second applies to the start and end edges, and the third 
                // applies to the after edge
                p1 = new NumberPair(components[0] + " " + components[2]);
                //WidthBefore = p.First;
                //WidthStart = WidthEnd = p.Second;
                p2 = new NumberPair(components[1] + components[1]);
                //WidthAfter = p.First;
            }
            else if (components.Length == 2)
            { // If the value consists of two <length> specifications, then the first applies 
                // to the before and after edges, and the second applies to the start and end edges
                p1 = new NumberPair(components[0] + " " + components[0]);
                p2 = new NumberPair(components[1] + " " + components[1]);
                //WidthBefore = WidthAfter = p.First;
                //WidthStart = WidthEnd = p.Second;
            }
            else if (components.Length == 1)
            {
                p1 = new NumberPair(components[0] + " " + components[0]);
                p2 = new NumberPair(components[0] + " " + components[0]);
                // WidthBefore = WidthAfter = WidthStart = WidthEnd = p.First;
            }
            else
            {
                throw new TimedTextException("invalid padding expression");
            }
        }
コード例 #6
0
        /// <summary>
        /// Parse a text outline expression
        /// </summary>
        /// <param name="expression"></param>
        public TextOutline(string expression)
        {
            ColorDefined = false;
            char[] sep = { ' ', ',' };

            if (expression == "none")
            {
                StrokeColor = Colors.Black;
                p = new NumberPair("0px", true);
                return;
            }

            /// the spec implies no whitespace except between components
            /// and this will fail eg if someone does rgb(1, 2, 3)
            string[] components = expression.Split(sep, StringSplitOptions.RemoveEmptyEntries);

            // treat first component as a color
            Color color;
            if (ColorExpression.TryParse(components[0], out color))
            {
                StrokeColor = color;
                ColorDefined = true;
            }

            if (components.Length == 3)
            {
                p = new NumberPair(components[1] + " " + components[2]);
            }
            else if (components.Length == 2 && !ColorDefined)
            {
                p = new NumberPair(components[0] + " " + components[1]);
            }
            else if (components.Length == 2 && ColorDefined)
            {
                p = new NumberPair(components[1] + " 0px");
            }
            else if (components.Length == 1)
            {
                p = new NumberPair(components[0] + " 0px");
            }
            else
            {
                throw new TimedTextException("invalid outline expression");
            }
        }
コード例 #7
0
ファイル: Styling.cs プロジェクト: hhhgame/HLSPlayer_RS_Demo
        /// <summary>
        /// Parse a text outline expression
        /// </summary>
        /// <param name="expression"></param>
        public TextOutline(string expression)
        {
            ColorDefined = false;
            char [] whitespace = { ' ' };

            if (expression == "none")
            {
                StrokeColor = Colors.Black;
                p = new NumberPair("0px");
                return;
            }

            /// the spec implies no whitespace except between components
            /// and this will fail eg if someone does rgb(1, 2, 3)
            string[] components = expression.Split(whitespace);

            try
            {
                // treat first component as a color
                StrokeColor = ColorExpression.Parse(components[0]);
                ColorDefined = true;
            }
            catch (TimedTextException)
            {
            }

            if (components.Length == 3)
            {
                p = new NumberPair(components[1] + " " + components[2]);
            }
            else if (components.Length == 2 && !ColorDefined)
            {
                p = new NumberPair(components[0] + " " + components[1]);
            }
            else if (components.Length == 2 && ColorDefined)
            {
                p = new NumberPair(components[1] + " 0px");
            }
            else if (components.Length == 1)
            {
                p = new NumberPair(components[0] + " 0px");
            }
            else
            {
                throw new TimedTextException("invalid outline expression");
            }
        }