Example #1
0
 // Token: 0x0600301A RID: 12314 RVA: 0x000D8690 File Offset: 0x000D6890
 private void _UpdateHighlightForeground(DrawingContext dc, ArrayList highlights)
 {
     foreach (object obj in highlights)
     {
         FixedHighlight fixedHighlight = (FixedHighlight)obj;
         Brush          brush          = null;
         if (fixedHighlight.HighlightType != FixedHighlightType.None)
         {
             Glyphs glyphs = fixedHighlight.Glyphs;
             if (glyphs != null)
             {
                 Rect rect = fixedHighlight.ComputeDesignRect();
                 if (!(rect == Rect.Empty))
                 {
                     GeneralTransform generalTransform = fixedHighlight.Element.TransformToAncestor(this._page);
                     Transform        affineTransform  = generalTransform.AffineTransform;
                     if (affineTransform != null)
                     {
                         dc.PushTransform(affineTransform);
                     }
                     else
                     {
                         dc.PushTransform(Transform.Identity);
                     }
                     dc.PushClip(new RectangleGeometry(rect));
                     if (fixedHighlight.HighlightType == FixedHighlightType.TextSelection)
                     {
                         brush = SelectionHighlightInfo.ForegroundBrush;
                     }
                     else if (fixedHighlight.HighlightType == FixedHighlightType.AnnotationHighlight)
                     {
                         brush = fixedHighlight.ForegroundBrush;
                     }
                     GlyphRun glyphRun = glyphs.ToGlyphRun();
                     if (brush == null)
                     {
                         brush = glyphs.Fill;
                     }
                     dc.PushGuidelineY1(glyphRun.BaselineOrigin.Y);
                     dc.PushClip(glyphs.Clip);
                     dc.DrawGlyphRun(brush, glyphRun);
                     dc.Pop();
                     dc.Pop();
                     dc.Pop();
                     dc.Pop();
                 }
             }
         }
     }
 }
        // Token: 0x06002EE0 RID: 12000 RVA: 0x000D382C File Offset: 0x000D1A2C
        internal override Geometry GetTightBoundingGeometryFromTextPositions(ITextPointer startPosition, ITextPointer endPosition)
        {
            PathGeometry pathGeometry = new PathGeometry();
            Dictionary <FixedPage, ArrayList> dictionary = new Dictionary <FixedPage, ArrayList>();
            FixedTextPointer start = this.Container.VerifyPosition(startPosition);
            FixedTextPointer end   = this.Container.VerifyPosition(endPosition);

            this.Container.GetMultiHighlights(start, end, dictionary, FixedHighlightType.TextSelection, null, null);
            ArrayList arrayList;

            dictionary.TryGetValue(this.FixedPage, out arrayList);
            if (arrayList != null)
            {
                foreach (object obj in arrayList)
                {
                    FixedHighlight fixedHighlight = (FixedHighlight)obj;
                    if (fixedHighlight.HighlightType != FixedHighlightType.None)
                    {
                        Rect rect = fixedHighlight.ComputeDesignRect();
                        if (!(rect == Rect.Empty))
                        {
                            GeneralTransform generalTransform = fixedHighlight.Element.TransformToAncestor(this.FixedPage);
                            Transform        transform        = generalTransform.AffineTransform;
                            if (transform == null)
                            {
                                transform = Transform.Identity;
                            }
                            Glyphs glyphs = fixedHighlight.Glyphs;
                            if (fixedHighlight.Element.Clip != null)
                            {
                                Rect bounds = fixedHighlight.Element.Clip.Bounds;
                                rect.Intersect(bounds);
                            }
                            Geometry geometry = new RectangleGeometry(rect);
                            geometry.Transform = transform;
                            rect = generalTransform.TransformBounds(rect);
                            pathGeometry.AddGeometry(geometry);
                        }
                    }
                }
            }
            return(pathGeometry);
        }
Example #3
0
        // Token: 0x06003019 RID: 12313 RVA: 0x000D8494 File Offset: 0x000D6694
        private void _UpdateHighlightBackground(DrawingContext dc, ArrayList highlights)
        {
            PathGeometry pathGeometry = null;
            Brush        brush        = null;
            Rect         rect         = Rect.Empty;

            foreach (object obj in highlights)
            {
                FixedHighlight fixedHighlight = (FixedHighlight)obj;
                Brush          brush2         = null;
                if (fixedHighlight.HighlightType != FixedHighlightType.None)
                {
                    Rect rect2 = fixedHighlight.ComputeDesignRect();
                    if (!(rect2 == Rect.Empty))
                    {
                        GeneralTransform generalTransform = fixedHighlight.Element.TransformToAncestor(this._page);
                        Transform        transform        = generalTransform.AffineTransform;
                        if (transform == null)
                        {
                            transform = Transform.Identity;
                        }
                        Glyphs glyphs = fixedHighlight.Glyphs;
                        if (fixedHighlight.HighlightType == FixedHighlightType.TextSelection)
                        {
                            brush2 = ((glyphs == null) ? SelectionHighlightInfo.ObjectMaskBrush : SelectionHighlightInfo.BackgroundBrush);
                        }
                        else if (fixedHighlight.HighlightType == FixedHighlightType.AnnotationHighlight)
                        {
                            brush2 = fixedHighlight.BackgroundBrush;
                        }
                        if (fixedHighlight.Element.Clip != null)
                        {
                            Rect bounds = fixedHighlight.Element.Clip.Bounds;
                            rect2.Intersect(bounds);
                        }
                        Geometry geometry = new RectangleGeometry(rect2);
                        geometry.Transform = transform;
                        rect2 = generalTransform.TransformBounds(rect2);
                        if (brush2 != brush || rect2.Top > rect.Bottom + 0.1 || rect2.Bottom + 0.1 < rect.Top || rect2.Left > rect.Right + 0.1 || rect2.Right + 0.1 < rect.Left)
                        {
                            if (brush != null)
                            {
                                pathGeometry.FillRule = FillRule.Nonzero;
                                dc.DrawGeometry(brush, null, pathGeometry);
                            }
                            brush        = brush2;
                            pathGeometry = new PathGeometry();
                            pathGeometry.AddGeometry(geometry);
                            rect = rect2;
                        }
                        else
                        {
                            pathGeometry.AddGeometry(geometry);
                            rect.Union(rect2);
                        }
                    }
                }
            }
            if (brush != null)
            {
                pathGeometry.FillRule = FillRule.Nonzero;
                dc.DrawGeometry(brush, null, pathGeometry);
            }
        }