Summary: | Remove excessive whitespace when vewing | ||
---|---|---|---|
Product: | [Applications] okular | Reporter: | kde2eran |
Component: | general | Assignee: | Okular developers <okular-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Proposed patch for trimming whitespace borders
Proposed patch for trimming whitespace borders Proposed patch for trimming whitespace borders |
Description
kde2eran
2008-05-04 12:35:01 UTC
Created attachment 24624 [details]
Proposed patch for trimming whitespace borders
Here's a rough patch that implements a "Trim Borders" mode for Okular, where
most of the white borders are stripped from every page.
This patch does the following:
- Add a "bounding box" property to Okular::Page
- Teach most of the generators to compute the page's bounding box when the page
is first rendered, by scanning the rendered image (pixel-by-pixel) for white
borders.
- Add a "crop" property to PageViewItem
- Add support for rendering cropped pages to PageView, PagePainter and
PageViewAnnotator.
- Add a "Trim Borders" mode to PageView, with a menu item under View and a
config item.
- When "Trim Borders" is enabled, set PageViewItem's crop according to the
page's bounding box.
- A few local comments/cleanups to help the next guy looking at this code.
Open issues:
- All the things pointed out in the new "TODO" comments.
- Add "native" bounding box computation (instead of pixel scanning) to
generators, where possible.
- Since we only scan pixels after pixmaps are generated, the layout of far-away
parts of the document will not reflect the cropped geometry. This causes the
layout to jump around annoyingly as more pages become visible and are cropped.
- Maybe there be a mode where all pages are cropped identically, so that
displayed text sizes are uniform.
- Needs testing and performance profiling.
Created attachment 24673 [details]
Proposed patch for trimming whitespace borders
Revised patch for trimming whitespace borders: same as the previous patch,
except for improved calculation of crop area.
(Can someone fix the typo in the bug's name?)
Created attachment 24825 [details]
Proposed patch for trimming whitespace borders
Revised version addressing Pino's comments. Same functionality, better
implementation.
SVN commit 809496 by pino: Make it possible to draw just sections (crops within bounding boxes) of pages. Separated normal & cropped geometries in page items; made the page painter able to draw based on a crop section; add a config + menu option for turning the white borders removal. Based on a patch by the Mr. anonymous kde2eran@tromer.org, thanks. BUG: 161599 M +3 -0 conf/okular.kcfg M +2 -1 part.rc M +33 -17 ui/pagepainter.cpp M +11 -0 ui/pagepainter.h M +163 -75 ui/pageview.cpp M +1 -0 ui/pageview.h M +13 -14 ui/pageviewannotator.cpp M +57 -20 ui/pageviewutils.cpp M +28 -6 ui/pageviewutils.h WebSVN link: http://websvn.kde.org/?view=rev&revision=809496 SVN commit 809593 by pino: Make the poppler(pdf), spectre(ps), dvi and chm backend calculate and set bounding box of pages. CCBUG: 161599 M +3 -0 chm/generator_chm.cpp M +3 -0 dvi/generator_dvi.cpp M +11 -2 poppler/generator_pdf.cpp M +4 -0 spectre/generator_ghostview.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=809593 |