[Okular-devel] [Bug 161599] Remove excessive whitespace when vewing

kde2eran at tromer.org kde2eran at tromer.org
Sun May 4 12:37:37 CEST 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=161599         




------- Additional Comments From kde2eran tromer org  2008-05-04 12:37 -------
Created an attachment (id=24624)
 --> (http://bugs.kde.org/attachment.cgi?id=24624&action=view)
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.


More information about the Okular-devel mailing list