diff options
| author | William Bader <williambader@hotmail.com> | 2015-01-14 23:28:03 +0100 |
|---|---|---|
| committer | Albert Astals Cid <aacid@kde.org> | 2015-01-14 23:28:03 +0100 |
| commit | 6b072500b5ac936631be6b29b7d5a591848a18f3 (patch) | |
| tree | 5552b4b870e1843fb74c5b39f2942b733a650c1f | |
| parent | dc9751e6ac47a708ba6e7a68560bdce6a2e4a010 (diff) | |
Add rasterization option to pdftops
Also removes GlobalParams stuff \o/
Coded in conjuntion with Albert
Bug #85934
| -rw-r--r-- | cpp/poppler-page-renderer.cpp | 5 | ||||
| -rw-r--r-- | poppler/GlobalParams.cc | 58 | ||||
| -rw-r--r-- | poppler/GlobalParams.h | 16 | ||||
| -rw-r--r-- | poppler/PSOutputDev.cc | 14 | ||||
| -rw-r--r-- | poppler/PSOutputDev.h | 5 | ||||
| -rw-r--r-- | poppler/SplashOutputDev.cc | 19 | ||||
| -rw-r--r-- | poppler/SplashOutputDev.h | 11 | ||||
| -rw-r--r-- | qt4/src/poppler-page.cc | 7 | ||||
| -rw-r--r-- | qt5/src/poppler-page.cc | 7 | ||||
| -rw-r--r-- | utils/pdftohtml.cc | 9 | ||||
| -rw-r--r-- | utils/pdftoppm.cc | 49 | ||||
| -rw-r--r-- | utils/pdftops.cc | 14 |
12 files changed, 96 insertions, 118 deletions
diff --git a/cpp/poppler-page-renderer.cpp b/cpp/poppler-page-renderer.cpp index 13171926..4c646846 100644 --- a/cpp/poppler-page-renderer.cpp +++ b/cpp/poppler-page-renderer.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010, Pino Toscano <pino@kde.org> + * Copyright (C) 2015 William Bader <williambader@hotmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,8 +172,8 @@ image page_renderer::render_page(const page *p, bgColor[0] = d->paper_color & 0xff; bgColor[1] = (d->paper_color >> 8) & 0xff; bgColor[2] = (d->paper_color >> 16) & 0xff; - const GBool text_AA = d->hints & text_antialiasing ? gTrue : gFalse; - SplashOutputDev splashOutputDev(splashModeXBGR8, 4, gFalse, bgColor, gTrue, text_AA); + SplashOutputDev splashOutputDev(splashModeXBGR8, 4, gFalse, bgColor, gTrue); + splashOutputDev.setFontAntialias(d->hints & text_antialiasing ? gTrue : gFalse); splashOutputDev.setVectorAntialias(d->hints & antialiasing ? gTrue : gFalse); splashOutputDev.setFreeTypeHinting(d->hints & text_hinting ? gTrue : gFalse, gFalse); splashOutputDev.startDoc(pdfdoc); diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index 3d88646f..b73ebb6c 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2005, 2007-2010, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com> // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> @@ -23,7 +23,7 @@ // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2007, 2009 Jonathan Kew <jonathan_kew@sil.org> // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// Copyright (C) 2009, 2011, 2012 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2011, 2012, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> // Copyright (C) 2010, 2012 Hib Eris <hib@hiberis.nl> // Copyright (C) 2010 Patrick Spendrin <ps_ml@gmx.de> @@ -620,9 +620,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) textPageBreaks = gTrue; textKeepTinyChars = gFalse; enableFreeType = gTrue; - antialias = gTrue; - vectorAntialias = gTrue; - antialiasPrinting = gFalse; strokeAdjust = gTrue; screenType = screenUnset; screenSize = -1; @@ -1701,33 +1698,6 @@ GBool GlobalParams::getEnableFreeType() { return f; } -GBool GlobalParams::getAntialias() { - GBool f; - - lockGlobalParams; - f = antialias; - unlockGlobalParams; - return f; -} - -GBool GlobalParams::getVectorAntialias() { - GBool f; - - lockGlobalParams; - f = vectorAntialias; - unlockGlobalParams; - return f; -} - -GBool GlobalParams::getAntialiasPrinting() { - GBool f; - - lockGlobalParams; - f = antialiasPrinting; - unlockGlobalParams; - return f; -} - GBool GlobalParams::getStrokeAdjust() { GBool f; @@ -2098,30 +2068,6 @@ GBool GlobalParams::setDisableFreeTypeHinting(char *s) { return ok; } -GBool GlobalParams::setAntialias(char *s) { - GBool ok; - - lockGlobalParams; - ok = parseYesNo2(s, &antialias); - unlockGlobalParams; - return ok; -} - -GBool GlobalParams::setVectorAntialias(char *s) { - GBool ok; - - lockGlobalParams; - ok = parseYesNo2(s, &vectorAntialias); - unlockGlobalParams; - return ok; -} - -void GlobalParams::setAntialiasPrinting(GBool anti) { - lockGlobalParams; - antialiasPrinting = anti; - unlockGlobalParams; -} - void GlobalParams::setStrokeAdjust(GBool adjust) { lockGlobalParams; diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h index c33a8024..f670641b 100644 --- a/poppler/GlobalParams.h +++ b/poppler/GlobalParams.h @@ -13,14 +13,14 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005, 2007-2010, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com> // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> // Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2009 Jonathan Kew <jonathan_kew@sil.org> // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> -// Copyright (C) 2009, 2011, 2012 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2011 Pino Toscano <pino@kde.org> // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> @@ -183,9 +183,6 @@ public: GBool getTextPageBreaks(); GBool getTextKeepTinyChars(); GBool getEnableFreeType(); - GBool getAntialias(); - GBool getVectorAntialias(); - GBool getAntialiasPrinting(); GBool getStrokeAdjust(); ScreenType getScreenType(); int getScreenSize(); @@ -238,9 +235,6 @@ public: void setTextKeepTinyChars(GBool keep); GBool setEnableFreeType(char *s); GBool setDisableFreeTypeHinting(char *s); - GBool setAntialias(char *s); - GBool setVectorAntialias(char *s); - void setAntialiasPrinting(GBool print); void setStrokeAdjust(GBool strokeAdjust); void setScreenType(ScreenType st); void setScreenSize(int size); @@ -256,6 +250,8 @@ public: void setProfileCommands(GBool profileCommandsA); void setErrQuiet(GBool errQuietA); + static GBool parseYesNo2(const char *token, GBool *flag); + //----- security handlers void addSecurityHandler(XpdfSecurityHandler *handler); @@ -264,7 +260,6 @@ public: private: void parseNameToUnicode(GooString *name); - GBool parseYesNo2(const char *token, GBool *flag); UnicodeMap *getUnicodeMap2(GooString *encodingName); void scanEncodingDirs(); @@ -342,9 +337,6 @@ private: GBool textKeepTinyChars; // keep all characters in text output GBool enableFreeType; // FreeType enable flag GBool disableFreeTypeHinting; // FreeType disable hinting flag - GBool antialias; // anti-aliasing enable flag - GBool vectorAntialias; // vector anti-aliasing enable flag - GBool antialiasPrinting; // allow anti-aliasing when printing GBool strokeAdjust; // stroke adjustment enable flag ScreenType screenType; // halftone screen type int screenSize; // screen matrix size diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index b95df310..b13476e5 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -23,7 +23,7 @@ // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2009, 2011, 2012 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> // Copyright (C) 2009-2011, 2013, 2014 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012, 2014 Fabio D'Urso <fabiodurso@hotmail.it> @@ -1230,6 +1230,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, } // initialize + rasterAntialias = gFalse; displayText = gTrue; ok = gTrue; outputFunc = outputFuncA; @@ -3202,24 +3203,23 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, numComps = 1; paperColor[0] = 0xff; splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); #if SPLASH_CMYK } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) { numComps = 4; paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0; splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); #endif } else { numComps = 3; paperColor[0] = paperColor[1] = paperColor[2] = 0xff; splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); } + splashOut->setFontAntialias(rasterAntialias); + splashOut->setVectorAntialias(rasterAntialias); splashOut->startDoc(doc); // break the page into stripes diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index 262ce14c..7f80899a 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -20,7 +20,7 @@ // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2009, 2011 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2011, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2011, 2014 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> @@ -308,6 +308,8 @@ public: { overlayCbk = cbk; overlayCbkData = data; } void setDisplayText(GBool display) { displayText = display; } + void setRasterAntialias(GBool a) { rasterAntialias = a; } + private: void init(PSOutputFunc outputFuncA, void *outputStreamA, @@ -488,6 +490,7 @@ private: GBool t3NeedsRestore; // set if a 'q' operator was issued GBool forceRasterize; // forces the page to be rasterized into a image before printing GBool displayText; // displayText + GBool rasterAntialias; // antialias on rasterize #if OPI_SUPPORT int opi13Nest; // nesting level of OPI 1.3 objects diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index bfb07eb7..b96232ff 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -15,14 +15,14 @@ // // Copyright (C) 2005 Takashi Iwai <tiwai@suse.de> // Copyright (C) 2006 Stefan Schweizer <genstef@gentoo.org> -// Copyright (C) 2006-2014 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006-2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2006 Scott Turner <scotty1024@mac.com> // Copyright (C) 2007 Koji Otani <sho@bbr.jp> // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> // Copyright (C) 2009-2014 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2009 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2014, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Patrick Spendrin <ps_ml@gmx.de> // Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> // Copyright (C) 2010 Paweł Wiejacha <pawel.wiejacha@gmail.com> @@ -1252,17 +1252,14 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA, - GBool allowAntialiasA, - SplashThinLineMode thinLineMode, - GBool overprintPreviewA) { + SplashThinLineMode thinLineMode, + GBool overprintPreviewA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; bitmapUpsideDown = gFalse; - allowAntialias = allowAntialiasA; - vectorAntialias = allowAntialias && - globalParams->getVectorAntialias() && - colorMode != splashModeMono1; + fontAntialias = gTrue; + vectorAntialias = gTrue; overprintPreview = overprintPreviewA; enableFreeTypeHinting = gFalse; enableSlightHinting = gFalse; @@ -1383,8 +1380,7 @@ void SplashOutputDev::startDoc(PDFDoc *docA) { enableFreeTypeHinting, enableSlightHinting, #endif - allowAntialias && - globalParams->getAntialias() && + getFontAntialias() && colorMode != splashModeMono1); for (i = 0; i < nT3Fonts; ++i) { delete t3FontCache[i]; @@ -4151,6 +4147,7 @@ GBool SplashOutputDev::getVectorAntialias() { } void SplashOutputDev::setVectorAntialias(GBool vaa) { + vaa = vaa && colorMode != splashModeMono1; vectorAntialias = vaa; splash->setVectorAntialias(vaa); } diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index efbb865c..ae20facc 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -20,7 +20,8 @@ // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> // Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2012, 2015 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2015 William Bader <williambader@hotmail.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -170,9 +171,8 @@ public: SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA = gTrue, - GBool allowAntialiasA = gTrue, SplashThinLineMode thinLineMode = splashThinLineDefault, - GBool overprintPreviewA = globalParams->getOverprintPreview()); + GBool overprintPreviewA = globalParams->getOverprintPreview()); // Destructor. virtual ~SplashOutputDev(); @@ -359,6 +359,9 @@ public: virtual void setVectorAntialias(GBool vaa); #endif + GBool getFontAntialias() { return fontAntialias; } + void setFontAntialias(GBool anti) { fontAntialias = anti; } + void setFreeTypeHinting(GBool enable, GBool enableSlightHinting); protected: @@ -396,7 +399,7 @@ private: int bitmapRowPad; GBool bitmapTopDown; GBool bitmapUpsideDown; - GBool allowAntialias; + GBool fontAntialias; GBool vectorAntialias; GBool overprintPreview; GBool enableFreeTypeHinting; diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index fc928b90..9c99cda7 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <bradh@frogmouth.net> - * Copyright (C) 2005-2014, Albert Astals Cid <aacid@kde.org> + * Copyright (C) 2005-2015, Albert Astals Cid <aacid@kde.org> * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de> * Copyright (C) 2006-2011, Pino Toscano <pino@kde.org> * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org> @@ -14,6 +14,7 @@ * Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> * Copyright (C) 2012 Adam Reichold <adamreichold@myopera.com> * Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> + * Copyright (C) 2015 William Bader <williambader@hotmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -293,7 +294,6 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, bgColor[2] = m_page->parentDoc->paperColor.red(); } - GBool AA = m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse; SplashThinLineMode thinLineMode = splashThinLineDefault; if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape; if (m_page->parentDoc->m_hints & Document::ThinLineSolid) thinLineMode = splashThinLineSolid; @@ -304,8 +304,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, #else splashModeXBGR8, #endif - 4, gFalse, bgColor, gTrue, AA, thinLineMode, overprint); + 4, gFalse, bgColor, gTrue, thinLineMode, overprint); + splash_output->setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse); splash_output->setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse); splash_output->setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, m_page->parentDoc->m_hints & Document::TextSlightHinting ? gTrue : gFalse); diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index 6eea0d00..eec211e1 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <bradh@frogmouth.net> - * Copyright (C) 2005-2014, Albert Astals Cid <aacid@kde.org> + * Copyright (C) 2005-2015, Albert Astals Cid <aacid@kde.org> * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de> * Copyright (C) 2006-2011, Pino Toscano <pino@kde.org> * Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org> @@ -14,6 +14,7 @@ * Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> * Copyright (C) 2012 Adam Reichold <adamreichold@myopera.com> * Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> + * Copyright (C) 2015 William Bader <williambader@hotmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -293,7 +294,6 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, bgColor[2] = m_page->parentDoc->paperColor.red(); } - GBool AA = m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse; SplashThinLineMode thinLineMode = splashThinLineDefault; if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape; if (m_page->parentDoc->m_hints & Document::ThinLineSolid) thinLineMode = splashThinLineSolid; @@ -304,8 +304,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, #else splashModeXBGR8, #endif - 4, gFalse, bgColor, gTrue, AA, thinLineMode, overprint); + 4, gFalse, bgColor, gTrue, thinLineMode, overprint); + splash_output->setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse); splash_output->setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse); splash_output->setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, m_page->parentDoc->m_hints & Document::TextSlightHinting ? gTrue : gFalse); diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index aabed0b7..ffd559e6 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.cc @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2007-2008, 2010, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2007-2008, 2010, 2012, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2010 Mike Slegeir <tehpola@yahoo.com> // Copyright (C) 2010, 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> @@ -23,6 +23,7 @@ // Copyright (C) 2012 Ihar Filipau <thephilips@gmail.com> // Copyright (C) 2012 Luis Parravicini <lparravi@gmail.com> // Copyright (C) 2014 Pino Toscano <pino@kde.org> +// Copyright (C) 2015 William Bader <williambader@hotmail.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -155,10 +156,8 @@ class SplashOutputDevNoText : public SplashOutputDev { public: SplashOutputDevNoText(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA = gTrue, - GBool allowAntialiasA = gTrue) : SplashOutputDev(colorModeA, - bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA, - allowAntialiasA) { } + GBool bitmapTopDownA = gTrue) : SplashOutputDev(colorModeA, + bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA) { } virtual ~SplashOutputDevNoText() { } void drawChar(GfxState *state, double x, double y, diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc index 962860b1..7ff5b22e 100644 --- a/utils/pdftoppm.cc +++ b/utils/pdftoppm.cc @@ -18,7 +18,7 @@ // Copyright (C) 2009 Michael K. Johnson <a1237@danlj.org> // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2009-2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009-2011, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2010 Jonathan Liu <net147@gmail.com> @@ -26,6 +26,7 @@ // Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> +// Copyright (C) 2015 William Bader <williambader@hotmail.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -268,6 +269,20 @@ static std::deque<PageJob> pageJobQueue; static pthread_mutex_t pageJobMutex = PTHREAD_MUTEX_INITIALIZER; static void processPageJobs() { + GBool fontAntialias = gTrue; + GBool vectorAntialias = gTrue; + + if (antialiasStr[0]) { + if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) { + fprintf(stderr, "Bad '-aa' value on command line\n"); + } + } + if (vectorAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) { + fprintf(stderr, "Bad '-aaVector' value on command line\n"); + } + } + while(true) { // pop the next job or exit if queue is empty pthread_mutex_lock(&pageJobMutex); @@ -288,7 +303,9 @@ static void processPageJobs() { #if SPLASH_CMYK (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif - splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, gTrue, thinLineMode); + splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, thinLineMode); + splashOut->setFontAntialias(fontAntialias); + splashOut->setVectorAntialias(vectorAntialias); splashOut->startDoc(pageJob.doc); savePageSlice(pageJob.doc, splashOut, pageJob.pg, x, y, w, h, pageJob.pg_w, pageJob.pg_h, pageJob.ppmFile); @@ -328,6 +345,8 @@ int main(int argc, char *argv[]) { int exitCode; int pg, pg_num_len; double pg_w, pg_h, tmp; + GBool fontAntialias = gTrue; + GBool vectorAntialias = gTrue; exitCode = 99; @@ -363,16 +382,6 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Bad '-freetype' value on command line\n"); } } - if (antialiasStr[0]) { - if (!globalParams->setAntialias(antialiasStr)) { - fprintf(stderr, "Bad '-aa' value on command line\n"); - } - } - if (vectorAntialiasStr[0]) { - if (!globalParams->setVectorAntialias(vectorAntialiasStr)) { - fprintf(stderr, "Bad '-aaVector' value on command line\n"); - } - } if (thinLineModeStr[0]) { if (strcmp(thinLineModeStr, "solid") == 0) { thinLineMode = splashThinLineSolid; @@ -464,7 +473,21 @@ int main(int argc, char *argv[]) { (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif splashModeRGB8, 4, - gFalse, paperColor, gTrue, gTrue, thinLineMode); + gFalse, paperColor, gTrue, thinLineMode); + + if (antialiasStr[0]) { + if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) { + fprintf(stderr, "Bad '-aa' value on command line\n"); + } + } + if (vectorAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) { + fprintf(stderr, "Bad '-aaVector' value on command line\n"); + } + } + + splashOut->setFontAntialias(fontAntialias); + splashOut->setVectorAntialias(vectorAntialias); splashOut->startDoc(doc); #endif // UTILS_USE_PTHREADS diff --git a/utils/pdftops.cc b/utils/pdftops.cc index fbc3d67c..43234dbe 100644 --- a/utils/pdftops.cc +++ b/utils/pdftops.cc @@ -19,7 +19,7 @@ // Copyright (C) 2007-2008, 2010, 2015 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com> // Copyright (C) 2009 Sanjoy Mahajan <sanjoy@mit.edu> -// Copyright (C) 2009, 2011, 2012 William Bader <williambader@hotmail.com> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> @@ -95,6 +95,7 @@ static GBool noEmbedTTFonts = gFalse; static GBool noEmbedCIDPSFonts = gFalse; static GBool noEmbedCIDTTFonts = gFalse; static GBool fontPassthrough = gFalse; +static char rasterAntialiasStr[16] = ""; static GBool preload = gFalse; static char paperSize[15] = ""; static int paperWidth = -1; @@ -154,6 +155,8 @@ static const ArgDesc argDesc[] = { "don't embed CID TrueType fonts"}, {"-passfonts", argFlag, &fontPassthrough,0, "don't substitute missing fonts"}, + {"-aaRaster", argString, rasterAntialiasStr, sizeof(rasterAntialiasStr), + "enable anti-aliasing on rasterization: yes, no"}, {"-preload", argFlag, &preload, 0, "preload images and forms"}, {"-paper", argString, paperSize, sizeof(paperSize), @@ -206,6 +209,7 @@ int main(int argc, char *argv[]) { GBool ok; char *p; int exitCode; + GBool rasterAntialias = gFalse; std::vector<int> pages; exitCode = 99; @@ -412,6 +416,14 @@ int main(int argc, char *argv[]) { paperHeight, noCrop, duplex); + + if (rasterAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(rasterAntialiasStr, &rasterAntialias)) { + fprintf(stderr, "Bad '-aaRaster' value on command line\n"); + } + } + + psOut->setRasterAntialias(rasterAntialias); if (psOut->isOk()) { for (int i = firstPage; i <= lastPage; ++i) { doc->displayPage(psOut, i, 72, 72, |
