Beispiel #1
0
 public void OnHide()
 {
     if (OriginalPage != null && BackgroundImage != null)
     {
         if (loaderThread != null)
         {
             loaderThread.Join();
         }
         BackgroundImage.Dispose();
         BackgroundImage = null;
     }
 }
Beispiel #2
0
 public void DrawPDFHQ(BaseRenderer r, int height)
 {
     if (OriginalPage != null)
     {
         string filename = Path.Combine(TmpManager.GetTmpDir().FullName, "tmp.pdf");
         using (PdfDocument doc = new PdfDocument())
         {
             doc.AddPage(OriginalPage);
             doc.Save(filename);
         }
         using (Bitmap bmp = MupdfSharp.PageRenderer.Render(filename, height, new int[] { 0 })[0])
         {
             using (var img = new Renderer.Image(bmp))
             {
                 var sizePx = Format.GetPixelSize();
                 r.DrawImage(img, new RectangleF(0, 0, sizePx.Width, sizePx.Height));
             }
         }
         File.Delete(filename);
     }
 }
Beispiel #3
0
        public void OnShow(InkControl control)
        {
            if (OriginalPage != null && BackgroundImage == null)
            {
                string      path = TmpManager.GetTmpDir() + "\\render.pdf";
                PdfDocument doc  = new PdfDocument();
                doc.Pages.Add(OriginalPage);
                doc.Save(path);
                Bitmap[] bmp = MupdfSharp.PageRenderer.Render(path, 50, 0);
                BackgroundImage = new Renderer.Image(bmp[0]);

                loaderThread = new Thread(delegate()
                {
                    Bitmap[] bmp2 = MupdfSharp.PageRenderer.Render(path, PDFImporter.PAGETHEIGHTPIXEL, 0);
                    BackgroundImage.Dispose();
                    BackgroundImage = new Renderer.Image(bmp2[0]);
                    control.RefreshPage();
                });
                loaderThread.Start();
            }
        }