Implement #985 (comic2lrf, added a wide-aspect scaling option)

This commit is contained in:
Kovid Goyal 2008-08-29 17:39:33 -07:00
commit cf55451ecc
3 changed files with 51 additions and 20 deletions

View File

@ -159,6 +159,27 @@ class PageProcessor(list):
MagickResizeImage(wand, newsizex, newsizey, CatromFilter, 1.0)
MagickSetImageBorderColor(wand, pw)
MagickBorderImage(wand, pw, deltax, deltay)
elif self.opts.wide:
# Keep aspect and Use device height as scaled image width so landscape mode is clean
aspect = float(sizex) / float(sizey)
screen_aspect = float(SCRWIDTH) / float(SCRHEIGHT)
# Get dimensions of the landscape mode screen
# Add 25px back to height for the battery bar.
wscreenx = SCRHEIGHT + 25
wscreeny = int(wscreenx / screen_aspect)
if aspect <= screen_aspect:
newsizey = wscreeny
newsizex = int(newsizey * aspect)
deltax = (wscreenx - newsizex) / 2
deltay = 0
else:
newsizex = wscreenx
newsizey = int(newsizex / aspect)
deltax = 0
deltay = (wscreeny - newsizey) / 2
MagickResizeImage(wand, newsizex, newsizey, CatromFilter, 1.0)
MagickSetImageBorderColor(wand, pw)
MagickBorderImage(wand, pw, deltax, deltay)
else:
MagickResizeImage(wand, SCRWIDTH, SCRHEIGHT, CatromFilter, 1.0)
@ -251,6 +272,8 @@ def config(defaults=None):
help=_('Disable sharpening.'))
c.add_opt('landscape', ['-l', '--landscape'], default=False,
help=_("Don't split landscape images into two portrait images"))
c.add_opt('wide', ['-w', '--wide-aspect'], default=False,
help=_("Keep aspect ratio and scale image using screen height as image width for viewing in landscape mode."))
c.add_opt('right2left', ['--right2left'], default=False, action='store_true',
help=_('Used for right-to-left publications like manga. Causes landscape pages to be split into portrait pages from right to left.'))
c.add_opt('despeckle', ['-d', '--despeckle'], default=False,

View File

@ -58,6 +58,7 @@ class ComicConf(QDialog, Ui_Dialog):
self.opt_landscape.setChecked(opts.landscape)
self.opt_no_sort.setChecked(opts.no_sort)
self.opt_despeckle.setChecked(opts.despeckle)
self.opt_wide.setChecked(opts.wide)
self.opt_right2left.setChecked(opts.right2left)
for opt in self.config.option_set.preferences:

View File

@ -100,21 +100,21 @@
</property>
</widget>
</item>
<item row="7" column="0" >
<item row="8" column="0" >
<widget class="QCheckBox" name="opt_landscape" >
<property name="text" >
<string>&amp;Landscape</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<item row="10" column="0" >
<widget class="QCheckBox" name="opt_no_sort" >
<property name="text" >
<string>Don't so&amp;rt</string>
</property>
</widget>
</item>
<item row="11" column="1" >
<item row="12" column="1" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@ -124,20 +124,27 @@
</property>
</widget>
</item>
<item row="8" column="0" >
<item row="9" column="0" >
<widget class="QCheckBox" name="opt_right2left" >
<property name="text" >
<string>&amp;Right to left</string>
</property>
</widget>
</item>
<item row="10" column="0" >
<item row="11" column="0" >
<widget class="QCheckBox" name="opt_despeckle" >
<property name="text" >
<string>De&amp;speckle</string>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="opt_wide" >
<property name="text" >
<string>&amp;Wide</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>