public void Process(
                Interval <int> interval,
                ITextString match
                )
            {
                // Defining the highlight box of the text pattern match...
                IList <Quad> highlightQuads = new List <Quad>();

                {
                    /*
                     * NOTE: A text pattern match may be split across multiple contiguous lines,
                     * so we have to define a distinct highlight box for each text chunk.
                     */
                    RectangleF?textBox = null;
                    foreach (TextChar textChar in match.TextChars)
                    {
                        RectangleF textCharBox = textChar.Box;
                        if (!textBox.HasValue)
                        {
                            textBox = textCharBox;
                        }
                        else
                        {
                            if (textCharBox.Y > textBox.Value.Bottom)
                            {
                                highlightQuads.Add(Quad.Get(textBox.Value));
                                textBox = textCharBox;
                            }
                            else
                            {
                                textBox = RectangleF.Union(textBox.Value, textCharBox);
                            }
                        }
                    }
                    highlightQuads.Add(Quad.Get(textBox.Value));
                }
                // Highlight the text pattern match!
                new TextMarkup(page, null, TextMarkup.MarkupTypeEnum.Highlight, highlightQuads);
            }
Example #2
0
        public static Func <float, float> GetEaseFunction(EaseFunction functionType, EaseType easeType)
        {
            switch (functionType)
            {
            case EaseFunction.Linear:
                return(Linear);

            case EaseFunction.Quad:
                return(Quad.Get(easeType));

            case EaseFunction.Cubic:
                return(Cubic.Get(easeType));

            case EaseFunction.Quartic:
                return(Quartic.Get(easeType));

            case EaseFunction.Quintic:
                return(Quintic.Get(easeType));

            case EaseFunction.Sin:
                return(Sin.Get(easeType));

            case EaseFunction.Exponential:
                return(Exponential.Get(easeType));

            case EaseFunction.Circular:
                return(Circular.Get(easeType));

            case EaseFunction.Bounce:
                return(Bounce.Get(easeType));

            case EaseFunction.Elastic:
                return(Elastic.Get(easeType));

            case EaseFunction.Back:
                return(Back.Get(easeType));
            }
            return(f => f);
        }