// Token: 0x060062DA RID: 25306 RVA: 0x001BBE8C File Offset: 0x001BA08C
        private static Annotation Highlight(AnnotationService service, string author, Brush highlightBrush, bool create)
        {
            AnnotationHelper.CheckInputs(service);
            ITextSelection textSelection = AnnotationHelper.GetTextSelection((FrameworkElement)service.Root);

            Invariant.Assert(textSelection != null, "TextSelection is null");
            if (textSelection.IsEmpty)
            {
                throw new InvalidOperationException(SR.Get("EmptySelectionNotSupported"));
            }
            Color?color = null;

            if (highlightBrush != null)
            {
                SolidColorBrush solidColorBrush = highlightBrush as SolidColorBrush;
                if (solidColorBrush == null)
                {
                    throw new ArgumentException(SR.Get("InvalidHighlightColor"), "highlightBrush");
                }
                byte a;
                if (solidColorBrush.Opacity <= 0.0)
                {
                    a = 0;
                }
                else if (solidColorBrush.Opacity >= 1.0)
                {
                    a = solidColorBrush.Color.A;
                }
                else
                {
                    a = (byte)(solidColorBrush.Opacity * (double)solidColorBrush.Color.A);
                }
                color = new Color?(Color.FromArgb(a, solidColorBrush.Color.R, solidColorBrush.Color.G, solidColorBrush.Color.B));
            }
            ITextRange textRange = new TextRange(textSelection.Start, textSelection.End);
            Annotation result    = AnnotationHelper.ProcessHighlights(service, textRange, author, color, create);

            textSelection.SetCaretToPosition(textSelection.MovingPosition, textSelection.MovingPosition.LogicalDirection, true, true);
            return(result);
        }