예제 #1
0
        //--------------------------------------------------------------------
        //
        // Public Properties
        //
        //---------------------------------------------------------------------

        #region Static methods

        public static FixedSOMElement CreateFixedSOMElement(FixedPage page, UIElement uiElement, FixedNode fixedNode, int startIndex, int endIndex)
        {
            FixedSOMElement element = null;

            if (uiElement is Glyphs)
            {
                Glyphs glyphs = uiElement as Glyphs;
                if (glyphs.UnicodeString.Length > 0)
                {
                    GlyphRun glyphRun     = glyphs.ToGlyphRun();
                    Rect     alignmentBox = glyphRun.ComputeAlignmentBox();
                    alignmentBox.Offset(glyphs.OriginX, glyphs.OriginY);
                    GeneralTransform transform = glyphs.TransformToAncestor(page);

                    if (startIndex < 0)
                    {
                        startIndex = 0;
                    }
                    if (endIndex < 0)
                    {
                        endIndex = glyphRun.Characters == null ? 0 : glyphRun.Characters.Count;
                    }
                    element = FixedSOMTextRun.Create(alignmentBox, transform, glyphs, fixedNode, startIndex, endIndex, false);
                }
            }
            else if (uiElement is Image)
            {
                element = FixedSOMImage.Create(page, uiElement as Image, fixedNode);
            }
            else if (uiElement is Path)
            {
                element = FixedSOMImage.Create(page, uiElement as Path, fixedNode);
            }
            return(element);
        }
예제 #2
0
        //--------------------------------------------------------------------
        //
        // Private Methods
        //
        //---------------------------------------------------------------------


        #region Private methods

        private void _ProcessImage(DependencyObject obj, FixedNode fixedNode)
        {
            Debug.Assert(obj is Image || obj is Path);
            FixedSOMImage somImage = null;

            while (true)
            {
                Image image = obj as Image;
                if (image != null)
                {
                    somImage = FixedSOMImage.Create(_fixedPage, image, fixedNode);
                    break;
                }
                Path path = obj as Path;
                if (path != null)
                {
                    somImage = FixedSOMImage.Create(_fixedPage, path, fixedNode);
                    break;
                }
            }
            //Create a wrapper FixedBlock:

            FixedSOMFixedBlock fixedBlock = new FixedSOMFixedBlock(_fixedSOMPage);

            fixedBlock.AddImage(somImage);
            _fixedSOMPage.AddFixedBlock(fixedBlock);
            _currentFixedBlock = fixedBlock;
        }
예제 #3
0
        // Token: 0x06002DF8 RID: 11768 RVA: 0x000CE9D4 File Offset: 0x000CCBD4
        private void _ProcessImage(DependencyObject obj, FixedNode fixedNode)
        {
            Image image;
            Path  path;

            for (;;)
            {
                image = (obj as Image);
                if (image != null)
                {
                    break;
                }
                path = (obj as Path);
                if (path != null)
                {
                    goto Block_1;
                }
            }
            FixedSOMImage image2 = FixedSOMImage.Create(this._fixedPage, image, fixedNode);

            goto IL_34;
Block_1:
            image2 = FixedSOMImage.Create(this._fixedPage, path, fixedNode);
IL_34:
            FixedSOMFixedBlock fixedSOMFixedBlock = new FixedSOMFixedBlock(this._fixedSOMPage);

            fixedSOMFixedBlock.AddImage(image2);
            this._fixedSOMPage.AddFixedBlock(fixedSOMFixedBlock);
            this._currentFixedBlock = fixedSOMFixedBlock;
        }