Exemple #1
0
        /* Done rendering. Update the pages with the new raster information if needed */
        private void RenderingDone()
        {
            for (int k = 0; k < m_images_rendered.Count; k++)
            {
                DocPage doc_page = m_docPages[m_images_rendered[k].page_num - 1];

                if (doc_page.Content != Page_Content_t.FULL_RESOLUTION ||
                    doc_page.AA != m_aa)
                {
                    doc_page.Width   = m_images_rendered[k].width;
                    doc_page.Height  = m_images_rendered[k].height;
                    doc_page.Content = Page_Content_t.FULL_RESOLUTION;

                    doc_page.Zoom   = m_doczoom;
                    doc_page.AA     = m_aa;
                    doc_page.BitMap = BitmapSource.Create(doc_page.Width, doc_page.Height,
                                                          72, 72, PixelFormats.Bgr24, BitmapPalettes.Halftone256, m_images_rendered[k].bitmap, m_images_rendered[k].raster);
                }
            }

            xaml_ProgressGrid.Visibility = System.Windows.Visibility.Collapsed;
            xaml_RenderProgress.Value    = 0;
            m_images_rendered.Clear();
            m_viewer_state = ViewerState_t.DOC_OPEN;
        }
        /* Assign current pages to blown up thumbnail images */
        private void ThumbAssignMain(int page_num, int width, int height, double zoom_in, ref int offset)
        {
            m_pageType.Add(Page_Content_t.THUMBNAIL);
            DocPage doc_page = new DocPage();

            doc_page.Content = Page_Content_t.THUMBNAIL;
            doc_page.Zoom    = zoom_in;
            doc_page.AA      = m_aa;
            doc_page.BitMap  = m_thumbnails[page_num - 1].BitMap;
            doc_page.Width   = (int)(width / (Constants.SCALE_THUMB));
            doc_page.Height  = (int)(height / (Constants.SCALE_THUMB));
            doc_page.PageNum = page_num;
            m_docPages.Add(doc_page);

            /* Set the page offsets.  Used for determining which pages
             * will be visible within viewport. */
            m_toppage_pos.Add(offset + Constants.PAGE_VERT_MARGIN);
            offset += doc_page.Height + 2 * Constants.PAGE_VERT_MARGIN;

            /* Set page sizes for 1.0 scaling. This is used to quick
             * rescale of pages prior to rendering at new zoom. */
            pagesizes_t page_size = new pagesizes_t();

            page_size.size.X = doc_page.Width;
            page_size.size.Y = doc_page.Height;
            m_page_sizes.Add(page_size);
        }
Exemple #3
0
        private static DocPage InitDocPage()
        {
            DocPage doc_page = new DocPage();

            doc_page.BitMap = null;
            doc_page.Height = Constants.BLANK_HEIGHT;
            doc_page.Width  = Constants.BLANK_WIDTH;
            return(doc_page);
        }
        /* Rendered all the thumbnail pages.  Stick them in the appropriate lists */
        private void ThumbsDone()
        {
            int offset = 0;

            m_toppage_pos = new List <int>(m_list_thumb.Count);

            for (int k = 0; k < m_list_thumb.Count; k++)
            {
                DocPage doc_page = new DocPage();
                m_thumbnails.Add(doc_page);

                doc_page.Width   = m_list_thumb[k].width;
                doc_page.Height  = m_list_thumb[k].height;
                doc_page.Content = Page_Content_t.THUMBNAIL;
                doc_page.Zoom    = m_list_thumb[k].zoom;
                doc_page.BitMap  = BitmapSource.Create(doc_page.Width, doc_page.Height,
                                                       72, 72, PixelFormats.Bgr24, BitmapPalettes.Halftone256, m_list_thumb[k].bitmap, m_list_thumb[k].raster);
                doc_page.PageNum = m_list_thumb[k].page_num;
                ThumbAssignMain(m_list_thumb[k].page_num, m_list_thumb[k].width, m_list_thumb[k].height, 1.0, ref offset);
            }

            m_toppage_pos.Add(offset);
            xaml_ProgressGrid.Visibility = System.Windows.Visibility.Collapsed;
            xaml_RenderProgress.Value    = 0;
            xaml_PageList.ItemsSource    = m_docPages;
            xaml_ThumbList.ItemsSource   = m_thumbnails;
            xaml_ThumbList.Items.Refresh();
            xaml_ThumbGrid.Visibility = System.Windows.Visibility.Visible;

            m_ghostscript.gsPageRenderedMain -= new ghostsharp.gsCallBackPageRenderedMain(gsThumbRendered);

            m_numpages = m_list_thumb.Count;
            if (m_numpages < 1)
            {
                ShowMessage(NotifyType_t.MESS_STATUS, "File failed to open properly");
                CleanUp();
            }
            else
            {
                xaml_TotalPages.Text = "/" + m_numpages;
                xaml_currPage.Text   = m_currpage.ToString();
                m_list_thumb.Clear();

                if (m_doc_type_has_page_access)
                {
                    RenderMainRange();
                }
                else
                {
                    RenderMainAll();
                }
            }
        }
Exemple #5
0
        /* Assign current pages to blown up thumbnail images */
        private void ThumbAssignMain(int page_num, int width, int height, double zoom_in, ref int offset)
        {
            m_pageType.Add(Page_Content_t.THUMBNAIL);
            DocPage doc_page = new DocPage();

            doc_page.Content = Page_Content_t.THUMBNAIL;
            doc_page.Zoom    = zoom_in;
            doc_page.BitMap  = m_thumbnails[page_num - 1].BitMap;
            doc_page.Width   = (int)(width / (Constants.SCALE_THUMB));
            doc_page.Height  = (int)(height / (Constants.SCALE_THUMB));
            doc_page.PageNum = page_num;
            m_docPages.Add(doc_page);
            m_toppage_pos.Add(offset + Constants.PAGE_VERT_MARGIN);
            offset += doc_page.Height + Constants.PAGE_VERT_MARGIN;
        }
        /* Done rendering. Update the pages with the new raster information if needed */
        private void RenderingDone()
        {
            int page_index = m_firstpage - 1;

            m_toppage_pos = new List <int>(m_images_rendered.Count + 1);
            int offset = 0;

            for (int k = 0; k < m_images_rendered.Count; k++)
            {
                DocPage doc_page = m_docPages[page_index + k];

                if (doc_page.Content != Page_Content_t.FULL_RESOLUTION ||
                    m_aa_change)
                {
                    doc_page.Width   = m_images_rendered[k].width;
                    doc_page.Height  = m_images_rendered[k].height;
                    doc_page.Content = Page_Content_t.FULL_RESOLUTION;

                    doc_page.Zoom   = m_doczoom;
                    doc_page.BitMap = BitmapSource.Create(doc_page.Width, doc_page.Height,
                                                          72, 72, PixelFormats.Bgr24, BitmapPalettes.Halftone256, m_images_rendered[k].bitmap, m_images_rendered[k].raster);
                }
                m_toppage_pos.Add(offset + Constants.PAGE_VERT_MARGIN);
                offset += doc_page.Height + Constants.PAGE_VERT_MARGIN;
            }

            xaml_ProgressGrid.Visibility = System.Windows.Visibility.Collapsed;
            xaml_RenderProgress.Value    = 0;
            m_aa_change = false;
            m_firstime  = false;
            m_toppage_pos.Add(offset);
            m_busy_rendering = false;
            m_images_rendered.Clear();
            m_file_open   = true;
            m_busy_render = false;
            m_ghostscript.gsPageRenderedMain -= new ghostsharp.gsCallBackPageRenderedMain(gsPageRendered);
        }