Exemplo n.º 1
0
        /// <summary>
        /// Start/Continue progressive rendering for specified page
        /// </summary>
        /// <param name="page">Pdf page object</param>
        /// <param name="pageRect">Actual page's rectangle. </param>
        /// <param name="pageRotate">Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).</param>
        /// <param name="renderFlags">0 for normal display, or combination of flags defined above.</param>
        /// <param name="useProgressiveRender">True for use progressive render</param>
        /// <returns>Null if page still painting, PdfBitmap object if page successfully rendered.</returns>
        internal bool RenderPage(PdfPage page, Rectangle pageRect, PageRotate pageRotate, RenderFlags renderFlags, bool useProgressiveRender)
        {
            if (!this.ContainsKey(page))
            {
                ProcessNew(page); //Add new page into collection
                if (PaintBackground != null)
                {
                    PaintBackground(this, new EventArgs <Rectangle>(pageRect));
                }
            }

            if ((renderFlags & (RenderFlags.FPDF_THUMBNAIL | RenderFlags.FPDF_HQTHUMBNAIL)) != 0)
            {
                this[page].status = ProgressiveRenderingStatuses.RenderDone + 4;
            }
            else if (!useProgressiveRender)
            {
                this[page].status = ProgressiveRenderingStatuses.RenderDone + 3;
            }

            PdfBitmap bitmap = this[page].Bitmap;
            bool      ret    = ProcessExisting(bitmap ?? CanvasBitmap, page, pageRect, pageRotate, renderFlags);

            if (bitmap != null)
            {
                Pdfium.FPDFBitmap_CompositeBitmap(CanvasBitmap.Handle, pageRect.X, pageRect.Y, pageRect.Width, pageRect.Height, bitmap.Handle, pageRect.X, pageRect.Y, BlendTypes.FXDIB_BLEND_NORMAL);
            }
            return(ret);
        }