View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008308 | Scribus | Graphics / Image Frames | public | 2009-07-28 13:18 | 2015-04-29 01:49 |
Reporter | Shaforostoff | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | feedback | Resolution | open | ||
Product Version | 1.5.0svn | ||||
Summary | 0008308: [patch] unload unused images from RAM and restore them silently on the next access | ||||
Description | First of all, thanks for applying my previous optimization patches. Seeing that Scribus takes a lot of RAM (over 500), and hence becomes very slow on a computer with 512 mb ram) I made small research and I was surprised that it keeps all document images in RAM, uncompressed. Attached is the patch (mainly on scimage.*) that saves RAM by unloading images that ain't used for more than 10 seconds (it may be e.g. images from other pages that user doesn't look at at the moment). It keeps track of gross bytes taken up by images, and if it is > 128 mb, than it also unloads image right after it was loaded, so that scribus stays alive when opening document with alot of images on low ram computers. It would be cool if scribus didn't have to load all images of the document on opening at all, but it is another story^Wpatch. I also couldn't stand long compile times so lowered file interdependencies by using more granular including. I tried to subscribe to scribus-dev@ to discuss the patch, but it says I must wait for moderator approval (shaforostoff atat kde.ru). Particularly I wanted to ask about ScImage::getAlpha method... | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
2009-07-28 13:18
|
offload-images_and_decouple-header-dependencies.patch (115,556 bytes)
Index: gtaction.cpp =================================================================== --- gtaction.cpp (revision 13792) +++ gtaction.cpp (working copy) @@ -24,23 +24,28 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "gtaction.h" +#include "gtfont.h" +#include "gtframestyle.h" +#include "gtparagraphstyle.h" +#include "gtstyle.h" #include "missing.h" -#include "gtaction.h" #include "propertiespalette.h" #include "scribus.h" -#include <QCursor> -#include <QStringList> -//Added by qt3to4: -#include <QList> #include "color.h" #include "prefsmanager.h" #include "hyphenator.h" #include "scclocale.h" #include "selection.h" +#include "scribusdoc.h" #include "commonstrings.h" #include "util_icon.h" #include "sccolorengine.h" +#include <QCursor> +#include <QStringList> +#include <QList> + // gtAction::gtAction(bool append) // { // prefsManager=PrefsManager::instance(); Index: nodeeditpalette.cpp =================================================================== --- nodeeditpalette.cpp (revision 13792) +++ nodeeditpalette.cpp (working copy) @@ -10,6 +10,7 @@ #include "nodeeditpalette.h" #include "page.h" #include "pageitem.h" +#include "scribusdoc.h" #include "scribusview.h" #include "selection.h" #include "undomanager.h" Index: canvasmode_nodeedit.cpp =================================================================== --- canvasmode_nodeedit.cpp (revision 13792) +++ canvasmode_nodeedit.cpp (working copy) @@ -25,6 +25,7 @@ #include "pageselector.h" #include "scraction.h" #include "scrapbookpalette.h" +#include "scrspinbox.h" #include "scribus.h" #include "scribusdoc.h" #include "scribusview.h" Index: extimageprops.h =================================================================== --- extimageprops.h (revision 13792) +++ extimageprops.h (working copy) @@ -26,7 +26,7 @@ class ScribusView; class PageItem; #include "scribusapi.h" -#include "scimage.h" +#include "scimagestructs.h" class SCRIBUS_API ExtImageProps : public QDialog { Index: newfile.cpp =================================================================== --- newfile.cpp (revision 13792) +++ newfile.cpp (working copy) @@ -28,7 +28,7 @@ #else #include "customfdialog.h" #endif - +#include "nftwidget.h" #include "fileloader.h" #include "prefsfile.h" #include "units.h" @@ -44,6 +44,7 @@ #include "sccombobox.h" #include "util_icon.h" + PageLayoutsWidget::PageLayoutsWidget(QWidget* parent) : QListWidget(parent) { setDragEnabled(false); Index: pagepalette.cpp =================================================================== --- pagepalette.cpp (revision 13792) +++ pagepalette.cpp (working copy) @@ -25,6 +25,7 @@ #include "pagepalette.h" #include "sccombobox.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribusview.h" #include "util_icon.h" Index: page.cpp =================================================================== --- page.cpp (revision 13792) +++ page.cpp (working copy) @@ -24,10 +24,11 @@ #include <QDebug> #include <QPixmap> +#include "page.h" #include "guidemanager.h" #include "nodeeditpalette.h" -#include "page.h" #include "scribus.h" +#include "scribusdoc.h" #include "selection.h" #include "undomanager.h" #include "undostate.h" Index: scimage_p.h =================================================================== --- scimage_p.h (revision 0) +++ scimage_p.h (revision 0) @@ -0,0 +1,114 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#ifndef SCIMAGE_P_H +#define SCIMAGE_P_H + +#include "cmsettings.h" +#include "scimage.h" + +#include <QVector> +#include <QImage> +#include <QObject> +#include <QTimer> + + +struct ScImage::Private: public QObject, public QImage +{ + Q_OBJECT + +private: + ScImage* q; + +public: + Private(ScImage* q_) + : QObject(), QImage() + , q(q_) + , height_(0) + , width_(0) + , imLoadSettings(0) + {} + + Private(ScImage* q_, int width, int height) + : QObject(), QImage(width, height, QImage::Format_ARGB32 ) + , q(q_) + , height_(height) + , width_(width) + , imLoadSettings(0) + {} + + virtual ~Private() + { + delete imLoadSettings; + } + + Private& operator=(const Private& other); + + void restore(); + void doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + bool doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); + + + struct ImageLoadSettings + { + QString fileName; + int page; + CMSettings cmSettings; + bool useEmbedded; + bool useProf; + RequestType requestType; + int gsRes; + + ImageLoadSettings(const CMSettings& s):cmSettings(s){} + }; + + struct ImageEffectSettings + { + ScImageEffectList effectsList; + ColorList colors; + bool cmyk; + bool convertToGray; + bool scale; //when scaleImage was called; + + ImageEffectSettings() + : cmyk(false) + , convertToGray(false) + , scale(false) + {} + }; + + int height_; + int width_; + QTimer clearTimer; + + ImageLoadSettings* imLoadSettings; + QVector<ImageEffectSettings> imEffectSettings; + + // Image effects + void solarize(double factor, bool cmyk); + void blur(int radius = 0); + void sharpen(double radius= 0.0, double sigma = 1.0); + void contrast(int contrastValue, bool cmyk); + void brightness(int brightnessValue, bool cmyk); + void invert(bool cmyk); + void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); + void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); + void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); + void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); + void toGrayscale(bool cmyk); + void doGraduate(FPointArray curve, bool cmyk, bool linear); + void swapRGBA(); + bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); + int getOptimalKernelWidth(double radius, double sigma); + void applyCurve(const QVector<int>& curveTable, bool cmyk); + +public Q_SLOTS: + void clear(); +}; + +#endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; tab-width 4; Index: cpalette.h =================================================================== --- cpalette.h (revision 13792) +++ cpalette.h (working copy) @@ -42,7 +42,6 @@ class QToolButton; class QVBoxLayout; #include "scribusapi.h" -#include "gradienteditor.h" #include "scribusdoc.h" #include "scrpalettebase.h" @@ -52,6 +51,7 @@ class ScComboBox; class ScPattern; class LinkButton; +class GradientEditor; /** *@author Franz Schmid Index: scpageoutput_ps2.cpp =================================================================== --- scpageoutput_ps2.cpp (revision 13792) +++ scpageoutput_ps2.cpp (working copy) @@ -9,6 +9,7 @@ #include "commonstrings.h" #include "fonts/scfontmetrics.h" +#include "page.h" #include "pageitem.h" #include "scimage.h" #include "scpageoutput_ps2.h" Index: fonts/scface.cpp =================================================================== --- fonts/scface.cpp (revision 13792) +++ fonts/scface.cpp (working copy) @@ -4,17 +4,13 @@ #include "fonts/scface.h" #include "text/storytext.h" +static const QString NONE_LITERAL("(None)"); + ScFace::ScFaceData::ScFaceData() : refs(0), usage(0), - scName(""), - fontFile("(None)"), + fontFile(NONE_LITERAL), faceIndex(-1), - psName(""), - family(""), - style(""), - variant(""), - forDocument(""), status(ScFace::NULLFACE), typeCode(ScFace::UNKNOWN_TYPE), formatCode(ScFace::UNKNOWN_FORMAT), @@ -133,24 +129,21 @@ unicode emulate: spaces, hyphen, ligatures?, diacritics? *****/ -ScFace::ScFace() : replacedName(), replacedInDoc() +ScFace::ScFace() : m(new ScFaceData()) { - m = new ScFaceData(); m->refs = 1; m->usage = 0; } -ScFace::ScFace(ScFaceData* data) : replacedName(), replacedInDoc() +ScFace::ScFace(ScFaceData* data) : m(data) { - m = data; ++(m->refs); m->cachedStatus = ScFace::UNKNOWN; } -ScFace::ScFace(const ScFace& other) : replacedName(other.replacedName), replacedInDoc(other.replacedInDoc) +ScFace::ScFace(const ScFace& other) : m(other.m), replacedName(other.replacedName), replacedInDoc(other.replacedInDoc) { - m = other.m; ++(m->refs); } @@ -159,7 +152,6 @@ if ( m && --(m->refs) == 0 ) { m->unload(); delete m; - m = 0; } } Index: scribusview.h =================================================================== --- scribusview.h (revision 13792) +++ scribusview.h (working copy) @@ -53,6 +53,7 @@ #include <QRect> #include <QRectF> #include <QTime> +#include <QTimer> #include <QWheelEvent> #include <QRubberBand> #include <QList> @@ -63,8 +64,7 @@ // application specific includes #include "observable.h" #include "scribusapi.h" -#include "scribusdoc.h" -#include "scrspinbox.h" +#include "prefsmanager.h" class Canvas; class CanvasMode; @@ -73,9 +73,13 @@ class Vruler; class Page; class RulerMover; +class PageItem; class PageSelector; +class ScribusDoc; class ScribusWin; class ScribusMainWindow; +class ScrSpinBox; +class Selection; class UndoManager; class UndoTransaction; class TransactionSettings; Index: scimgdataloader_pdf.cpp =================================================================== --- scimgdataloader_pdf.cpp (revision 13792) +++ scimgdataloader_pdf.cpp (working copy) @@ -5,6 +5,7 @@ for which a new license (GPL+exception) is in place. */ #include <QDebug> +#include <QDir> #include <QFile> #include <QFileInfo> Index: layers.cpp =================================================================== --- layers.cpp (revision 13792) +++ layers.cpp (working copy) @@ -34,6 +34,7 @@ #include "sccombobox.h" #include "scribus.h" +#include "scribusdoc.h" #include "undomanager.h" #include "util_icon.h" Index: scplugin.cpp =================================================================== --- scplugin.cpp (revision 13792) +++ scplugin.cpp (working copy) @@ -10,6 +10,7 @@ #include "scribus.h" #include "scribusapp.h" #include "prefspanel.h" +#include "scribusdoc.h" #include "selection.h" //=====================================================// Index: sccolorengine.cpp =================================================================== --- sccolorengine.cpp (revision 13792) +++ sccolorengine.cpp (working copy) @@ -23,6 +23,7 @@ #include "sccolorengine.h" #include "scribuscore.h" +#include "scribusdoc.h" #include CMS_INC QColor ScColorEngine::getRGBColor(const ScColor& color, const ScribusDoc* doc) Index: scribusXml.cpp =================================================================== --- scribusXml.cpp (revision 13792) +++ scribusXml.cpp (working copy) @@ -35,9 +35,11 @@ #include "page.h" #include "pageitem.h" #include "pageitem_latexframe.h" +#include "selection.h" #include "units.h" #include "prefsmanager.h" #include "scribusview.h" +#include "scribusdoc.h" #include "scclocale.h" #include "commonstrings.h" #include "text/nlsconfig.h" Index: tabtools.cpp =================================================================== --- tabtools.cpp (revision 13792) +++ tabtools.cpp (working copy) @@ -31,6 +31,7 @@ #include "linkbutton.h" #include "scribusstructs.h" #include "scribus.h" +#include "scribusdoc.h" #include "util_icon.h" #include "prefsmanager.h" #include "scfonts.h" Index: scpageoutput.h =================================================================== --- scpageoutput.h (revision 13792) +++ scpageoutput.h (working copy) @@ -13,6 +13,7 @@ #include "scribusapi.h" #include "sccolor.h" #include "scpainterexbase.h" +#include "scimage.h" class ScribusDoc; class Page; Index: gtwriter.h =================================================================== --- gtwriter.h (revision 13792) +++ gtwriter.h (working copy) @@ -29,10 +29,6 @@ #include "scribusapi.h" #include "gtaction.h" -#include "gtfont.h" -#include "gtframestyle.h" -#include "gtparagraphstyle.h" -#include "gtstyle.h" class PageItem; Index: scpageoutput.cpp =================================================================== --- scpageoutput.cpp (revision 13792) +++ scpageoutput.cpp (working copy) @@ -940,7 +940,7 @@ imScaleX *= (72.0 / (double) m_imageRes); imScaleY *= (72.0 / (double) m_imageRes); } - scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); + scImg.applyEffects(item->effectsInUse, m_doc->PageColors, useCmyk); mode = imageMode; pImage = &scImg; } Index: storyeditor.cpp =================================================================== --- storyeditor.cpp (revision 13792) +++ storyeditor.cpp (working copy) @@ -69,6 +69,7 @@ #include "scplugin.h" #include "scraction.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scrspinbox.h" #include "search.h" #include "serializer.h" Index: pageitem.cpp =================================================================== --- pageitem.cpp (revision 13792) +++ pageitem.cpp (working copy) @@ -4853,7 +4853,7 @@ } effectsInUse.append(ef); } - pixm.applyEffect(effectsInUse, m_Doc->PageColors, false); + pixm.applyEffects(effectsInUse, m_Doc->PageColors, false); // if (reload) pixm.imgInfo.lowResType = lowResTypeBack; if (pixm.imgInfo.lowResType != 0) @@ -4868,7 +4868,7 @@ double ratio = pixels / 3000000.0; scaling *= sqrt(ratio); } - pixm.createLowRes(scaling); + pixm.lowerResolution(scaling); pixm.imgInfo.lowResScale = scaling; } if ((m_Doc->view()->m_canvas->usePreviewVisual())) Index: scribusview.cpp =================================================================== --- scribusview.cpp (revision 13792) +++ scribusview.cpp (working copy) @@ -107,7 +107,9 @@ #include "scpainter.h" #include "scpaths.h" #include "scrapbookpalette.h" +#include "scrspinbox.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusXml.h" #include "selection.h" #include "serializer.h" Index: canvasmode_rotate.cpp =================================================================== --- canvasmode_rotate.cpp (revision 13792) +++ canvasmode_rotate.cpp (working copy) @@ -25,6 +25,8 @@ #include "pageitem.h" #include "pageselector.h" #include "prefsmanager.h" +#include "scrspinbox.h" +#include "scribusdoc.h" #include "scribusview.h" #include "selection.h" #include "undomanager.h" Index: text/storytext.cpp =================================================================== --- text/storytext.cpp (revision 13792) +++ text/storytext.cpp (working copy) @@ -337,7 +337,7 @@ for (int i = 0; i < txt.length(); ++i) { ScText * item = new ScText(clone); - item->ch= txt.at(i); + item->ch=txt.at(i); item->setContext(cStyleContext); d->insert(pos + i, item); d->len++; Index: style.h =================================================================== --- style.h (revision 13792) +++ style.h (working copy) @@ -21,7 +21,6 @@ #include <QString> #include "scfonts.h" #include "scribusapi.h" -#include "sccolor.h" #include "styles/stylecontext.h" #include "desaxe/saxio.h" @@ -46,9 +45,9 @@ public: // static const short NOVALUE = -16000; - Style(): m_isDefaultStyle(false), m_name(""), m_context(NULL), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(): m_isDefaultStyle(false), m_context(NULL), m_contextversion(-1), m_shortcut() {} - Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_shortcut() {} Style& operator=(const Style& o) { //assert(typeinfo() == o.typeinfo()); @@ -80,7 +79,7 @@ bool isDefaultStyle() const { return m_isDefaultStyle; } QString name() const { return m_name; } - void setName(const QString& n) { m_name = n.isEmpty() ? "" : n; } + void setName(const QString& n) { m_name = n; } bool hasName() const { return ! m_name.isEmpty(); } virtual QString displayName() const = 0;/*{ @@ -140,7 +139,7 @@ */ void applyStyle(const Style& other) { if (other.hasParent()) - setParent( other.parent() == INHERIT_PARENT? "" :other.parent()); + setParent( other.parent() == INHERIT_PARENT? QString() :other.parent()); m_contextversion = -1; } /** @@ -148,7 +147,7 @@ */ void eraseStyle(const Style& other) { if (other.parent() == parent()) - setParent(""); + setParent(QString()); m_contextversion = -1; } }; Index: scribus.cpp =================================================================== --- scribus.cpp (revision 13792) +++ scribus.cpp (working copy) @@ -178,9 +178,11 @@ #include "scraction.h" #include "scrapbookpalette.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribusXml.h" #include "scribusapp.h" #include "scribuscore.h" +#include "scribusview.h" #include "scribuswin.h" #include "search.h" #include "selection.h" Index: canvasmode_objimport.cpp =================================================================== --- canvasmode_objimport.cpp (revision 13792) +++ canvasmode_objimport.cpp (working copy) @@ -32,6 +32,7 @@ #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" +#include "scrspinbox.h" #include "scribus.h" #include "scribusdoc.h" #include "scribusview.h" Index: propertiespalette.cpp =================================================================== --- propertiespalette.cpp (revision 13792) +++ propertiespalette.cpp (working copy) @@ -50,6 +50,7 @@ #include "colorlistbox.h" #include "sccolorengine.h" #include "cpalette.h" +#include "gradienteditor.h" #include "pageitem_textframe.h" #include "sccombobox.h" #include "scfonts.h" Index: selfield.cpp =================================================================== --- selfield.cpp (revision 13792) +++ selfield.cpp (working copy) @@ -18,6 +18,7 @@ #include "commonstrings.h" #include "scfonts.h" +#include "scribusdoc.h" #include "util_icon.h" SelectFields::SelectFields(QWidget* parent, QString Felder, QString Own, ScribusDoc *Doc, int Art) : QDialog(parent) Index: outlinepalette.cpp =================================================================== --- outlinepalette.cpp (revision 13792) +++ outlinepalette.cpp (working copy) @@ -28,6 +28,7 @@ #include "page.h" #include "propertiespalette.h" #include "scribus.h" +#include "scribusdoc.h" #include "selection.h" #include "undomanager.h" #include "util.h" Index: latexhelpers.cpp =================================================================== --- latexhelpers.cpp (revision 13792) +++ latexhelpers.cpp (working copy) @@ -24,6 +24,8 @@ #include <QDebug> #include <QFile> +#include <QFileInfo> +#include <QDir> #include <QMessageBox> #include "prefsmanager.h" Index: pdflib_core.cpp =================================================================== --- pdflib_core.cpp (revision 13792) +++ pdflib_core.cpp (working copy) @@ -506,7 +506,7 @@ tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg"); if ((gray) && (!precal)) image.convertToGray(); - if (image.Convert2JPG(tmpFile, Options.Quality, cmyk, gray)) + if (image.saveToJpg(tmpFile, Options.Quality, cmyk, gray)) jpgFileName = tmpFile; } if (jpgFileName.isEmpty()) @@ -2259,7 +2259,7 @@ { ScImage img(pm.toImage()); bool compDataAvail = false; - QByteArray array = img.ImageToArray(); + QByteArray array = img.toArray(); if (Options.Compress) { QByteArray compArray = CompressArray(array); @@ -6918,7 +6918,7 @@ img.imgInfo.progressive = prog; } else - img.scaleImage(qRound(ax), qRound(ay)); + img.scale(qRound(ax), qRound(ay)); ImInfo.sxa = sx * a2; ImInfo.sya = sy * a1; } @@ -6943,14 +6943,13 @@ { if (!ICCProfiles.contains(Profil)) { - ScImage img3; int components = 0; uint embeddedProfile = newObject(); StartObj(embeddedProfile); QByteArray dataP; struct ICCD dataD; if ((Embedded) && (!Options.EmbeddedI)) - img3.getEmbeddedProfile(fn, &dataP, &components); + dataP=ScImage::getEmbeddedProfile(fn, &components); if ((dataP.isEmpty()) || ((img.imgInfo.colorspace == ColorSpaceGray) && (hasColorEffect) && (components == 1))) { if (img.imgInfo.colorspace == ColorSpaceCMYK) @@ -7099,7 +7098,7 @@ } origWidth = img.width(); origHeight = img.height(); - img.applyEffect(c->effectsInUse, c->doc()->PageColors, imgE); + img.applyEffects(c->effectsInUse, c->doc()->PageColors, imgE); if (!((Options.RecalcPic) && (Options.PicRes < (qMax(72.0 / c->imageXScale(), 72.0 / c->imageYScale()))))) { ImInfo.sxa = sx * (1.0 / ImInfo.reso); Index: scimage.h =================================================================== --- scimage.h (revision 13792) +++ scimage.h (working copy) @@ -10,34 +10,34 @@ #include "scconfig.h" #include "scribusapi.h" #include "scimagestructs.h" +#include "fpointarray.h" +#include "sccolor.h" + #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <QImage> #include <QString> -#include <QDataStream> -#include <QMap> -#include <QList> -#include <QVector> -#include <QFile> -#include <QDir> -#include <QStringList> -#include "fpointarray.h" -#include "sccolor.h" class ScribusDoc; class ScStreamFilter; class CMSettings; -class SCRIBUS_API ScImage : private QImage +/** + * clears its internal data if itsn't accessed for some time (10 seconds) + * and restores it on the next access, reapplying all the effects and transformations + * (graying and scaling) + */ +class SCRIBUS_API ScImage { + public: ScImage(); - ScImage(const QImage & image); - ScImage(const ScImage & image); - ScImage( int width, int height ); + ScImage(const QImage& image); + ScImage(const ScImage& image); + ScImage(int width, int height); ~ScImage(); enum RequestType @@ -66,68 +66,59 @@ }; void initialize(); + ScImage & operator=(const ScImage & other); - const QImage& qImage(); + + QImage qImage() const; + /** + * be careful not to save the pointer until the next event loop run: + * it may be cleared by timer + */ QImage* qImagePtr(); QImage scaled(int h, int w, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + + int height() const; + int width() const; + bool hasAlpha() const; - int height() const { return QImage::height(); } - int width() const { return QImage::width(); } - bool hasAlpha() const { return QImage::hasAlphaChannel(); } - - // Routines for PDF/PS output of images - QByteArray ImageToArray(); + bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - void convertToGray(void); + void convertToGray(); - bool writeRGBDataToFilter(ScStreamFilter* filter); - bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal); - bool writeCMYKDataToFilter(ScStreamFilter* filter); + void applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + /// Generate a low res image for user preview + void lowerResolution(double scale); + /// Scale this image in-place + void scale(int width, int height); - bool writePSImageToFilter(ScStreamFilter* filter, int pl); - bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl); + // Routines for PDF/PS output of images + QByteArray toArray() const; - bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - bool Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray); + bool writeRGBDataToFilter(ScStreamFilter* filter) const; + bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const; + bool writeCMYKDataToFilter(ScStreamFilter* filter) const; - // Image effects - void applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk); + bool writePSImageToFilter(ScStreamFilter* filter, int pl) const; + bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const; - // Generate a low res image for user preview - void createLowRes(double scale); + bool saveToJpg(QString fn, int quality, bool isCMYK, bool isGray) const; - // Scale this image in-place - void scaleImage(int width, int height); - // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. - // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. - void getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page = 0); - // Load an image into this ScImage instance // TODO: document params, split into smaller functions bool LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); - ImageInfoRecord imgInfo; -private: + // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. + // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. + static QByteArray getEmbeddedProfile(const QString & fn, int *components, int page = 0); - // Image effects - void solarize(double factor, bool cmyk); - void blur(int radius = 0); - void sharpen(double radius= 0.0, double sigma = 1.0); - void contrast(int contrastValue, bool cmyk); - void brightness(int brightnessValue, bool cmyk); - void invert(bool cmyk); - void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); - void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); - void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); - void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); - void toGrayscale(bool cmyk); - void doGraduate(FPointArray curve, bool cmyk, bool linear); - void swapRGBA(); - bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); - int getOptimalKernelWidth(double radius, double sigma); - void applyCurve(const QVector<int>& curveTable, bool cmyk); + ImageInfoRecord imgInfo; +private: + class Private; + mutable Private* d; }; #endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: pdfopts.cpp =================================================================== --- pdfopts.cpp (revision 13792) +++ pdfopts.cpp (working copy) @@ -33,6 +33,7 @@ #include "pdfoptions.h" #include "prefsfile.h" #include "prefsmanager.h" +#include "scrspinbox.h" #include "scconfig.h" #include "scpaths.h" #include "scribusview.h" Index: hyphenator.cpp =================================================================== --- hyphenator.cpp (revision 13792) +++ hyphenator.cpp (working copy) @@ -37,6 +37,7 @@ #include "langmgr.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "prefsfile.h" #include "prefsmanager.h" #include "text/nlsconfig.h" Index: pslib.h =================================================================== --- pslib.h (revision 13792) +++ pslib.h (working copy) @@ -33,9 +33,6 @@ #include <QPen> #include <QString> -class ScribusDoc; - -#include "page.h" #include "scribusapi.h" #include "scribusstructs.h" #include CMS_INC @@ -44,6 +41,8 @@ class ScText; #endif +class Page; +class ScribusDoc; class PageItem; class MultiProgressDialog; class ScImage; Index: rawimage.h =================================================================== --- rawimage.h (revision 13792) +++ rawimage.h (working copy) @@ -10,7 +10,7 @@ #include "scconfig.h" #include "scribusapi.h" #include "QByteArray" -#include "QImage" +#include <QImage> class SCRIBUS_API RawImage : public QByteArray { Index: mergedoc.cpp =================================================================== --- mergedoc.cpp (revision 13792) +++ mergedoc.cpp (working copy) @@ -5,6 +5,17 @@ for which a new license (GPL+exception) is in place. */ +#include "mergedoc.h" +#include "scconfig.h" +#include "commonstrings.h" +#include "customfdialog.h" +#include "fileloader.h" +#include "prefsfile.h" +#include "prefsmanager.h" +#include "sccombobox.h" +#include "scpaths.h" +#include "util_icon.h" + #include <QHBoxLayout> #include <QGridLayout> #include <QPixmap> @@ -18,18 +29,8 @@ #include <QApplication> #include <QCursor> #include <QToolTip> +#include <QDir> -#include "scconfig.h" -#include "mergedoc.h" -#include "commonstrings.h" -#include "customfdialog.h" -#include "fileloader.h" -#include "prefsfile.h" -#include "prefsmanager.h" -#include "sccombobox.h" -#include "scpaths.h" -#include "util_icon.h" - MergeDoc::MergeDoc(QWidget* parent, bool importMasterPages, int targetDocPageCount, int currentPage) : QDialog(parent) { masterPages = importMasterPages; Index: aligndistribute.h =================================================================== --- aligndistribute.h (revision 13792) +++ aligndistribute.h (working copy) @@ -33,6 +33,7 @@ class QEvent; #include "scribusapi.h" +#include "scribusdoc.h" #include "scribusview.h" #include "scrpalettebase.h" @@ -44,7 +45,6 @@ class ScrSpinBox; class ScribusMainWindow; -class ScribusDoc; class UndoManager; struct AlignObjs; Index: gtwriter.cpp =================================================================== --- gtwriter.cpp (revision 13792) +++ gtwriter.cpp (working copy) @@ -25,7 +25,8 @@ ***************************************************************************/ #include "gtwriter.h" -//#include "scfonts.h" +#include "gtframestyle.h" + #include "pageitem.h" #include "scribusstructs.h" Index: canvasmode.cpp =================================================================== --- canvasmode.cpp (revision 13792) +++ canvasmode.cpp (working copy) @@ -41,6 +41,7 @@ #include "scpainter.h" #include "scresizecursor.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribusview.h" #include "util_icon.h" Index: query.cpp =================================================================== --- query.cpp (revision 13792) +++ query.cpp (working copy) @@ -5,6 +5,7 @@ for which a new license (GPL+exception) is in place. */ #include "query.h" +#include "page.h" #include <QPixmap> #include <QLabel> #include <QLineEdit> Index: search.cpp =================================================================== --- search.cpp (revision 13792) +++ search.cpp (working copy) @@ -29,6 +29,7 @@ #include "prefsfile.h" #include "prefsmanager.h" #include "scribus.h" +#include "scribusdoc.h" #include "shadebutton.h" #include "storyeditor.h" #include "styleselect.h" Index: effectsdialog.cpp =================================================================== --- effectsdialog.cpp (revision 13792) +++ effectsdialog.cpp (working copy) @@ -58,10 +58,7 @@ { double sx = ix / 220.0; double sy = iy / 220.0; - if (sy < sx) - image.createLowRes(sx); - else - image.createLowRes(sy); + image.lowerResolution(qMax(sx, sy)); imageScale = qMin(sx, sy); } EffectsDialogLayout = new QHBoxLayout( this ); @@ -726,10 +723,10 @@ return; ScImage im(image); saveValues(false); - im.applyEffect(effectsList, doc->PageColors, false); + im.applyEffects(effectsList, doc->PageColors, false); QPixmap Bild = QPixmap(pixmapLabel1->width(), pixmapLabel1->height()); - int x = (pixmapLabel1->width() - im.qImage().width()) / 2; - int y = (pixmapLabel1->height() - im.qImage().height()) / 2; + int x = (pixmapLabel1->width() - im.width()) / 2; + int y = (pixmapLabel1->height() - im.height()) / 2; QPainter p; QBrush b(QColor(205,205,205), loadIcon("testfill.png")); p.begin(&Bild); @@ -1608,3 +1605,5 @@ } } } + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: sccolor.h =================================================================== --- sccolor.h (revision 13792) +++ sccolor.h (working copy) @@ -36,7 +36,7 @@ /** *@author Franz Schmid - * \brief This Class adds support for CMYK-Colors to QT. + * \brief This Class adds support for CMYK-Colors to Qt. * its API is based on the API of QColor */ @@ -153,7 +153,7 @@ ColorList& operator= (const ColorList& list); /** \brief Get the document the list is related , return in cpp due to scribusdoc class delcaration */ - ScribusDoc* document(void); + ScribusDoc* document() const; /** \brief Assign the doc to which the list belong to.*/ void setDocument(ScribusDoc* doc); Index: annot.cpp =================================================================== --- annot.cpp (revision 13792) +++ annot.cpp (working copy) @@ -46,6 +46,7 @@ #include "sccombobox.h" #include "scfonts.h" #include "scimage.h" +#include "scribusdoc.h" #include "scribusstructs.h" #include "scribusview.h" #include "selfield.h" Index: gtaction.h =================================================================== --- gtaction.h (revision 13792) +++ gtaction.h (working copy) @@ -32,21 +32,21 @@ #include <QMap> #include <QString> +#include "scribusapi.h" + class PageItem; class PrefsManager; class ScFace; - -#include "gtfont.h" -#include "gtframestyle.h" -#include "gtparagraphstyle.h" -#include "gtstyle.h" -#include "scribusapi.h" - class CharStyle; class ParagraphStyle; class ScribusDoc; class ScribusMainWindow; +class gtStyle; +class gtParagraphStyle; +class gtFont; +class gtFrameStyle; + typedef QMap<QString, QString> FontFamilyMap; class SCRIBUS_API gtAction Index: scribuswin.cpp =================================================================== --- scribuswin.cpp (revision 13792) +++ scribuswin.cpp (working copy) @@ -29,7 +29,9 @@ #include "fileloader.h" #include "masterpagepalette.h" #include "pageselector.h" +#include "scrspinbox.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribuswin.h" #include "storyeditor.h" #include "util.h" @@ -147,12 +149,8 @@ void ScribusWin::setMasterPagesPaletteShown(bool isShown) const { - if (m_masterPagesPalette==NULL) - return; - if (isShown) - m_masterPagesPalette->show(); - else - m_masterPagesPalette->hide(); + if (m_masterPagesPalette) + m_masterPagesPalette->setVisible(isShown); } void ScribusWin::windowActivationChange ( bool oldActive ) Index: newfile.h =================================================================== --- newfile.h (revision 13792) +++ newfile.h (working copy) @@ -20,17 +20,16 @@ class QLabel; class QCheckBox; class QPushButton; +class QComboBox; #include "scribusapi.h" #include "scribusstructs.h" -#include "customfdialog.h" -#include "nftwidget.h" - class PrefsManager; class MarginWidget; class PageLayouts; class ScrSpinBox; class ScComboBox; +class nftwidget; #if QT_VERSION >= 0x040300 class QFileDialog; #else Index: scribusXml.h =================================================================== --- scribusXml.h (revision 13792) +++ scribusXml.h (working copy) @@ -23,7 +23,6 @@ #include "scfonts.h" #include "scribusapi.h" #include "scribusstructs.h" -#include "selection.h" #include "styles/styleset.h" #include <QXmlStreamAttributes> @@ -36,6 +35,7 @@ class ScribusDoc; class ScPattern; class ScXmlStreamWriter; +class Selection; class SCRIBUS_API ScriXmlDoc { Index: masterpagepalette.cpp =================================================================== --- masterpagepalette.cpp (revision 13792) +++ masterpagepalette.cpp (working copy) @@ -29,6 +29,7 @@ #include "scribusXml.h" #include "scribusdoc.h" #include "scribusview.h" +#include "selection.h" #include "util_icon.h" MasterPagesPalette::MasterPagesPalette( QWidget* parent, ScribusDoc *pCurrentDoc, ScribusView *pCurrentView, QString masterPageName) Index: sccolor.cpp =================================================================== --- sccolor.cpp (revision 13792) +++ sccolor.cpp (working copy) @@ -331,7 +331,7 @@ addColors(colorList, overwrite); } -ScribusDoc* ColorList::document(void) +ScribusDoc* ColorList::document() const { return m_doc; } Index: guidemanagercore.cpp =================================================================== --- guidemanagercore.cpp (revision 13792) +++ guidemanagercore.cpp (working copy) @@ -16,10 +16,12 @@ #include "guidemanager.h" #include "scclocale.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "pagestructs.h" #include "selection.h" + GuideManagerCore::GuideManagerCore(): undoManager(UndoManager::instance()), m_page(0), Index: applytemplatedialog.h =================================================================== --- applytemplatedialog.h (revision 13792) +++ applytemplatedialog.h (working copy) @@ -19,7 +19,6 @@ #include <QString> #include "scribusapi.h" -#include "scribusdoc.h" #include "page.h" class QCheckBox; @@ -33,6 +32,7 @@ class QSpacerItem; class QSpinBox; class QVBoxLayout; +class ScribusDoc; class SCRIBUS_API ApplyMasterPageDialog : public QDialog { Index: scfonts.cpp =================================================================== --- scfonts.cpp (revision 13792) +++ scfonts.cpp (working copy) @@ -40,6 +40,7 @@ #include "prefstable.h" #include "scribus.h" #include "scribuscore.h" +#include "scribusdoc.h" #ifdef Q_WS_X11 #include <X11/X.h> #include <X11/Xlib.h> Index: pageitem.h =================================================================== --- pageitem.h (revision 13792) +++ pageitem.h (working copy) @@ -257,7 +257,7 @@ virtual void applicableActions(QStringList& actionList) = 0; virtual QString infoDescription(); - + protected: void DrawObj_ImageFrame(ScPainter *p, double sc); //void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc); Index: imageinfodialog.h =================================================================== --- imageinfodialog.h (revision 13792) +++ imageinfodialog.h (working copy) @@ -17,7 +17,7 @@ class QPushButton; #include "scribusapi.h" -#include "scimage.h" +#include "scimagestructs.h" class SCRIBUS_API ImageInfoDialog : public QDialog { Index: scimage.cpp =================================================================== --- scimage.cpp (revision 13792) +++ scimage.cpp (working copy) @@ -5,12 +5,14 @@ for which a new license (GPL+exception) is in place. */ +#include "scimage.h" +#include "scimage_p.h" #include "cmsettings.h" #include "scclocale.h" -#include "scimage.h" #include "scribus.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scimgdataloader_gimp.h" #include "scimgdataloader_jpeg.h" #include "scimgdataloader_ps.h" @@ -22,6 +24,7 @@ #include <QMessageBox> #include <QList> #include <QByteArray> +#include <QTime> #include <cassert> #include <cmath> #include <cstdlib> @@ -69,42 +72,116 @@ longjmp (myerr->setjmp_buffer, 1); } -ScImage::ScImage(const QImage & image) : QImage(image) +//we start unloading images immediately in ScImage::LoadPicture when grossNumKBytes > 128*1024 +static long grossNumKBytes=0; + + +ScImage::Private& ScImage::Private::operator=(const ScImage::Private& other) { + QImage::operator=(other); + + height_=other.height_; + width_=other.width_; + + delete imLoadSettings; imLoadSettings=0; + if( other.imLoadSettings ) + { + imLoadSettings = new ImageLoadSettings(other.imLoadSettings->cmSettings); + *imLoadSettings = *other.imLoadSettings; + } + + imEffectSettings=other.imEffectSettings; + + if (!isNull()) + clearTimer.start(); + + return *this; +} + +void ScImage::Private::clear() +{ + qDebug()<<"clearImage()"; + if (imLoadSettings) + qDebug()<<imLoadSettings->fileName; + grossNumKBytes-=(numBytes()/1000); + *((QImage*)this)=QImage(); +} + + +ScImage::ScImage(const QImage& image) + : d(new Private(this)) +{ initialize(); + + d->height_=image.height(); + d->width_=image.width(); } - // ScImage will use implicit sharing: -ScImage::ScImage(const ScImage & image) : QImage(image.copy()) +ScImage::ScImage(const ScImage& other) + : d(new Private(this)) { initialize(); + *d=*(other.d); } -ScImage::ScImage() : QImage() +ScImage::ScImage() + : d(new Private(this)) { initialize(); } -ScImage::ScImage( int width, int height ) : QImage( width, height, QImage::Format_ARGB32 ) +ScImage::ScImage(int width, int height) + : d(new Private(this, width, height)) { initialize(); } -const QImage& ScImage::qImage() + +QImage ScImage::qImage() const { - return *this; + d->restore(); + qDebug()<<"we are in const QImage& ScImage::qImage() "<<endl; + return *((QImage*)d); } QImage* ScImage::qImagePtr() { - return this; + d->restore(); + qDebug()<<"we are in const QImagePtr::qImage() "<<endl; + return d; } +int ScImage::height() const +{ + if (d->height_==-1) + d->restore(); + return d->height_; +} + +int ScImage::width() const +{ + if (d->width_==-1) + d->restore(); + return d->width_; +} + +bool ScImage::hasAlpha() const +{ + return d->hasAlphaChannel(); +} + +ScImage& ScImage::operator=(const ScImage& other) +{ + *d=*other.d; + return *this; +} + QImage ScImage::scaled(int h, int w, Qt::AspectRatioMode mode, Qt::TransformationMode transformMode) const { - return QImage::scaled(h, w, mode, transformMode); + d->restore(); + return d->scaled(h, w, mode, transformMode); } @@ -131,254 +208,300 @@ imgInfo.exifInfo.thumbnail = QImage(); imgInfo.BBoxX = 0; imgInfo.BBoxH = 0; + + QObject::connect(&(d->clearTimer), SIGNAL(timeout()), d, SLOT(clear())); + d->clearTimer.setInterval(10000); + d->clearTimer.setSingleShot(false); } ScImage::~ScImage() { + delete d; } -void ScImage::applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk) +void ScImage::Private::restore() { + if (isNull() && imLoadSettings) + { + doLoadPicture(imLoadSettings->fileName, imLoadSettings->page, imLoadSettings->cmSettings, imLoadSettings->useEmbedded, imLoadSettings->useProf, imLoadSettings->requestType, imLoadSettings->gsRes, 0, false); + int oldWidth=width_; + int oldHeight=height_; + + width_=width(); + height_=height(); + foreach(const ImageEffectSettings& imEffectSetting, imEffectSettings) + { + if (imEffectSetting.convertToGray) + q->convertToGray(); + else if (imEffectSetting.scale) + q->scale(oldWidth, oldHeight); + else + doApplyEffect(imEffectSetting.effectsList, imEffectSetting.colors, imEffectSetting.cmyk); + } + qDebug()<<"restoring"<<imLoadSettings->fileName; + } + else + qDebug()<<"not restoring"; + if (imLoadSettings) + clearTimer.start(); +} + +//TODO const ColorList& colors +void ScImage::applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ + qDebug()<<"restoring"; + if (d->imLoadSettings) + qDebug()<<d->imLoadSettings->fileName; + + Private::ImageEffectSettings s; + s.effectsList = effectsList; + s.colors = colors; + s.cmyk = cmyk; + d->imEffectSettings.append(s); + + if (!d->isNull()) + d->doApplyEffect(effectsList, colors, cmyk); +} + +void ScImage::Private::doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ ScribusDoc* doc = colors.document(); - if (effectsList.count() != 0) + Q_FOREACH(const ImageEffect& effect, effectsList) { - for (int a = 0; a < effectsList.count(); ++a) + if (effect.effectCode == EF_INVERT) + invert(cmyk); + if (effect.effectCode == EF_GRAYSCALE) + toGrayscale(cmyk); + if (effect.effectCode == EF_COLORIZE) { - if (effectsList.at(a).effectCode == EF_INVERT) - invert(cmyk); - if (effectsList.at(a).effectCode == EF_GRAYSCALE) - toGrayscale(cmyk); - if (effectsList.at(a).effectCode == EF_COLORIZE) + QString tmpstr = effect.effectParameters; + QString col = CommonStrings::None; + int shading = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + // fp >> col; + col = fp.readLine(); + fp >> shading; + colorize(doc, colors[col], shading, cmyk); + } + if (effect.effectCode == EF_BRIGHTNESS) + { + QString tmpstr = effect.effectParameters; + int brightnessValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> brightnessValue; + brightness(brightnessValue, cmyk); + } + if (effect.effectCode == EF_CONTRAST) + { + QString tmpstr = effect.effectParameters; + int contrastValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> contrastValue; + contrast(contrastValue, cmyk); + } + if (effect.effectCode == EF_SHARPEN) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + sharpen(radius, sigma); + } + if (effect.effectCode == EF_BLUR) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + blur(static_cast<int>(radius)); + } + if (effect.effectCode == EF_SOLARIZE) + { + QString tmpstr = effect.effectParameters; + double sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> sigma; + solarize(sigma, cmyk); + } + if (effect.effectCode == EF_DUOTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + int shading1 = 100; + QString col2 = CommonStrings::None; + int shading2 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + fp >> shading1; + fp >> shading2; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col = CommonStrings::None; - int shading = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - // fp >> col; - col = fp.readLine(); - fp >> shading; - colorize(doc, colors[col], shading, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BRIGHTNESS) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int brightnessValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> brightnessValue; - brightness(brightnessValue, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_CONTRAST) + int lin2; + fp >> lin2; + duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + } + if (effect.effectCode == EF_TRITONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int contrastValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> contrastValue; - contrast(contrastValue, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SHARPEN) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - sharpen(radius, sigma); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BLUR) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - blur(static_cast<int>(radius)); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SOLARIZE) + int lin3; + fp >> lin3; + tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + } + if (effect.effectCode == EF_QUADTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + QString col4 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + int shading4 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + col4 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + fp >> shading4; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> sigma; - solarize(sigma, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_DUOTONE) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - int shading1 = 100; - QString col2 = CommonStrings::None; - int shading2 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - fp >> shading1; - fp >> shading2; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_TRITONE) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_QUADTONE) + int lin3; + fp >> lin3; + FPointArray curve4; + curve4.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - QString col4 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - int shading4 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - col4 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - fp >> shading4; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - FPointArray curve4; - curve4.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve4.addPoint(xval, yval); - } - int lin4; - fp >> lin4; - quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + fp >> xval; + fp >> yval; + curve4.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_GRADUATE) + int lin4; + fp >> lin4; + quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + } + if (effect.effectCode == EF_GRADUATE) + { + QString tmpstr = effect.effectParameters; + int numVals; + double xval, yval; + FPointArray curve; + curve.resize(0); + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int numVals; - double xval, yval; - FPointArray curve; - curve.resize(0); - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve.addPoint(xval, yval); - } - int lin; - fp >> lin; - doGraduate(curve, cmyk, lin); + fp >> xval; + fp >> yval; + curve.addPoint(xval, yval); } + int lin; + fp >> lin; + doGraduate(curve, cmyk, lin); } } } @@ -392,7 +515,7 @@ *memory=(void *) NULL; } */ -void ScImage::solarize(double factor, bool cmyk) +void ScImage::Private::solarize(double factor, bool cmyk) { QVector<int> curveTable(256); int fk = qRound(255 / factor); @@ -404,15 +527,15 @@ } // Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com> -void ScImage::blur(int radius) +void ScImage::Private::blur(int radius) { if (radius < 1) { return; } QRgb *pix = (QRgb*)bits(); - int w = width(); - int h = height(); + int w = width_; + int h = height_; int wm = w-1; int hm = h-1; int wh = w*h; @@ -647,7 +770,7 @@ delete [] stack; } -bool ScImage::convolveImage(QImage *dest, const unsigned int order, const double *kernel) +bool ScImage::Private::convolveImage(QImage *dest, const unsigned int order, const double *kernel) { long widthk; double red, green, blue, alpha; @@ -663,7 +786,7 @@ normal_kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!normal_kernel) return(false); - *dest = QImage(width(), height(), QImage::Format_ARGB32); + *dest = QImage(width_, height_, QImage::Format_ARGB32); normalize=0.0; for(i=0; i < (widthk*widthk); i++) normalize += kernel[i]; @@ -683,11 +806,11 @@ sy = y-(widthk/2); for(mcy=0; mcy < widthk; ++mcy, ++sy) { - my = sy < 0 ? 0 : sy > height()-1 ? height()-1 : sy; + my = sy < 0 ? 0 : sy > height_-1 ? height_-1 : sy; sx = x+(-widthk/2); for(mcx=0; mcx < widthk; ++mcx, ++sx) { - mx = sx < 0 ? 0 : sx > width()-1 ? width()-1 : sx; + mx = sx < 0 ? 0 : sx > width_-1 ? width_-1 : sx; int px = pixel(mx, my); red += (*k)*(qRed(px)*257); green += (*k)*(qGreen(px)*257); @@ -696,7 +819,7 @@ ++k; } } - red = red < 0 ? 0 : red > 65535 ? 65535 : red+0.5; + red = red < 0 ? 0 : red > 65535 ? 6553 : red+0.5; green = green < 0 ? 0 : green > 65535 ? 65535 : green+0.5; blue = blue < 0 ? 0 : blue > 65535 ? 65535 : blue+0.5; alpha = alpha < 0 ? 0 : alpha > 65535 ? 65535 : alpha+0.5; @@ -710,7 +833,7 @@ return(true); } -int ScImage::getOptimalKernelWidth(double radius, double sigma) +int ScImage::Private::getOptimalKernelWidth(double radius, double sigma) { double normalize, value; long width; @@ -732,7 +855,7 @@ return((int)width-2); } -void ScImage::sharpen(double radius, double sigma) +void ScImage::Private::sharpen(double radius, double sigma) { double alpha, normalize, *kernel; int widthk; @@ -741,7 +864,7 @@ if(sigma == 0.0) return; widthk = getOptimalKernelWidth(radius, sigma); - if(width() < widthk) + if(width_ < widthk) return; kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!kernel) @@ -776,7 +899,7 @@ return; } -void ScImage::contrast(int contrastValue, bool cmyk) +void ScImage::Private::contrast(int contrastValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 - contrastValue); @@ -789,7 +912,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::brightness(int brightnessValue, bool cmyk) +void ScImage::Private::brightness(int brightnessValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 + brightnessValue); @@ -802,7 +925,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::doGraduate(FPointArray curve, bool cmyk, bool linear) +void ScImage::Private::doGraduate(FPointArray curve, bool cmyk, bool linear) { QVector<int> curveTable(256); for (int x = 0 ; x < 256 ; x++) @@ -812,10 +935,10 @@ applyCurve(curveTable, cmyk); } -void ScImage::applyCurve(const QVector<int>& curveTable, bool cmyk) +void ScImage::Private::applyCurve(const QVector<int>& curveTable, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; QRgb *s; QRgb r; int c, m, y, k; @@ -847,10 +970,10 @@ } } -void ScImage::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) +void ScImage::Private::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int cc, cm, cy, ck; int hu, sa, v; ScColor tmp2; @@ -897,10 +1020,10 @@ } } -void ScImage::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) +void ScImage::Private::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, m, m1, y, y1, k, k1; int cn, c1n, mn, m1n, yn, y1n, kn, k1n; uchar cb; @@ -953,10 +1076,10 @@ } } -void ScImage::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) +void ScImage::Private::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, m, m1, m2, y, y1, y2, k, k1, k2; int cn, c1n, c2n, mn, m1n, m2n, yn, y1n, y2n, kn, k1n, k2n; uchar cb; @@ -1021,10 +1144,10 @@ } } -void ScImage::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) +void ScImage::Private::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, c3, m, m1, m2, m3, y, y1, y2, y3, k, k1, k2, k3; int cn, c1n, c2n, c3n, mn, m1n, m2n, m3n, yn, y1n, y2n, y3n, kn, k1n, k2n, k3n; uchar cb; @@ -1101,10 +1224,10 @@ } } -void ScImage::invert(bool cmyk) +void ScImage::Private::invert(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; unsigned char *p; QRgb * s; unsigned char c, m, y, k; @@ -1116,7 +1239,7 @@ if (cmyk) { p = (unsigned char *) s; - c = 255 - qMin(255, p[0] + p[3]); + c = 255 - qMin(255, p[0] + p[3]); m = 255 - qMin(255, p[1] + p[3]); y = 255 - qMin(255, p[2] + p[3]); k = qMin(qMin(c, m), y); @@ -1132,10 +1255,10 @@ } } -void ScImage::toGrayscale(bool cmyk) +void ScImage::Private::toGrayscale(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int k; QRgb * s; QRgb r; @@ -1160,7 +1283,7 @@ } } -void ScImage::swapRGBA() +void ScImage::Private::swapRGBA() { unsigned int *ptr; unsigned char *p; @@ -1168,7 +1291,7 @@ for (int i = 0; i < height(); ++i) { ptr = (unsigned int *) scanLine(i); - for (int j = 0; j < width(); ++j) + for (int j = 0; j < width_; ++j) { p = (unsigned char *) ptr; r = p[0]; @@ -1180,18 +1303,21 @@ } } -void ScImage::createLowRes(double scale) +//TODO rename to 'makeLowRes' +void ScImage::lowerResolution(double scale) { int w = qRound(width() / scale); int h = qRound(height() / scale); QImage tmp = scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (tmp.format() != QImage::Format_ARGB32) tmp = tmp.convertToFormat(QImage::Format_ARGB32); - QImage::operator=(tmp); + *((QImage*)d)=tmp; } -bool ScImage::Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray) +bool ScImage::saveToJpg(QString fn, int Quality, bool isCMYK, bool isGray) const { + d->restore(); + struct jpeg_compress_struct cinfo; struct my_error_mgr jerr; FILE *outfile; @@ -1242,7 +1368,7 @@ uchar *row = row_pointer[0]; if (isCMYK) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1256,7 +1382,7 @@ { if (isGray) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1265,7 +1391,7 @@ } else { - QRgb* rgb = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgb = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row++ = qRed(*rgb); @@ -1284,8 +1410,10 @@ return true; } -QByteArray ScImage::ImageToArray() +QByteArray ScImage::toArray() const { + d->restore(); + int i = 0; int h = height(); int w = width(); @@ -1297,7 +1425,7 @@ return imgArray; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1312,15 +1440,20 @@ return imgArray; } -void ScImage::convertToGray(void) +void ScImage::convertToGray() { + d->restore(); + Private::ImageEffectSettings t; + t.convertToGray = true; + d->imEffectSettings.append(t); + int k; int h = height(); int w = width(); QRgb *s, r; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s; @@ -1330,8 +1463,10 @@ } } -bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) +bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1345,7 +1480,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1364,8 +1499,10 @@ return success; } -bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) +bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1379,7 +1516,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); if (precal) // image data is already grayscale, no need for weighted conversion { for( int xi=0; xi < w; ++xi ) @@ -1411,8 +1548,10 @@ return success; } -bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) +bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1426,7 +1565,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1446,8 +1585,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1462,7 +1603,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1502,8 +1643,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1521,7 +1664,7 @@ unsigned char* maskData = (unsigned char*) mask.constData(); for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1563,8 +1706,13 @@ return success; } -void ScImage::scaleImage(int nwidth, int nheight) +void ScImage::scale(int nwidth, int nheight) { + d->restore(); + Private::ImageEffectSettings t; + t.scale = true; + d->imEffectSettings.append(t); + QImage dst(nwidth, nheight, QImage::Format_ARGB32); QRgb* xelrow = 0; QRgb* tempxelrow = 0; @@ -1621,13 +1769,13 @@ for ( row = 0; row < newrows; ++row ) { if ( newrows == rows ) - tempxelrow = xelrow = (QRgb*)scanLine(rowsread++); + tempxelrow = xelrow = (QRgb*)d->scanLine(rowsread++); else { while ( fracrowleft < fracrowtofill ) { if ( needtoreadrow && rowsread < rows ) - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); for ( col = 0, xP = xelrow; col < cols; ++col, ++xP ) { as[col] += fracrowleft * qAlpha( *xP ); @@ -1641,7 +1789,7 @@ } if ( needtoreadrow && rowsread < rows ) { - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); needtoreadrow = 0; } register long a=0; @@ -1756,11 +1904,11 @@ delete [] gs; if ( bs ) // Robust, bs might be 0 one day delete [] bs; - QImage::operator=(QImage(nwidth, nheight, QImage::Format_ARGB32)); + *((QImage*)this->d)=QImage(nwidth, nheight, QImage::Format_ARGB32); for( int yi=0; yi < dst.height(); ++yi ) { QRgb *s = (QRgb*)(dst.scanLine( yi )); - QRgb *d = (QRgb*)(scanLine( yi )); + QRgb *d = (QRgb*)(this->d->scanLine( yi )); for(int xi=0; xi < dst.width(); ++xi ) { (*d) = (*s); @@ -1768,7 +1916,8 @@ d++; } } - return; + d->width_=d->width(); + d->height_=d->height(); } bool ScImage::getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes, int scaleXSize, int scaleYSize) @@ -1824,10 +1973,8 @@ { if (pDataLoader->imageInfoRecord().valid) { - if ((pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK)) - rImage = pDataLoader->r_image.convertToQImage(true); - else - rImage = pDataLoader->r_image.convertToQImage(false); + bool cmyk=(pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK); + rImage = pDataLoader->r_image.convertToQImage(cmyk); } } else @@ -1893,18 +2040,17 @@ return gotAlpha; } -void ScImage::getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page) +QByteArray ScImage::getEmbeddedProfile(const QString & fn, int *components, int page) { - Q_ASSERT(profile); + QByteArray profile; Q_ASSERT(components); ScImgDataLoader* pDataLoader = NULL; cmsHPROFILE prof = 0; - profile->resize(0); *components = 0; QFileInfo fi = QFileInfo(fn); if (!fi.exists()) - return; + return QByteArray(); QString ext = fi.suffix().toLower(); if (extensionIndicatesPSD(ext)) @@ -1931,18 +2077,54 @@ *components = 4; if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData) *components = 1; - *profile = embeddedProfile; + profile = embeddedProfile; } cmsCloseProfile(prof); } delete pDataLoader; } + return profile; } + bool ScImage::LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK, bool showMsg) { + delete d->imLoadSettings; + d->imLoadSettings = new Private::ImageLoadSettings(cmSettings); + + d->imLoadSettings->fileName=fn; + d->imLoadSettings->page=page; +// d->imLoadSettings->cmSettings=cmSettings; + d->imLoadSettings->useEmbedded=useEmbedded; + d->imLoadSettings->useProf=useProf; + d->imLoadSettings->requestType=requestType; + d->imLoadSettings->gsRes=gsRes; + + d->imEffectSettings.clear(); + + d->height_=-1; + d->width_=-1; + + //TODO + QTime a;a.start(); + bool ok=d->doLoadPicture(fn, page, cmSettings, useEmbedded, useProf, requestType, gsRes, realCMYK, showMsg); + d->height_=d->height(); + d->width_=d->width(); + qDebug()<<"LoadPicture"<<fn<<realCMYK<<showMsg<<a.elapsed()<<d->numBytes(); + + //so low-memory systems don't get lost in swap on document loading + if (grossNumKBytes>128*1024) + d->clear(); + return ok; +} + +bool ScImage::Private::doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, + bool useEmbedded, bool useProf, RequestType requestType, + int gsRes, bool *realCMYK, bool showMsg) +{ + qDebug()<<"doLoadPicture"<<fn; // requestType - 0: CMYK, 1: RGB, 2: RGB Proof 3 : RawData, 4: Thumbnail // gsRes - is the resolution that ghostscript will render at bool isCMYK = false; @@ -1960,8 +2142,10 @@ int cmsProofFlags = 0; auto_ptr<ScImgDataLoader> pDataLoader; QFileInfo fi = QFileInfo(fn); + qDebug()<<"doLoadPicture 0"; if (!fi.exists()) return ret; + qDebug()<<"doLoadPicture 01"; QString ext = fi.suffix().toLower(); QString tmp, dummy, cmd1, cmd2, BBox, tmp2; QChar tc; @@ -1987,7 +2171,7 @@ else if (extensionIndicatesPSD(ext)) { pDataLoader.reset( new ScImgDataLoader_PSD() ); - pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps); + pDataLoader->setRequest(q->imgInfo.isRequest, q->imgInfo.RequestProps); } else if (extensionIndicatesJPEG(ext)) pDataLoader.reset( new ScImgDataLoader_JPEG() ); @@ -1999,7 +2183,7 @@ if (pDataLoader->loadPicture(fn, page, gsRes, (requestType == Thumbnail))) { QImage::operator=(pDataLoader->image()); - imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo = pDataLoader->imageInfoRecord(); if (requestType == Thumbnail) reqType = RGBData; // if (!cmSettings.useColorManagement() || !useProf) @@ -2007,13 +2191,13 @@ // imgInfo.isEmbedded = false; // imgInfo.profileName = ""; // } - if (imgInfo.colorspace == ColorSpaceCMYK) + if (q->imgInfo.colorspace == ColorSpaceCMYK) { isCMYK = true; if(realCMYK) *realCMYK = true; } - else if (imgInfo.colorspace == ColorSpaceGray) + else if (q->imgInfo.colorspace == ColorSpaceGray) bilevel = true; pDataLoader->image() = QImage(); } @@ -2028,14 +2212,17 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + qDebug()<<"doLoadPicture 000"; return false; } + qDebug()<<"doLoadPicture 111"; if (!(extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))) { if (isNull()) return ret; } + qDebug()<<"doLoadPicture 112"; QByteArray embeddedProfile = pDataLoader->embeddedProfile(); if (cmSettings.useColorManagement() && useProf) @@ -2054,15 +2241,15 @@ { if (ScCore->InputProfilesCMYK.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile)) { - imgInfo.profileName = cmSettings.profileName(); + q->imgInfo.profileName = cmSettings.profileName(); inputProfisEmbedded = true; - profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName].toLocal8Bit(); + profilePath = ScCore->InputProfilesCMYK[q->imgInfo.profileName].toLocal8Bit(); inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageCMYKProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; inputProfisEmbedded = false; } } @@ -2070,15 +2257,15 @@ { if (ScCore->InputProfiles.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageRGBProfile)) { - imgInfo.profileName = cmSettings.profileName(); - profilePath = ScCore->InputProfiles[imgInfo.profileName].toLocal8Bit(); + q->imgInfo.profileName = cmSettings.profileName(); + profilePath = ScCore->InputProfiles[q->imgInfo.profileName].toLocal8Bit(); inputProfisEmbedded = true; inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageRGBProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; inputProfisEmbedded = false; } } @@ -2099,6 +2286,7 @@ cmsHPROFILE printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile; if (useProf && inputProf && screenProf && printerProf) { + qDebug()<<"doLoadPicture 33"; bool isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)); DWORD SC_TYPE_YMCK_8 = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)); DWORD inputProfFormat = TYPE_BGRA_8; @@ -2132,6 +2320,7 @@ } if (!cmSettings.useColorManagement() || cmSettings.useBlackPoint()) cmsFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + qDebug()<<"doLoadPicture 334"; switch (reqType) { case CMYKData: // CMYK @@ -2149,11 +2338,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2163,7 +2352,7 @@ { if (cmSettings.useColorManagement() && cmSettings.doSoftProofing()) { - if ((imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) + if ((q->imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (q->imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) { if (isCMYK) xform = cmSettings.cmykImageProofingTransform(); @@ -2187,29 +2376,32 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } + qDebug()<<"doLoadPicture 335"; if (xform) { + qDebug()<<"doLoadPicture 335 xform"; if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(QImage(pDataLoader->r_image.width(), pDataLoader->r_image.height(), QImage::Format_ARGB32)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } + qDebug()<<"doLoadPicture 335 xf1"; LPBYTE ptr2 = NULL; for (int i = 0; i < height(); i++) { @@ -2304,18 +2496,22 @@ } } } + qDebug()<<"doLoadPicture 335 xf 2"; if (!stdProof && !ScCore->IsDefaultTransform(xform)) cmsDeleteTransform (xform); } + qDebug()<<"doLoadPicture 336"; if ((inputProf) && (inputProfisEmbedded) && !ScCore->IsDefaultProfile(inputProf)) cmsCloseProfile(inputProf); if (isCMYK) cmsChangeBuffersFormat(cmSettings.cmykImageProofingTransform(), TYPE_CMYK_8, TYPE_RGBA_8); else cmsChangeBuffersFormat(cmSettings.rgbImageProofingTransform(), TYPE_RGBA_8, TYPE_RGBA_8); + qDebug()<<"doLoadPicture 339"; } else { + qDebug()<<"doLoadPicture 4"; switch (reqType) { case CMYKData: @@ -2324,11 +2520,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2352,11 +2548,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2370,11 +2566,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2401,11 +2597,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2415,26 +2611,24 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } } + qDebug()<<"doLoadPicture 8"; // if (((reqType == CMYKData) || ((reqType == RawData) && isCMYK)) && !bilevel) // setAlphaBuffer(false); - setDotsPerMeterX (qMax(2834, (int) (imgInfo.xres / 0.0254))); - setDotsPerMeterY (qMax(2834, (int) (imgInfo.yres / 0.0254))); - if (imgInfo.isEmbedded && useEmbedded) - imgInfo.isEmbedded = true; - else - imgInfo.isEmbedded = false; - if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) + setDotsPerMeterX (qMax(2834, (int) (q->imgInfo.xres / 0.0254))); + setDotsPerMeterY (qMax(2834, (int) (q->imgInfo.yres / 0.0254))); + q->imgInfo.isEmbedded=q->imgInfo.isEmbedded && useEmbedded; + if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) { QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage(), 1, 0, 0); } @@ -2443,5 +2637,8 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + grossNumKBytes+=(numBytes()/1000); return true; } + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: annota.cpp =================================================================== --- annota.cpp (revision 13792) +++ annota.cpp (working copy) @@ -37,6 +37,7 @@ #include "commonstrings.h" #include "pageitem.h" #include "navigator.h" +#include "scribusdoc.h" #include "scribusview.h" #include "util_icon.h" #include "util_formats.h" @@ -56,7 +57,7 @@ if ((item->annotation().ActionType() == 2) || (item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9)) { QString tm = item->annotation().Action(); - tl = tm.split(" ", QString::SkipEmptyParts); + tl = tm.split(' ', QString::SkipEmptyParts); } else { Index: plugins/scriptplugin/cmdobj.cpp =================================================================== --- plugins/scriptplugin/cmdobj.cpp (revision 13792) +++ plugins/scriptplugin/cmdobj.cpp (working copy) @@ -10,8 +10,8 @@ #include "util_math.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" - PyObject *scribus_newrect(PyObject* /* self */, PyObject* args) { double x, y, w, h; Index: plugins/scriptplugin/cmdpage.cpp =================================================================== --- plugins/scriptplugin/cmdpage.cpp (revision 13792) +++ plugins/scriptplugin/cmdpage.cpp (working copy) @@ -9,8 +9,8 @@ #include "page.h" #include "scribuscore.h" #include "commonstrings.h" +#include "scribusdoc.h" - PyObject *scribus_actualpage(PyObject* /* self */) { if(!checkHaveDocument()) Index: plugins/scriptplugin/cmdutil.cpp =================================================================== --- plugins/scriptplugin/cmdutil.cpp (revision 13792) +++ plugins/scriptplugin/cmdutil.cpp (working copy) @@ -8,6 +8,7 @@ #include "units.h" #include "page.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "selection.h" ScribusMainWindow* Carrier; Index: plugins/scriptplugin/cmdgetprop.cpp =================================================================== --- plugins/scriptplugin/cmdgetprop.cpp (revision 13792) +++ plugins/scriptplugin/cmdgetprop.cpp (working copy) @@ -7,6 +7,7 @@ #include "cmdgetprop.h" #include "cmdutil.h" #include "scribuscore.h" +#include "scribusdoc.h" PyObject *scribus_getfillcolor(PyObject* /* self */, PyObject* args) { Index: plugins/scriptplugin/cmdtext.cpp =================================================================== --- plugins/scriptplugin/cmdtext.cpp (revision 13792) +++ plugins/scriptplugin/cmdtext.cpp (working copy) @@ -11,6 +11,7 @@ #include "selection.h" #include "util.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "hyphenator.h" PyObject *scribus_getfontsize(PyObject* /* self */, PyObject* args) Index: plugins/scriptplugin/cmdmani.cpp =================================================================== --- plugins/scriptplugin/cmdmani.cpp (revision 13792) +++ plugins/scriptplugin/cmdmani.cpp (working copy) @@ -9,6 +9,7 @@ #include "propertiespalette.h" //CB argh.. noooooooooooooooooooooooooooooooooooo FIXME see other FIXME #include "selection.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "undomanager.h" PyObject *scribus_loadimage(PyObject* /* self */, PyObject* args) Index: plugins/scriptplugin/objimageexport.cpp =================================================================== --- plugins/scriptplugin/objimageexport.cpp (revision 13792) +++ plugins/scriptplugin/objimageexport.cpp (working copy) @@ -13,6 +13,7 @@ #include <QFileInfo> #include <vector> #include "scribuscore.h" +#include "scribusdoc.h" typedef struct { Index: plugins/scriptplugin/cmdsetprop.cpp =================================================================== --- plugins/scriptplugin/cmdsetprop.cpp (revision 13792) +++ plugins/scriptplugin/cmdsetprop.cpp (working copy) @@ -7,6 +7,7 @@ #include "cmdsetprop.h" #include "cmdutil.h" #include "scribuscore.h" +#include "scribusdoc.h" PyObject *scribus_setgradfill(PyObject* /* self */, PyObject* args) { Index: plugins/scriptplugin/cmddoc.cpp =================================================================== --- plugins/scriptplugin/cmddoc.cpp (revision 13792) +++ plugins/scriptplugin/cmddoc.cpp (working copy) @@ -9,6 +9,7 @@ #include "units.h" #include "documentinformation.h" #include "scribuscore.h" +#include "scribusdoc.h" /* newDocument(size, margins, orientation, firstPageNumber, Index: plugins/scriptplugin/cmdcolor.cpp =================================================================== --- plugins/scriptplugin/cmdcolor.cpp (revision 13792) +++ plugins/scriptplugin/cmdcolor.cpp (working copy) @@ -9,6 +9,7 @@ #include "prefsmanager.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "sccolorengine.h" PyObject *scribus_colornames(PyObject* /* self */) Index: plugins/scriptplugin/scriptercore.cpp =================================================================== --- plugins/scriptplugin/scriptercore.cpp (revision 13792) +++ plugins/scriptplugin/scriptercore.cpp (working copy) @@ -26,6 +26,7 @@ #include "pconsole.h" #include "scraction.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scpaths.h" #include "selection.h" #include "prefsfile.h" Index: plugins/scriptplugin/objprinter.cpp =================================================================== --- plugins/scriptplugin/objprinter.cpp (revision 13792) +++ plugins/scriptplugin/objprinter.cpp (working copy) @@ -17,6 +17,7 @@ #include "pslib.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "util_file.h" #include "util_ghostscript.h" #include "util_printer.h" Index: plugins/scriptplugin/cmdmisc.cpp =================================================================== --- plugins/scriptplugin/cmdmisc.cpp (revision 13792) +++ plugins/scriptplugin/cmdmisc.cpp (working copy) @@ -13,6 +13,7 @@ #include <QList> #include "scribuscore.h" +#include "scribusdoc.h" #include "fonts/scfontmetrics.h" #include "prefsmanager.h" Index: plugins/scriptplugin/cmddialog.cpp =================================================================== --- plugins/scriptplugin/cmddialog.cpp (revision 13792) +++ plugins/scriptplugin/cmddialog.cpp (working copy) @@ -7,14 +7,18 @@ #include "cmddialog.h" #include "cmdutil.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "customfdialog.h" #include "stylemanager.h" +#include "styles/styleset.h" + #include <QMessageBox> #include <QCursor> #include <QInputDialog> + PyObject *scribus_newdocdia(PyObject* /* self */) { QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor)); Index: plugins/scriptplugin/cmdstyle.cpp =================================================================== --- plugins/scriptplugin/cmdstyle.cpp (revision 13792) +++ plugins/scriptplugin/cmdstyle.cpp (working copy) @@ -14,8 +14,10 @@ #include <QList> #include "scribuscore.h" +#include "scribusdoc.h" #include "styles/paragraphstyle.h" #include "styles/charstyle.h" +#include "styles/styleset.h" #include "stylemanager.h" /*! 02.01.2007 - 05.01.2007 : Joachim Neu : Create a paragraph style. Index: plugins/gettext/csvim/csvim.cpp =================================================================== --- plugins/gettext/csvim/csvim.cpp (revision 13792) +++ plugins/gettext/csvim/csvim.cpp (working copy) @@ -5,6 +5,9 @@ for which a new license (GPL+exception) is in place. */ #include "csvim.h" +#include "gtwriter.h" +#include "gtparagraphstyle.h" +#include "gtframestyle.h" #include "scribusstructs.h" QString FileFormatName() Index: plugins/gettext/csvim/csvim.h =================================================================== --- plugins/gettext/csvim/csvim.h (revision 13792) +++ plugins/gettext/csvim/csvim.h (working copy) @@ -9,8 +9,6 @@ #include "pluginapi.h" #include "csvdia.h" -#include <gtwriter.h> -#include <gtparagraphstyle.h> #include <QByteArray> #include <QFile> #include <QFileInfo> @@ -18,6 +16,9 @@ #include <QStringList> #include <QTextCodec> +class gtParagraphStyle; +class gtWriter; + extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer); extern "C" PLUGIN_API QString FileFormatName(); Index: plugins/gettext/sxwim/contentreader.cpp =================================================================== --- plugins/gettext/sxwim/contentreader.cpp (revision 13792) +++ plugins/gettext/sxwim/contentreader.cpp (working copy) @@ -25,10 +25,11 @@ ***************************************************************************/ #include "contentreader.h" +#include "gtparagraphstyle.h" #ifdef HAVE_XML -#include <scribusstructs.h> +#include "scribusstructs.h" #include <QByteArray> ContentReader* ContentReader::creader = NULL; Index: plugins/gettext/textfilter/tffilter.cpp =================================================================== --- plugins/gettext/textfilter/tffilter.cpp (revision 13792) +++ plugins/gettext/textfilter/tffilter.cpp (working copy) @@ -18,6 +18,7 @@ #include <QCheckBox> #include "scribusapi.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "prefsmanager.h" #include "prefsfile.h" #include "util_icon.h" Index: plugins/gettext/odtim/contentreader.h =================================================================== --- plugins/gettext/odtim/contentreader.h (revision 13792) +++ plugins/gettext/odtim/contentreader.h (working copy) @@ -38,10 +38,11 @@ #endif #include <QXmlAttributes> #include <QMap> -#include <gtstyle.h> -#include <gtwriter.h> -#include "stylereader.h" +class ListStyle; +class gtStyle; +class gtWriter; +class StyleReader; typedef std::vector<std::pair<QString, QString> > Properties; typedef QMap<QString, Properties > TMap; Index: plugins/gettext/odtim/contentreader.cpp =================================================================== --- plugins/gettext/odtim/contentreader.cpp (revision 13792) +++ plugins/gettext/odtim/contentreader.cpp (working copy) @@ -28,7 +28,13 @@ #include <QByteArray> #include "contentreader.h" #include "scribusstructs.h" +#include "gtwriter.h" +#include "gtstyle.h" +#include "gtparagraphstyle.h" +#include "stylereader.h" + + ContentReader* ContentReader::creader = NULL; extern xmlSAXHandlerPtr cSAXHandler; Index: plugins/short-words/shortwords.cpp =================================================================== --- plugins/short-words/shortwords.cpp (revision 13792) +++ plugins/short-words/shortwords.cpp (working copy) @@ -35,6 +35,7 @@ #include "swprefsgui.h" #include "scpaths.h" #include "scribus.h" +#include "scribusdoc.h" #include "util_icon.h" int scribusshortwords_getPluginAPIVersion() Index: plugins/short-words/parse.cpp =================================================================== --- plugins/short-words/parse.cpp (revision 13792) +++ plugins/short-words/parse.cpp (working copy) @@ -24,6 +24,7 @@ #include "configuration.h" #include "scribus.h" +#include "scribusdoc.h" #include "page.h" #include "pageitem.h" #include "selection.h" Index: plugins/saveastemplateplugin/satdialog.cpp =================================================================== --- plugins/saveastemplateplugin/satdialog.cpp (revision 13792) +++ plugins/saveastemplateplugin/satdialog.cpp (working copy) @@ -12,6 +12,7 @@ #include <QXmlDefaultHandler> #include <QXmlSimpleReader> +#include <QDir> #include "prefsmanager.h" #include "prefsfile.h" Index: plugins/aiimplugin/importai.cpp =================================================================== --- plugins/aiimplugin/importai.cpp (revision 13792) +++ plugins/aiimplugin/importai.cpp (working copy) @@ -22,12 +22,13 @@ #include <tiffio.h> #include <zlib.h> +#include "importai.h" #include "commonstrings.h" #include "customfdialog.h" -#include "importai.h" #include "loadsaveplugin.h" #include "missing.h" #include "multiprogressdialog.h" +#include "pageitem.h" #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" Index: plugins/aiimplugin/importai.h =================================================================== --- plugins/aiimplugin/importai.h (revision 13792) +++ plugins/aiimplugin/importai.h (working copy) @@ -12,16 +12,17 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include "vgradient.h" +#include "text/storytext.h" #include <QList> #include <QMatrix> // #include <QPainterPath> class MultiProgressDialog; class ScribusDoc; +class PageItem; class Selection; class TransactionSettings; Index: plugins/tools/lenseffects/lenseffects.cpp =================================================================== --- plugins/tools/lenseffects/lenseffects.cpp (revision 13792) +++ plugins/tools/lenseffects/lenseffects.cpp (working copy) @@ -27,6 +27,7 @@ #include "lenseffects.h" #include "lensdialog.h" #include "scribuscore.h" +#include "selection.h" int lenseffects_getPluginAPIVersion() { Index: plugins/tools/lenseffects/lenseffects.h =================================================================== --- plugins/tools/lenseffects/lenseffects.h (revision 13792) +++ plugins/tools/lenseffects/lenseffects.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Lens Effects" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathfinder/pathfinder.cpp =================================================================== --- plugins/tools/pathfinder/pathfinder.cpp (revision 13792) +++ plugins/tools/pathfinder/pathfinder.cpp (working copy) @@ -24,18 +24,21 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ****************************************************************************/ -#include <QMessageBox> -#include <QPixmap> -#include "pageitem_polygon.h" #include "pathfinder.h" #include "pathfinderdialog.h" +#include "pageitem_polygon.h" #include "propertiespalette.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "sccolorengine.h" +#include "selection.h" #include "util_color.h" #include "util_math.h" #include "util_icon.h" +#include <QMessageBox> +#include <QPixmap> + int pathfinder_getPluginAPIVersion() { return PLUGIN_API_VERSION; Index: plugins/tools/pathfinder/pathfinderdialog.cpp =================================================================== --- plugins/tools/pathfinder/pathfinderdialog.cpp (revision 13792) +++ plugins/tools/pathfinder/pathfinderdialog.cpp (working copy) @@ -25,7 +25,10 @@ #include "util_icon.h" #include "fpointarray.h" #include "sccolorengine.h" +#include "pageitem.h" +#include "scribusdoc.h" + #include <QPixmap> #include <QPainter> #include <QMatrix> Index: plugins/tools/pathfinder/pathfinder.h =================================================================== --- plugins/tools/pathfinder/pathfinder.h (revision 13792) +++ plugins/tools/pathfinder/pathfinder.h (working copy) @@ -30,7 +30,6 @@ #include <QColor> #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Finder" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathfinder/pathfinderdialog.h =================================================================== --- plugins/tools/pathfinder/pathfinderdialog.h (revision 13792) +++ plugins/tools/pathfinder/pathfinderdialog.h (working copy) @@ -12,9 +12,10 @@ #include <QPainterPath> #include <QColor> #include <QList> -#include "pageitem.h" -#include "scribusdoc.h" +class PageItem; +class ScribusDoc; + class PLUGIN_API PathFinderDialog : public QDialog, Ui::PathFinderBase { Q_OBJECT Index: plugins/tools/pathconnect/pathconnect.cpp =================================================================== --- plugins/tools/pathconnect/pathconnect.cpp (revision 13792) +++ plugins/tools/pathconnect/pathconnect.cpp (working copy) @@ -26,6 +26,8 @@ #include "pathconnect.h" #include "pathconnectdialog.h" +#include "selection.h" +#include "scribusdoc.h" int pathconnect_getPluginAPIVersion() { Index: plugins/tools/pathconnect/pathconnect.h =================================================================== --- plugins/tools/pathconnect/pathconnect.h (revision 13792) +++ plugins/tools/pathconnect/pathconnect.h (working copy) @@ -30,10 +30,10 @@ #include "fpointarray.h" #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" #include "scribuscore.h" -#include "scribusdoc.h" +class ScribusDoc; + /** \brief This is a simple "Path Connect" plugin for Scribus 1.3 and later. \author Franz Schmid \date November 2008 Index: plugins/tools/pathstroker/pathstroker.cpp =================================================================== --- plugins/tools/pathstroker/pathstroker.cpp (revision 13792) +++ plugins/tools/pathstroker/pathstroker.cpp (working copy) @@ -28,7 +28,9 @@ #include "pageitem_polygon.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" #include "util.h" #include <QPainterPathStroker> @@ -117,11 +119,7 @@ QVector<double> m_array; PageItem *currItem = currDoc->m_Selection->itemAt(0); FPointArray path = currItem->PoLine; - QPainterPath pp; - if (currItem->itemType() == PageItem::PolyLine) - pp = path.toQPainterPath(false); - else - pp = path.toQPainterPath(true); + QPainterPath pp = path.toQPainterPath(currItem->itemType() != PageItem::PolyLine); if (currItem->NamedLStyle.isEmpty()) { QPainterPathStroker stroke; Index: plugins/tools/pathstroker/pathstroker.h =================================================================== --- plugins/tools/pathstroker/pathstroker.h (revision 13792) +++ plugins/tools/pathstroker/pathstroker.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Stroker" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathcut/pathcut.cpp =================================================================== --- plugins/tools/pathcut/pathcut.cpp (revision 13792) +++ plugins/tools/pathcut/pathcut.cpp (working copy) @@ -26,7 +26,9 @@ #include "pathcut.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" #include "util.h" #include "util_icon.h" #include <QPainterPathStroker> Index: plugins/tools/pathcut/pathcut.h =================================================================== --- plugins/tools/pathcut/pathcut.h (revision 13792) +++ plugins/tools/pathcut/pathcut.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Cutter" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/transform/transformeffect.cpp =================================================================== --- plugins/tools/transform/transformeffect.cpp (revision 13792) +++ plugins/tools/transform/transformeffect.cpp (working copy) @@ -27,6 +27,7 @@ #include "transformeffect.h" #include "transformdialog.h" #include "scribuscore.h" +#include "selection.h" int transformeffect_getPluginAPIVersion() { Index: plugins/tools/transform/transformeffect.h =================================================================== --- plugins/tools/transform/transformeffect.h (revision 13792) +++ plugins/tools/transform/transformeffect.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Transform Effect" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/spellcheck/aspellplugin.cpp =================================================================== --- plugins/tools/spellcheck/aspellplugin.cpp (revision 13792) +++ plugins/tools/spellcheck/aspellplugin.cpp (working copy) @@ -4,9 +4,13 @@ a copyright and/or license notice that predates the release of Scribus 1.3.2 for which a new license (GPL+exception) is in place. */ -#include "scraction.h" + #include "aspellplugin.h" #include "aspellpluginimpl.h" +#include "scraction.h" +#include "scribus.h" +#include "scribusdoc.h" +#include "pageitem.h" // See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods // do. That documentatation is not duplicated here. Index: plugins/tools/spellcheck/aspellpluginimpl.cpp =================================================================== --- plugins/tools/spellcheck/aspellpluginimpl.cpp (revision 13792) +++ plugins/tools/spellcheck/aspellpluginimpl.cpp (working copy) @@ -5,6 +5,13 @@ for which a new license (GPL+exception) is in place. */ #include "aspellpluginimpl.h" +// Scribus include files +#include "scribusdoc.h" // For ScribusDoc +#include "scribus.h" // For ScribusMainWindow +#include "selection.h" // Item selected +#include "prefsfile.h" // Stored plugin preferences +#include "prefsmanager.h" // Preferences manager +#include "pageitem.h" #include "pageitem_textframe.h" #include "text/specialchars.h" #include "util.h" Index: plugins/tools/spellcheck/aspellpluginimpl.h =================================================================== --- plugins/tools/spellcheck/aspellpluginimpl.h (revision 13792) +++ plugins/tools/spellcheck/aspellpluginimpl.h (working copy) @@ -15,17 +15,15 @@ #include <QString> #include <QStringList> #include <QHash> -// Scribus include files -#include "scribusdoc.h" // For ScribusDoc -#include "scribus.h" // For ScribusMainWindow -#include "selection.h" // Item selected -#include "prefsfile.h" // Stored plugin preferences -#include "prefsmanager.h" // Preferences manager // Local include files #include "ui_aspellpluginbase.h" // For GUI from QT4 designer // #include "donedlgimpl.h" // For spell-checking done dialog #include "suggest.h" // For aspell interface class +class ScribusDoc; +class PrefsContext; +class PageItem; + /*! \class AspellPluginImpl \author Gora Mohanty <gora@srijan.in> Index: plugins/tools/subdivide/subdivide.cpp =================================================================== --- plugins/tools/subdivide/subdivide.cpp (revision 13792) +++ plugins/tools/subdivide/subdivide.cpp (working copy) @@ -26,7 +26,9 @@ #include "subdivide.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" int subdivide_getPluginAPIVersion() { Index: plugins/tools/subdivide/subdivide.h =================================================================== --- plugins/tools/subdivide/subdivide.h (revision 13792) +++ plugins/tools/subdivide/subdivide.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple Subdivide" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/xfigimplugin/importxfig.cpp =================================================================== --- plugins/xfigimplugin/importxfig.cpp (revision 13792) +++ plugins/xfigimplugin/importxfig.cpp (working copy) @@ -25,6 +25,7 @@ #include "missing.h" #include "multiprogressdialog.h" #include "pagesize.h" +#include "pageitem.h" #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" Index: plugins/xfigimplugin/importxfig.h =================================================================== --- plugins/xfigimplugin/importxfig.h (revision 13792) +++ plugins/xfigimplugin/importxfig.h (working copy) @@ -12,14 +12,15 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include <QList> +#include <QStack> #include <QMatrix> #include <QMultiMap> class MultiProgressDialog; +class PageItem; class ScribusDoc; class Selection; class TransactionSettings; Index: plugins/colorwheel/colorwheel.cpp =================================================================== --- plugins/colorwheel/colorwheel.cpp (revision 13792) +++ plugins/colorwheel/colorwheel.cpp (working copy) @@ -8,6 +8,7 @@ #include "colorwheel.h" #include "cwdialog.h" #include "scribuscore.h" +#include "scribusdoc.h" int colorwheel_getPluginAPIVersion() { Index: plugins/colorwheel/cwdialog.cpp =================================================================== --- plugins/colorwheel/cwdialog.cpp (revision 13792) +++ plugins/colorwheel/cwdialog.cpp (working copy) @@ -7,6 +7,7 @@ #include <QHeaderView> +#include "scribusdoc.h" #include "cmykfw.h" #include "colorblind.h" #include "colorlistbox.h" Index: plugins/fileloader/oodraw/oodrawimp.h =================================================================== --- plugins/fileloader/oodraw/oodrawimp.h (revision 13792) +++ plugins/fileloader/oodraw/oodrawimp.h (working copy) @@ -11,9 +11,9 @@ #include "loadsaveplugin.h" #include "../../formatidlist.h" #include "stylestack.h" -#include "pageitem.h" #include "scribusstructs.h" +class PageItem; class ScrAction; class ScribusDoc; class Selection; Index: plugins/svgexplugin/svgexplugin.cpp =================================================================== --- plugins/svgexplugin/svgexplugin.cpp (revision 13792) +++ plugins/svgexplugin/svgexplugin.cpp (working copy) @@ -534,7 +534,7 @@ ScImage img; CMSettings cms(m_Doc, Item->IProfile, Item->IRender); img.LoadPicture(Item->Pfile, Item->pixm.imgInfo.actualPageNumber, cms, Item->UseEmbedded, true, ScImage::RGBProof, 72); - img.applyEffect(Item->effectsInUse, m_Doc->PageColors, true); + img.applyEffects(Item->effectsInUse, m_Doc->PageColors, true); if (Options.inlineImages) { QBuffer buffer; Index: plugins/psimport/importps.h =================================================================== --- plugins/psimport/importps.h (revision 13792) +++ plugins/psimport/importps.h (working copy) @@ -12,13 +12,13 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include <QList> #include <QPainterPath> class MultiProgressDialog; +class PageItem; class ScribusDoc; class Selection; class TransactionSettings; Index: plugins/psimport/importps.cpp =================================================================== --- plugins/psimport/importps.cpp (revision 13792) +++ plugins/psimport/importps.cpp (working copy) @@ -25,6 +25,7 @@ #include "importps.h" #include "loadsaveplugin.h" #include "multiprogressdialog.h" +#include "pageitem.h" #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" Index: scribus.h =================================================================== --- scribus.h (revision 13792) +++ scribus.h (working copy) @@ -66,7 +66,6 @@ // application specific includes #include "scribusapi.h" #include "scribusview.h" -#include "scribusdoc.h" #include "customfdialog.h" class ActionManager; @@ -100,6 +99,7 @@ class ReformDoc; class ScToolBar; class ScrAction; +class ScribusDoc; class ScribusCore; class ScribusMainWindow; class ScribusQApp; Index: scpainterexbase.h =================================================================== --- scpainterexbase.h (revision 13792) +++ scpainterexbase.h (working copy) @@ -42,8 +42,8 @@ #include "fpointarray.h" #include "vgradientex.h" #include "sccolorshade.h" -#include "scimage.h" +class ScImage; class ScPattern; class SCRIBUS_API ScPainterExBase Index: canvasmode_panning.cpp =================================================================== --- canvasmode_panning.cpp (revision 13792) +++ canvasmode_panning.cpp (working copy) @@ -28,6 +28,7 @@ #include "fpoint.h" #include "fpointarray.h" #include "scribusview.h" +#include "scribusdoc.h" #include "util.h" #include "util_icon.h" Index: pslib.cpp =================================================================== --- pslib.cpp (revision 13792) +++ pslib.cpp (working copy) @@ -1463,7 +1463,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); QByteArray maskArray; bool alphaLoaded = image.getAlpha(fn, c->pixm.imgInfo.actualPageNumber, maskArray, false, true, 300); if (!alphaLoaded) @@ -1556,7 +1556,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); int w = image.width(); int h = image.height(); PutStream(ToStr(x*scalex) + " " + ToStr(y*scaley) + " tr\n"); Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 13792) +++ CMakeLists.txt (working copy) @@ -216,6 +216,7 @@ scfilewidget.h scgtplugin.h schelptreemodel.h + scimage_p.h scinputdialog.h scmenu.h scmessagebox.h |
|
ah, i forgot to mention that the patch is against yesterday's 135 svn |
|
Tip : 1.3.5svn has release candidate status, so there is not a single chance we apply that kind of patch to 1.3.5svn now. You should really work on trunk (1.5.0svn). [Edit] Could you provide a patch based on 1.5.0svn? |
|
yes, i'll provide the patch. my interest in doing it for 1.3.5 is that we'll be able to use(test) my changes in production earlier. |
2009-07-29 12:26
|
offload-images_and_decouple-header-dependencies_150.patch (105,623 bytes)
Index: pdflib_core.cpp =================================================================== --- pdflib_core.cpp (revision 13796) +++ pdflib_core.cpp (working copy) @@ -507,7 +507,7 @@ tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg"); if ((gray) && (!precal)) image.convertToGray(); - if (image.Convert2JPG(tmpFile, Options.Quality, cmyk, gray)) + if (image.saveToJpg(tmpFile, Options.Quality, cmyk, gray)) jpgFileName = tmpFile; } if (jpgFileName.isEmpty()) @@ -2261,7 +2261,7 @@ { ScImage img(pm.toImage()); bool compDataAvail = false; - QByteArray array = img.ImageToArray(); + QByteArray array = img.toArray(); if (Options.Compress) { QByteArray compArray = CompressArray(array); @@ -6920,7 +6920,7 @@ img.imgInfo.progressive = prog; } else - img.scaleImage(qRound(ax), qRound(ay)); + img.scale(qRound(ax), qRound(ay)); ImInfo.sxa = sx * a2; ImInfo.sya = sy * a1; } @@ -6945,14 +6945,13 @@ { if (!ICCProfiles.contains(Profil)) { - ScImage img3; int components = 0; uint embeddedProfile = newObject(); StartObj(embeddedProfile); QByteArray dataP; struct ICCD dataD; if ((Embedded) && (!Options.EmbeddedI)) - img3.getEmbeddedProfile(fn, &dataP, &components); + dataP=ScImage::getEmbeddedProfile(fn, &components); if ((dataP.isEmpty()) || ((img.imgInfo.colorspace == ColorSpaceGray) && (hasColorEffect) && (components == 1))) { if (img.imgInfo.colorspace == ColorSpaceCMYK) @@ -7101,7 +7100,7 @@ } origWidth = img.width(); origHeight = img.height(); - img.applyEffect(c->effectsInUse, c->doc()->PageColors, imgE); + img.applyEffects(c->effectsInUse, c->doc()->PageColors, imgE); if (!((Options.RecalcPic) && (Options.PicRes < (qMax(72.0 / c->imageXScale(), 72.0 / c->imageYScale()))))) { ImInfo.sxa = sx * (1.0 / ImInfo.reso); Index: scimage.h =================================================================== --- scimage.h (revision 13796) +++ scimage.h (working copy) @@ -10,34 +10,34 @@ #include "scconfig.h" #include "scribusapi.h" #include "scimagestructs.h" +#include "fpointarray.h" +#include "sccolor.h" + #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <QImage> #include <QString> -#include <QDataStream> -#include <QMap> -#include <QList> -#include <QVector> -#include <QFile> -#include <QDir> -#include <QStringList> -#include "fpointarray.h" -#include "sccolor.h" class ScribusDoc; class ScStreamFilter; class CMSettings; -class SCRIBUS_API ScImage : private QImage +/** + * clears its internal data if itsn't accessed for some time (10 seconds) + * and restores it on the next access, reapplying all the effects and transformations + * (graying and scaling) + */ +class SCRIBUS_API ScImage { + public: ScImage(); - ScImage(const QImage & image); - ScImage(const ScImage & image); - ScImage( int width, int height ); + ScImage(const QImage& image); + ScImage(const ScImage& image); + ScImage(int width, int height); ~ScImage(); enum RequestType @@ -66,68 +66,59 @@ }; void initialize(); + ScImage & operator=(const ScImage & other); - const QImage& qImage(); + + QImage qImage() const; + /** + * be careful not to save the pointer until the next event loop run: + * it may be cleared by timer + */ QImage* qImagePtr(); QImage scaled(int h, int w, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + + int height() const; + int width() const; + bool hasAlpha() const; - int height() const { return QImage::height(); } - int width() const { return QImage::width(); } - bool hasAlpha() const { return QImage::hasAlphaChannel(); } - - // Routines for PDF/PS output of images - QByteArray ImageToArray(); + bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - void convertToGray(void); + void convertToGray(); - bool writeRGBDataToFilter(ScStreamFilter* filter); - bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal); - bool writeCMYKDataToFilter(ScStreamFilter* filter); + void applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + /// Generate a low res image for user preview + void lowerResolution(double scale); + /// Scale this image in-place + void scale(int width, int height); - bool writePSImageToFilter(ScStreamFilter* filter, int pl); - bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl); + // Routines for PDF/PS output of images + QByteArray toArray() const; - bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - bool Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray); + bool writeRGBDataToFilter(ScStreamFilter* filter) const; + bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const; + bool writeCMYKDataToFilter(ScStreamFilter* filter) const; - // Image effects - void applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk); + bool writePSImageToFilter(ScStreamFilter* filter, int pl) const; + bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const; - // Generate a low res image for user preview - void createLowRes(double scale); + bool saveToJpg(QString fn, int quality, bool isCMYK, bool isGray) const; - // Scale this image in-place - void scaleImage(int width, int height); - // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. - // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. - void getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page = 0); - // Load an image into this ScImage instance // TODO: document params, split into smaller functions bool LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); - ImageInfoRecord imgInfo; -private: + // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. + // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. + static QByteArray getEmbeddedProfile(const QString & fn, int *components, int page = 0); - // Image effects - void solarize(double factor, bool cmyk); - void blur(int radius = 0); - void sharpen(double radius= 0.0, double sigma = 1.0); - void contrast(int contrastValue, bool cmyk); - void brightness(int brightnessValue, bool cmyk); - void invert(bool cmyk); - void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); - void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); - void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); - void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); - void toGrayscale(bool cmyk); - void doGraduate(FPointArray curve, bool cmyk, bool linear); - void swapRGBA(); - bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); - int getOptimalKernelWidth(double radius, double sigma); - void applyCurve(const QVector<int>& curveTable, bool cmyk); + ImageInfoRecord imgInfo; +private: + class Private; + mutable Private* d; }; #endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: hyphenator.cpp =================================================================== --- hyphenator.cpp (revision 13796) +++ hyphenator.cpp (working copy) @@ -36,6 +36,7 @@ #include "langmgr.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "prefsfile.h" #include "prefsmanager.h" #include "text/nlsconfig.h" Index: gtaction.cpp =================================================================== --- gtaction.cpp (revision 13796) +++ gtaction.cpp (working copy) @@ -24,23 +24,27 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <QCursor> -#include <QList> -#include <QStringList> - -#include "ui/missing.h" #include "gtaction.h" +#include "gtfont.h" +#include "gtstyle.h" +#include "gtparagraphstyle.h" +#include "gtframestyle.h" #include "ui/propertiespalette.h" +#include "ui/missing.h" #include "scribus.h" #include "color.h" +#include "sccolorengine.h" #include "prefsmanager.h" #include "hyphenator.h" #include "scclocale.h" #include "selection.h" #include "commonstrings.h" #include "util_icon.h" -#include "sccolorengine.h" +#include <QCursor> +#include <QList> +#include <QStringList> + // gtAction::gtAction(bool append) // { // prefsManager=PrefsManager::instance(); Index: pslib.h =================================================================== --- pslib.h (revision 13796) +++ pslib.h (working copy) @@ -33,9 +33,6 @@ #include <QPen> #include <QString> -class ScribusDoc; - -#include "page.h" #include "scribusapi.h" #include "scribusstructs.h" #include CMS_INC @@ -44,6 +41,8 @@ class ScText; #endif +class Page; +class ScribusDoc; class PageItem; class MultiProgressDialog; class ScImage; Index: canvasmode_nodeedit.cpp =================================================================== --- canvasmode_nodeedit.cpp (revision 13796) +++ canvasmode_nodeedit.cpp (working copy) @@ -23,6 +23,7 @@ #include "fpoint.h" #include "pageitem.h" #include "ui/pageselector.h" +#include "ui/scrspinbox.h" #include "scraction.h" #include "ui/scrapbookpalette.h" #include "scribus.h" Index: rawimage.h =================================================================== --- rawimage.h (revision 13796) +++ rawimage.h (working copy) @@ -10,7 +10,7 @@ #include "scconfig.h" #include "scribusapi.h" #include "QByteArray" -#include "QImage" +#include <QImage> class SCRIBUS_API RawImage : public QByteArray { Index: gtwriter.cpp =================================================================== --- gtwriter.cpp (revision 13796) +++ gtwriter.cpp (working copy) @@ -25,7 +25,8 @@ ***************************************************************************/ #include "gtwriter.h" -//#include "scfonts.h" +#include "gtframestyle.h" + #include "pageitem.h" #include "scribusstructs.h" Index: canvasmode.cpp =================================================================== --- canvasmode.cpp (revision 13796) +++ canvasmode.cpp (working copy) @@ -41,6 +41,7 @@ #include "scpainter.h" #include "ui/scresizecursor.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribusview.h" #include "util_icon.h" Index: sccolor.h =================================================================== --- sccolor.h (revision 13796) +++ sccolor.h (working copy) @@ -36,7 +36,7 @@ /** *@author Franz Schmid - * \brief This Class adds support for CMYK-Colors to QT. + * \brief This Class adds support for CMYK-Colors to Qt. * its API is based on the API of QColor */ @@ -153,7 +153,7 @@ ColorList& operator= (const ColorList& list); /** \brief Get the document the list is related , return in cpp due to scribusdoc class delcaration */ - ScribusDoc* document(void); + ScribusDoc* document() const; /** \brief Assign the doc to which the list belong to.*/ void setDocument(ScribusDoc* doc); Index: scimage_p.h =================================================================== --- scimage_p.h (revision 0) +++ scimage_p.h (revision 0) @@ -0,0 +1,114 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#ifndef SCIMAGE_P_H +#define SCIMAGE_P_H + +#include "cmsettings.h" +#include "scimage.h" + +#include <QVector> +#include <QImage> +#include <QObject> +#include <QTimer> + + +struct ScImage::Private: public QObject, public QImage +{ + Q_OBJECT + +private: + ScImage* q; + +public: + Private(ScImage* q_) + : QObject(), QImage() + , q(q_) + , height_(0) + , width_(0) + , imLoadSettings(0) + {} + + Private(ScImage* q_, int width, int height) + : QObject(), QImage(width, height, QImage::Format_ARGB32 ) + , q(q_) + , height_(height) + , width_(width) + , imLoadSettings(0) + {} + + virtual ~Private() + { + delete imLoadSettings; + } + + Private& operator=(const Private& other); + + void restore(); + void doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + bool doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); + + + struct ImageLoadSettings + { + QString fileName; + int page; + CMSettings cmSettings; + bool useEmbedded; + bool useProf; + RequestType requestType; + int gsRes; + + ImageLoadSettings(const CMSettings& s):cmSettings(s){} + }; + + struct ImageEffectSettings + { + ScImageEffectList effectsList; + ColorList colors; + bool cmyk; + bool convertToGray; + bool scale; //when scaleImage was called; + + ImageEffectSettings() + : cmyk(false) + , convertToGray(false) + , scale(false) + {} + }; + + int height_; + int width_; + QTimer clearTimer; + + ImageLoadSettings* imLoadSettings; + QVector<ImageEffectSettings> imEffectSettings; + + // Image effects + void solarize(double factor, bool cmyk); + void blur(int radius = 0); + void sharpen(double radius= 0.0, double sigma = 1.0); + void contrast(int contrastValue, bool cmyk); + void brightness(int brightnessValue, bool cmyk); + void invert(bool cmyk); + void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); + void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); + void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); + void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); + void toGrayscale(bool cmyk); + void doGraduate(FPointArray curve, bool cmyk, bool linear); + void swapRGBA(); + bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); + int getOptimalKernelWidth(double radius, double sigma); + void applyCurve(const QVector<int>& curveTable, bool cmyk); + +public Q_SLOTS: + void clear(); +}; + +#endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; tab-width 4; Index: scpageoutput_ps2.cpp =================================================================== --- scpageoutput_ps2.cpp (revision 13796) +++ scpageoutput_ps2.cpp (working copy) @@ -9,6 +9,7 @@ #include "commonstrings.h" #include "fonts/scfontmetrics.h" +#include "page.h" #include "pageitem.h" #include "scimage.h" #include "scpageoutput_ps2.h" Index: fonts/scface.cpp =================================================================== --- fonts/scface.cpp (revision 13796) +++ fonts/scface.cpp (working copy) @@ -4,17 +4,13 @@ #include "fonts/scface.h" #include "text/storytext.h" +static const QString NONE_LITERAL("(None)"); + ScFace::ScFaceData::ScFaceData() : refs(0), usage(0), - scName(""), - fontFile("(None)"), + fontFile(NONE_LITERAL), faceIndex(-1), - psName(""), - family(""), - style(""), - variant(""), - forDocument(""), status(ScFace::NULLFACE), typeCode(ScFace::UNKNOWN_TYPE), formatCode(ScFace::UNKNOWN_FORMAT), @@ -133,24 +129,21 @@ unicode emulate: spaces, hyphen, ligatures?, diacritics? *****/ -ScFace::ScFace() : replacedName(), replacedInDoc() +ScFace::ScFace() : m(new ScFaceData()) { - m = new ScFaceData(); m->refs = 1; m->usage = 0; } -ScFace::ScFace(ScFaceData* data) : replacedName(), replacedInDoc() +ScFace::ScFace(ScFaceData* data) : m(data) { - m = data; ++(m->refs); m->cachedStatus = ScFace::UNKNOWN; } -ScFace::ScFace(const ScFace& other) : replacedName(other.replacedName), replacedInDoc(other.replacedInDoc) +ScFace::ScFace(const ScFace& other) : m(other.m), replacedName(other.replacedName), replacedInDoc(other.replacedInDoc) { - m = other.m; ++(m->refs); } @@ -159,7 +152,6 @@ if ( m && --(m->refs) == 0 ) { m->unload(); delete m; - m = 0; } } Index: scribusview.h =================================================================== --- scribusview.h (revision 13796) +++ scribusview.h (working copy) @@ -53,6 +53,7 @@ #include <QRect> #include <QRectF> #include <QTime> +#include <QTimer> #include <QWheelEvent> #include <QRubberBand> #include <QList> @@ -64,7 +65,6 @@ #include "observable.h" #include "scribusapi.h" #include "scribusdoc.h" -#include "ui/scrspinbox.h" class Canvas; class CanvasMode; @@ -73,9 +73,13 @@ class Vruler; class Page; class RulerMover; +class PageItem; class PageSelector; +class ScribusDoc; class ScribusWin; class ScribusMainWindow; +class ScrSpinBox; +class Selection; class UndoManager; class UndoTransaction; class TransactionSettings; Index: scimgdataloader_pdf.cpp =================================================================== --- scimgdataloader_pdf.cpp (revision 13796) +++ scimgdataloader_pdf.cpp (working copy) @@ -5,6 +5,7 @@ for which a new license (GPL+exception) is in place. */ #include <QDebug> +#include <QDir> #include <QFile> #include <QFileInfo> Index: gtaction.h =================================================================== --- gtaction.h (revision 13796) +++ gtaction.h (working copy) @@ -32,21 +32,21 @@ #include <QMap> #include <QString> +#include "scribusapi.h" + class PageItem; class PrefsManager; class ScFace; - -#include "gtfont.h" -#include "gtframestyle.h" -#include "gtparagraphstyle.h" -#include "gtstyle.h" -#include "scribusapi.h" - class CharStyle; class ParagraphStyle; class ScribusDoc; class ScribusMainWindow; +class gtStyle; +class gtParagraphStyle; +class gtFont; +class gtFrameStyle; + typedef QMap<QString, QString> FontFamilyMap; class SCRIBUS_API gtAction Index: scribuswin.cpp =================================================================== --- scribuswin.cpp (revision 13796) +++ scribuswin.cpp (working copy) @@ -20,22 +20,24 @@ * (at your option) any later version. * * * ***************************************************************************/ -#include <QCloseEvent> -#include <QDir> -#include <QFileInfo> -#include <QMessageBox> +#include "scribuswin.h" +#include "scribus.h" #include "commonstrings.h" #include "fileloader.h" #include "ui/masterpagepalette.h" #include "ui/pageselector.h" -#include "scribus.h" -#include "scribuswin.h" +#include "ui/scrspinbox.h" #include "ui/storyeditor.h" #include "util.h" #include "util_file.h" #include "util_icon.h" +#include <QCloseEvent> +#include <QDir> +#include <QFileInfo> +#include <QMessageBox> + ScribusWin::ScribusWin(QWidget* parent, ScribusDoc* doc) : QMainWindow(parent) { setWindowIcon(loadIcon("AppIcon2.png")); @@ -147,12 +149,8 @@ void ScribusWin::setMasterPagesPaletteShown(bool isShown) const { - if (m_masterPagesPalette==NULL) - return; - if (isShown) - m_masterPagesPalette->show(); - else - m_masterPagesPalette->hide(); + if (m_masterPagesPalette) + m_masterPagesPalette->setVisible(isShown); } void ScribusWin::windowActivationChange ( bool oldActive ) Index: scribusXml.h =================================================================== --- scribusXml.h (revision 13796) +++ scribusXml.h (working copy) @@ -23,7 +23,6 @@ #include "scfonts.h" #include "scribusapi.h" #include "scribusstructs.h" -#include "selection.h" #include "styles/styleset.h" #include <QXmlStreamAttributes> @@ -36,6 +35,7 @@ class ScribusDoc; class ScPattern; class ScXmlStreamWriter; +class Selection; class SCRIBUS_API ScriXmlDoc { Index: sccolorengine.cpp =================================================================== --- sccolorengine.cpp (revision 13796) +++ sccolorengine.cpp (working copy) @@ -23,6 +23,7 @@ #include "sccolorengine.h" #include "scribuscore.h" +#include "scribusdoc.h" #include CMS_INC QColor ScColorEngine::getRGBColor(const ScColor& color, const ScribusDoc* doc) Index: scribusXml.cpp =================================================================== --- scribusXml.cpp (revision 13796) +++ scribusXml.cpp (working copy) @@ -35,9 +35,11 @@ #include "page.h" #include "pageitem.h" #include "pageitem_latexframe.h" +#include "selection.h" #include "units.h" #include "prefsmanager.h" #include "scribusview.h" +#include "scribusdoc.h" #include "scclocale.h" #include "commonstrings.h" #include "text/nlsconfig.h" Index: sccolor.cpp =================================================================== --- sccolor.cpp (revision 13796) +++ sccolor.cpp (working copy) @@ -331,7 +331,7 @@ addColors(colorList, overwrite); } -ScribusDoc* ColorList::document(void) +ScribusDoc* ColorList::document() const { return m_doc; } Index: guidemanagercore.cpp =================================================================== --- guidemanagercore.cpp (revision 13796) +++ guidemanagercore.cpp (working copy) @@ -16,10 +16,12 @@ #include "ui/guidemanager.h" #include "scclocale.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "pagestructs.h" #include "selection.h" + GuideManagerCore::GuideManagerCore(): undoManager(UndoManager::instance()), m_page(0), Index: scfonts.cpp =================================================================== --- scfonts.cpp (revision 13796) +++ scfonts.cpp (working copy) @@ -40,6 +40,7 @@ #include "prefstable.h" #include "scribus.h" #include "scribuscore.h" +#include "scribusdoc.h" #ifdef Q_WS_X11 #include <X11/X.h> #include <X11/Xlib.h> Index: scpageoutput.h =================================================================== --- scpageoutput.h (revision 13796) +++ scpageoutput.h (working copy) @@ -13,6 +13,7 @@ #include "scribusapi.h" #include "sccolor.h" #include "scpainterexbase.h" +#include "scimage.h" class ScribusDoc; class Page; Index: pageitem.h =================================================================== --- pageitem.h (revision 13796) +++ pageitem.h (working copy) @@ -257,7 +257,7 @@ virtual void applicableActions(QStringList& actionList) = 0; virtual QString infoDescription(); - + protected: void DrawObj_ImageFrame(ScPainter *p, double sc); //void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc); Index: gtwriter.h =================================================================== --- gtwriter.h (revision 13796) +++ gtwriter.h (working copy) @@ -29,10 +29,6 @@ #include "scribusapi.h" #include "gtaction.h" -#include "gtfont.h" -#include "gtframestyle.h" -#include "gtparagraphstyle.h" -#include "gtstyle.h" class PageItem; Index: scpageoutput.cpp =================================================================== --- scpageoutput.cpp (revision 13796) +++ scpageoutput.cpp (working copy) @@ -940,7 +940,7 @@ imScaleX *= (72.0 / (double) m_imageRes); imScaleY *= (72.0 / (double) m_imageRes); } - scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); + scImg.applyEffects(item->effectsInUse, m_doc->PageColors, useCmyk); mode = imageMode; pImage = &scImg; } Index: pageitem.cpp =================================================================== --- pageitem.cpp (revision 13796) +++ pageitem.cpp (working copy) @@ -4853,7 +4853,7 @@ } effectsInUse.append(ef); } - pixm.applyEffect(effectsInUse, m_Doc->PageColors, false); + pixm.applyEffects(effectsInUse, m_Doc->PageColors, false); // if (reload) pixm.imgInfo.lowResType = lowResTypeBack; if (pixm.imgInfo.lowResType != 0) @@ -4868,7 +4868,7 @@ double ratio = pixels / 3000000.0; scaling *= sqrt(ratio); } - pixm.createLowRes(scaling); + pixm.lowerResolution(scaling); pixm.imgInfo.lowResScale = scaling; } if ((m_Doc->view()->m_canvas->usePreviewVisual())) Index: scimage.cpp =================================================================== --- scimage.cpp (revision 13796) +++ scimage.cpp (working copy) @@ -5,12 +5,14 @@ for which a new license (GPL+exception) is in place. */ +#include "scimage.h" +#include "scimage_p.h" #include "cmsettings.h" #include "scclocale.h" -#include "scimage.h" #include "scribus.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scimgdataloader_gimp.h" #include "scimgdataloader_jpeg.h" #include "scimgdataloader_ps.h" @@ -22,6 +24,7 @@ #include <QMessageBox> #include <QList> #include <QByteArray> +#include <QTime> #include <cassert> #include <cmath> #include <cstdlib> @@ -69,42 +72,116 @@ longjmp (myerr->setjmp_buffer, 1); } -ScImage::ScImage(const QImage & image) : QImage(image) +//we start unloading images immediately in ScImage::LoadPicture when grossNumKBytes > 128*1024 +static long grossNumKBytes=0; + + +ScImage::Private& ScImage::Private::operator=(const ScImage::Private& other) { + QImage::operator=(other); + + height_=other.height_; + width_=other.width_; + + delete imLoadSettings; imLoadSettings=0; + if( other.imLoadSettings ) + { + imLoadSettings = new ImageLoadSettings(other.imLoadSettings->cmSettings); + *imLoadSettings = *other.imLoadSettings; + } + + imEffectSettings=other.imEffectSettings; + + if (!isNull()) + clearTimer.start(); + + return *this; +} + +void ScImage::Private::clear() +{ + qDebug()<<"clearImage()"; + if (imLoadSettings) + qDebug()<<imLoadSettings->fileName; + grossNumKBytes-=(numBytes()/1000); + *((QImage*)this)=QImage(); +} + + +ScImage::ScImage(const QImage& image) + : d(new Private(this)) +{ initialize(); + + d->height_=image.height(); + d->width_=image.width(); } - // ScImage will use implicit sharing: -ScImage::ScImage(const ScImage & image) : QImage(image.copy()) +ScImage::ScImage(const ScImage& other) + : d(new Private(this)) { initialize(); + *d=*(other.d); } -ScImage::ScImage() : QImage() +ScImage::ScImage() + : d(new Private(this)) { initialize(); } -ScImage::ScImage( int width, int height ) : QImage( width, height, QImage::Format_ARGB32 ) +ScImage::ScImage(int width, int height) + : d(new Private(this, width, height)) { initialize(); } -const QImage& ScImage::qImage() + +QImage ScImage::qImage() const { - return *this; + d->restore(); + qDebug()<<"we are in const QImage& ScImage::qImage() "<<endl; + return *((QImage*)d); } QImage* ScImage::qImagePtr() { - return this; + d->restore(); + qDebug()<<"we are in const QImagePtr::qImage() "<<endl; + return d; } +int ScImage::height() const +{ + if (d->height_==-1) + d->restore(); + return d->height_; +} + +int ScImage::width() const +{ + if (d->width_==-1) + d->restore(); + return d->width_; +} + +bool ScImage::hasAlpha() const +{ + return d->hasAlphaChannel(); +} + +ScImage& ScImage::operator=(const ScImage& other) +{ + *d=*other.d; + return *this; +} + QImage ScImage::scaled(int h, int w, Qt::AspectRatioMode mode, Qt::TransformationMode transformMode) const { - return QImage::scaled(h, w, mode, transformMode); + d->restore(); + return d->scaled(h, w, mode, transformMode); } @@ -131,254 +208,300 @@ imgInfo.exifInfo.thumbnail = QImage(); imgInfo.BBoxX = 0; imgInfo.BBoxH = 0; + + QObject::connect(&(d->clearTimer), SIGNAL(timeout()), d, SLOT(clear())); + d->clearTimer.setInterval(10000); + d->clearTimer.setSingleShot(false); } ScImage::~ScImage() { + delete d; } -void ScImage::applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk) +void ScImage::Private::restore() { + if (isNull() && imLoadSettings) + { + doLoadPicture(imLoadSettings->fileName, imLoadSettings->page, imLoadSettings->cmSettings, imLoadSettings->useEmbedded, imLoadSettings->useProf, imLoadSettings->requestType, imLoadSettings->gsRes, 0, false); + int oldWidth=width_; + int oldHeight=height_; + + width_=width(); + height_=height(); + foreach(const ImageEffectSettings& imEffectSetting, imEffectSettings) + { + if (imEffectSetting.convertToGray) + q->convertToGray(); + else if (imEffectSetting.scale) + q->scale(oldWidth, oldHeight); + else + doApplyEffect(imEffectSetting.effectsList, imEffectSetting.colors, imEffectSetting.cmyk); + } + qDebug()<<"restoring"<<imLoadSettings->fileName; + } + else + qDebug()<<"not restoring"; + if (imLoadSettings) + clearTimer.start(); +} + +//TODO const ColorList& colors +void ScImage::applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ + qDebug()<<"restoring"; + if (d->imLoadSettings) + qDebug()<<d->imLoadSettings->fileName; + + Private::ImageEffectSettings s; + s.effectsList = effectsList; + s.colors = colors; + s.cmyk = cmyk; + d->imEffectSettings.append(s); + + if (!d->isNull()) + d->doApplyEffect(effectsList, colors, cmyk); +} + +void ScImage::Private::doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ ScribusDoc* doc = colors.document(); - if (effectsList.count() != 0) + Q_FOREACH(const ImageEffect& effect, effectsList) { - for (int a = 0; a < effectsList.count(); ++a) + if (effect.effectCode == EF_INVERT) + invert(cmyk); + if (effect.effectCode == EF_GRAYSCALE) + toGrayscale(cmyk); + if (effect.effectCode == EF_COLORIZE) { - if (effectsList.at(a).effectCode == EF_INVERT) - invert(cmyk); - if (effectsList.at(a).effectCode == EF_GRAYSCALE) - toGrayscale(cmyk); - if (effectsList.at(a).effectCode == EF_COLORIZE) + QString tmpstr = effect.effectParameters; + QString col = CommonStrings::None; + int shading = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + // fp >> col; + col = fp.readLine(); + fp >> shading; + colorize(doc, colors[col], shading, cmyk); + } + if (effect.effectCode == EF_BRIGHTNESS) + { + QString tmpstr = effect.effectParameters; + int brightnessValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> brightnessValue; + brightness(brightnessValue, cmyk); + } + if (effect.effectCode == EF_CONTRAST) + { + QString tmpstr = effect.effectParameters; + int contrastValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> contrastValue; + contrast(contrastValue, cmyk); + } + if (effect.effectCode == EF_SHARPEN) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + sharpen(radius, sigma); + } + if (effect.effectCode == EF_BLUR) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + blur(static_cast<int>(radius)); + } + if (effect.effectCode == EF_SOLARIZE) + { + QString tmpstr = effect.effectParameters; + double sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> sigma; + solarize(sigma, cmyk); + } + if (effect.effectCode == EF_DUOTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + int shading1 = 100; + QString col2 = CommonStrings::None; + int shading2 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + fp >> shading1; + fp >> shading2; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col = CommonStrings::None; - int shading = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - // fp >> col; - col = fp.readLine(); - fp >> shading; - colorize(doc, colors[col], shading, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BRIGHTNESS) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int brightnessValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> brightnessValue; - brightness(brightnessValue, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_CONTRAST) + int lin2; + fp >> lin2; + duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + } + if (effect.effectCode == EF_TRITONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int contrastValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> contrastValue; - contrast(contrastValue, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SHARPEN) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - sharpen(radius, sigma); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BLUR) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - blur(static_cast<int>(radius)); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SOLARIZE) + int lin3; + fp >> lin3; + tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + } + if (effect.effectCode == EF_QUADTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + QString col4 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + int shading4 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + col4 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + fp >> shading4; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> sigma; - solarize(sigma, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_DUOTONE) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - int shading1 = 100; - QString col2 = CommonStrings::None; - int shading2 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - fp >> shading1; - fp >> shading2; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_TRITONE) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_QUADTONE) + int lin3; + fp >> lin3; + FPointArray curve4; + curve4.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - QString col4 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - int shading4 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - col4 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - fp >> shading4; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - FPointArray curve4; - curve4.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve4.addPoint(xval, yval); - } - int lin4; - fp >> lin4; - quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + fp >> xval; + fp >> yval; + curve4.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_GRADUATE) + int lin4; + fp >> lin4; + quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + } + if (effect.effectCode == EF_GRADUATE) + { + QString tmpstr = effect.effectParameters; + int numVals; + double xval, yval; + FPointArray curve; + curve.resize(0); + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int numVals; - double xval, yval; - FPointArray curve; - curve.resize(0); - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve.addPoint(xval, yval); - } - int lin; - fp >> lin; - doGraduate(curve, cmyk, lin); + fp >> xval; + fp >> yval; + curve.addPoint(xval, yval); } + int lin; + fp >> lin; + doGraduate(curve, cmyk, lin); } } } @@ -392,7 +515,7 @@ *memory=(void *) NULL; } */ -void ScImage::solarize(double factor, bool cmyk) +void ScImage::Private::solarize(double factor, bool cmyk) { QVector<int> curveTable(256); int fk = qRound(255 / factor); @@ -404,15 +527,15 @@ } // Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com> -void ScImage::blur(int radius) +void ScImage::Private::blur(int radius) { if (radius < 1) { return; } QRgb *pix = (QRgb*)bits(); - int w = width(); - int h = height(); + int w = width_; + int h = height_; int wm = w-1; int hm = h-1; int wh = w*h; @@ -647,7 +770,7 @@ delete [] stack; } -bool ScImage::convolveImage(QImage *dest, const unsigned int order, const double *kernel) +bool ScImage::Private::convolveImage(QImage *dest, const unsigned int order, const double *kernel) { long widthk; double red, green, blue, alpha; @@ -663,7 +786,7 @@ normal_kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!normal_kernel) return(false); - *dest = QImage(width(), height(), QImage::Format_ARGB32); + *dest = QImage(width_, height_, QImage::Format_ARGB32); normalize=0.0; for(i=0; i < (widthk*widthk); i++) normalize += kernel[i]; @@ -683,11 +806,11 @@ sy = y-(widthk/2); for(mcy=0; mcy < widthk; ++mcy, ++sy) { - my = sy < 0 ? 0 : sy > height()-1 ? height()-1 : sy; + my = sy < 0 ? 0 : sy > height_-1 ? height_-1 : sy; sx = x+(-widthk/2); for(mcx=0; mcx < widthk; ++mcx, ++sx) { - mx = sx < 0 ? 0 : sx > width()-1 ? width()-1 : sx; + mx = sx < 0 ? 0 : sx > width_-1 ? width_-1 : sx; int px = pixel(mx, my); red += (*k)*(qRed(px)*257); green += (*k)*(qGreen(px)*257); @@ -696,7 +819,7 @@ ++k; } } - red = red < 0 ? 0 : red > 65535 ? 65535 : red+0.5; + red = red < 0 ? 0 : red > 65535 ? 6553 : red+0.5; green = green < 0 ? 0 : green > 65535 ? 65535 : green+0.5; blue = blue < 0 ? 0 : blue > 65535 ? 65535 : blue+0.5; alpha = alpha < 0 ? 0 : alpha > 65535 ? 65535 : alpha+0.5; @@ -710,7 +833,7 @@ return(true); } -int ScImage::getOptimalKernelWidth(double radius, double sigma) +int ScImage::Private::getOptimalKernelWidth(double radius, double sigma) { double normalize, value; long width; @@ -732,7 +855,7 @@ return((int)width-2); } -void ScImage::sharpen(double radius, double sigma) +void ScImage::Private::sharpen(double radius, double sigma) { double alpha, normalize, *kernel; int widthk; @@ -741,7 +864,7 @@ if(sigma == 0.0) return; widthk = getOptimalKernelWidth(radius, sigma); - if(width() < widthk) + if(width_ < widthk) return; kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!kernel) @@ -776,7 +899,7 @@ return; } -void ScImage::contrast(int contrastValue, bool cmyk) +void ScImage::Private::contrast(int contrastValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 - contrastValue); @@ -789,7 +912,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::brightness(int brightnessValue, bool cmyk) +void ScImage::Private::brightness(int brightnessValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 + brightnessValue); @@ -802,7 +925,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::doGraduate(FPointArray curve, bool cmyk, bool linear) +void ScImage::Private::doGraduate(FPointArray curve, bool cmyk, bool linear) { QVector<int> curveTable(256); for (int x = 0 ; x < 256 ; x++) @@ -812,10 +935,10 @@ applyCurve(curveTable, cmyk); } -void ScImage::applyCurve(const QVector<int>& curveTable, bool cmyk) +void ScImage::Private::applyCurve(const QVector<int>& curveTable, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; QRgb *s; QRgb r; int c, m, y, k; @@ -847,10 +970,10 @@ } } -void ScImage::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) +void ScImage::Private::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int cc, cm, cy, ck; int hu, sa, v; ScColor tmp2; @@ -897,10 +1020,10 @@ } } -void ScImage::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) +void ScImage::Private::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, m, m1, y, y1, k, k1; int cn, c1n, mn, m1n, yn, y1n, kn, k1n; uchar cb; @@ -953,10 +1076,10 @@ } } -void ScImage::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) +void ScImage::Private::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, m, m1, m2, y, y1, y2, k, k1, k2; int cn, c1n, c2n, mn, m1n, m2n, yn, y1n, y2n, kn, k1n, k2n; uchar cb; @@ -1021,10 +1144,10 @@ } } -void ScImage::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) +void ScImage::Private::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, c3, m, m1, m2, m3, y, y1, y2, y3, k, k1, k2, k3; int cn, c1n, c2n, c3n, mn, m1n, m2n, m3n, yn, y1n, y2n, y3n, kn, k1n, k2n, k3n; uchar cb; @@ -1101,10 +1224,10 @@ } } -void ScImage::invert(bool cmyk) +void ScImage::Private::invert(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; unsigned char *p; QRgb * s; unsigned char c, m, y, k; @@ -1116,7 +1239,7 @@ if (cmyk) { p = (unsigned char *) s; - c = 255 - qMin(255, p[0] + p[3]); + c = 255 - qMin(255, p[0] + p[3]); m = 255 - qMin(255, p[1] + p[3]); y = 255 - qMin(255, p[2] + p[3]); k = qMin(qMin(c, m), y); @@ -1132,10 +1255,10 @@ } } -void ScImage::toGrayscale(bool cmyk) +void ScImage::Private::toGrayscale(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int k; QRgb * s; QRgb r; @@ -1160,7 +1283,7 @@ } } -void ScImage::swapRGBA() +void ScImage::Private::swapRGBA() { unsigned int *ptr; unsigned char *p; @@ -1168,7 +1291,7 @@ for (int i = 0; i < height(); ++i) { ptr = (unsigned int *) scanLine(i); - for (int j = 0; j < width(); ++j) + for (int j = 0; j < width_; ++j) { p = (unsigned char *) ptr; r = p[0]; @@ -1180,18 +1303,21 @@ } } -void ScImage::createLowRes(double scale) +//TODO rename to 'makeLowRes' +void ScImage::lowerResolution(double scale) { int w = qRound(width() / scale); int h = qRound(height() / scale); QImage tmp = scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (tmp.format() != QImage::Format_ARGB32) tmp = tmp.convertToFormat(QImage::Format_ARGB32); - QImage::operator=(tmp); + *((QImage*)d)=tmp; } -bool ScImage::Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray) +bool ScImage::saveToJpg(QString fn, int Quality, bool isCMYK, bool isGray) const { + d->restore(); + struct jpeg_compress_struct cinfo; struct my_error_mgr jerr; FILE *outfile; @@ -1242,7 +1368,7 @@ uchar *row = row_pointer[0]; if (isCMYK) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1256,7 +1382,7 @@ { if (isGray) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1265,7 +1391,7 @@ } else { - QRgb* rgb = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgb = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row++ = qRed(*rgb); @@ -1284,8 +1410,10 @@ return true; } -QByteArray ScImage::ImageToArray() +QByteArray ScImage::toArray() const { + d->restore(); + int i = 0; int h = height(); int w = width(); @@ -1297,7 +1425,7 @@ return imgArray; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1312,15 +1440,20 @@ return imgArray; } -void ScImage::convertToGray(void) +void ScImage::convertToGray() { + d->restore(); + Private::ImageEffectSettings t; + t.convertToGray = true; + d->imEffectSettings.append(t); + int k; int h = height(); int w = width(); QRgb *s, r; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s; @@ -1330,8 +1463,10 @@ } } -bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) +bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1345,7 +1480,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1364,8 +1499,10 @@ return success; } -bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) +bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1379,7 +1516,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); if (precal) // image data is already grayscale, no need for weighted conversion { for( int xi=0; xi < w; ++xi ) @@ -1411,8 +1548,10 @@ return success; } -bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) +bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1426,7 +1565,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1446,8 +1585,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1462,7 +1603,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1502,8 +1643,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1521,7 +1664,7 @@ unsigned char* maskData = (unsigned char*) mask.constData(); for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1563,8 +1706,13 @@ return success; } -void ScImage::scaleImage(int nwidth, int nheight) +void ScImage::scale(int nwidth, int nheight) { + d->restore(); + Private::ImageEffectSettings t; + t.scale = true; + d->imEffectSettings.append(t); + QImage dst(nwidth, nheight, QImage::Format_ARGB32); QRgb* xelrow = 0; QRgb* tempxelrow = 0; @@ -1621,13 +1769,13 @@ for ( row = 0; row < newrows; ++row ) { if ( newrows == rows ) - tempxelrow = xelrow = (QRgb*)scanLine(rowsread++); + tempxelrow = xelrow = (QRgb*)d->scanLine(rowsread++); else { while ( fracrowleft < fracrowtofill ) { if ( needtoreadrow && rowsread < rows ) - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); for ( col = 0, xP = xelrow; col < cols; ++col, ++xP ) { as[col] += fracrowleft * qAlpha( *xP ); @@ -1641,7 +1789,7 @@ } if ( needtoreadrow && rowsread < rows ) { - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); needtoreadrow = 0; } register long a=0; @@ -1756,11 +1904,11 @@ delete [] gs; if ( bs ) // Robust, bs might be 0 one day delete [] bs; - QImage::operator=(QImage(nwidth, nheight, QImage::Format_ARGB32)); + *((QImage*)this->d)=QImage(nwidth, nheight, QImage::Format_ARGB32); for( int yi=0; yi < dst.height(); ++yi ) { QRgb *s = (QRgb*)(dst.scanLine( yi )); - QRgb *d = (QRgb*)(scanLine( yi )); + QRgb *d = (QRgb*)(this->d->scanLine( yi )); for(int xi=0; xi < dst.width(); ++xi ) { (*d) = (*s); @@ -1768,7 +1916,8 @@ d++; } } - return; + d->width_=d->width(); + d->height_=d->height(); } bool ScImage::getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes, int scaleXSize, int scaleYSize) @@ -1824,10 +1973,8 @@ { if (pDataLoader->imageInfoRecord().valid) { - if ((pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK)) - rImage = pDataLoader->r_image.convertToQImage(true); - else - rImage = pDataLoader->r_image.convertToQImage(false); + bool cmyk=(pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK); + rImage = pDataLoader->r_image.convertToQImage(cmyk); } } else @@ -1893,18 +2040,17 @@ return gotAlpha; } -void ScImage::getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page) +QByteArray ScImage::getEmbeddedProfile(const QString & fn, int *components, int page) { - Q_ASSERT(profile); + QByteArray profile; Q_ASSERT(components); ScImgDataLoader* pDataLoader = NULL; cmsHPROFILE prof = 0; - profile->resize(0); *components = 0; QFileInfo fi = QFileInfo(fn); if (!fi.exists()) - return; + return QByteArray(); QString ext = fi.suffix().toLower(); if (extensionIndicatesPSD(ext)) @@ -1931,18 +2077,54 @@ *components = 4; if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData) *components = 1; - *profile = embeddedProfile; + profile = embeddedProfile; } cmsCloseProfile(prof); } delete pDataLoader; } + return profile; } + bool ScImage::LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK, bool showMsg) { + delete d->imLoadSettings; + d->imLoadSettings = new Private::ImageLoadSettings(cmSettings); + + d->imLoadSettings->fileName=fn; + d->imLoadSettings->page=page; +// d->imLoadSettings->cmSettings=cmSettings; + d->imLoadSettings->useEmbedded=useEmbedded; + d->imLoadSettings->useProf=useProf; + d->imLoadSettings->requestType=requestType; + d->imLoadSettings->gsRes=gsRes; + + d->imEffectSettings.clear(); + + d->height_=-1; + d->width_=-1; + + //TODO + QTime a;a.start(); + bool ok=d->doLoadPicture(fn, page, cmSettings, useEmbedded, useProf, requestType, gsRes, realCMYK, showMsg); + d->height_=d->height(); + d->width_=d->width(); + qDebug()<<"LoadPicture"<<fn<<realCMYK<<showMsg<<a.elapsed()<<d->numBytes(); + + //so low-memory systems don't get lost in swap on document loading + if (grossNumKBytes>128*1024) + d->clear(); + return ok; +} + +bool ScImage::Private::doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, + bool useEmbedded, bool useProf, RequestType requestType, + int gsRes, bool *realCMYK, bool showMsg) +{ + qDebug()<<"doLoadPicture"<<fn; // requestType - 0: CMYK, 1: RGB, 2: RGB Proof 3 : RawData, 4: Thumbnail // gsRes - is the resolution that ghostscript will render at bool isCMYK = false; @@ -1960,8 +2142,10 @@ int cmsProofFlags = 0; auto_ptr<ScImgDataLoader> pDataLoader; QFileInfo fi = QFileInfo(fn); + qDebug()<<"doLoadPicture 0"; if (!fi.exists()) return ret; + qDebug()<<"doLoadPicture 01"; QString ext = fi.suffix().toLower(); QString tmp, dummy, cmd1, cmd2, BBox, tmp2; QChar tc; @@ -1987,7 +2171,7 @@ else if (extensionIndicatesPSD(ext)) { pDataLoader.reset( new ScImgDataLoader_PSD() ); - pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps); + pDataLoader->setRequest(q->imgInfo.isRequest, q->imgInfo.RequestProps); } else if (extensionIndicatesJPEG(ext)) pDataLoader.reset( new ScImgDataLoader_JPEG() ); @@ -1999,7 +2183,7 @@ if (pDataLoader->loadPicture(fn, page, gsRes, (requestType == Thumbnail))) { QImage::operator=(pDataLoader->image()); - imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo = pDataLoader->imageInfoRecord(); if (requestType == Thumbnail) reqType = RGBData; // if (!cmSettings.useColorManagement() || !useProf) @@ -2007,13 +2191,13 @@ // imgInfo.isEmbedded = false; // imgInfo.profileName = ""; // } - if (imgInfo.colorspace == ColorSpaceCMYK) + if (q->imgInfo.colorspace == ColorSpaceCMYK) { isCMYK = true; if(realCMYK) *realCMYK = true; } - else if (imgInfo.colorspace == ColorSpaceGray) + else if (q->imgInfo.colorspace == ColorSpaceGray) bilevel = true; pDataLoader->image() = QImage(); } @@ -2028,14 +2212,17 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + qDebug()<<"doLoadPicture 000"; return false; } + qDebug()<<"doLoadPicture 111"; if (!(extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))) { if (isNull()) return ret; } + qDebug()<<"doLoadPicture 112"; QByteArray embeddedProfile = pDataLoader->embeddedProfile(); if (cmSettings.useColorManagement() && useProf) @@ -2054,15 +2241,15 @@ { if (ScCore->InputProfilesCMYK.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile)) { - imgInfo.profileName = cmSettings.profileName(); + q->imgInfo.profileName = cmSettings.profileName(); inputProfisEmbedded = true; - profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName].toLocal8Bit(); + profilePath = ScCore->InputProfilesCMYK[q->imgInfo.profileName].toLocal8Bit(); inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageCMYKProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; inputProfisEmbedded = false; } } @@ -2070,15 +2257,15 @@ { if (ScCore->InputProfiles.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageRGBProfile)) { - imgInfo.profileName = cmSettings.profileName(); - profilePath = ScCore->InputProfiles[imgInfo.profileName].toLocal8Bit(); + q->imgInfo.profileName = cmSettings.profileName(); + profilePath = ScCore->InputProfiles[q->imgInfo.profileName].toLocal8Bit(); inputProfisEmbedded = true; inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageRGBProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; inputProfisEmbedded = false; } } @@ -2099,6 +2286,7 @@ cmsHPROFILE printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile; if (useProf && inputProf && screenProf && printerProf) { + qDebug()<<"doLoadPicture 33"; bool isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)); DWORD SC_TYPE_YMCK_8 = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)); DWORD inputProfFormat = TYPE_BGRA_8; @@ -2132,6 +2320,7 @@ } if (!cmSettings.useColorManagement() || cmSettings.useBlackPoint()) cmsFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + qDebug()<<"doLoadPicture 334"; switch (reqType) { case CMYKData: // CMYK @@ -2149,11 +2338,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2163,7 +2352,7 @@ { if (cmSettings.useColorManagement() && cmSettings.doSoftProofing()) { - if ((imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) + if ((q->imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (q->imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) { if (isCMYK) xform = cmSettings.cmykImageProofingTransform(); @@ -2187,29 +2376,32 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } + qDebug()<<"doLoadPicture 335"; if (xform) { + qDebug()<<"doLoadPicture 335 xform"; if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(QImage(pDataLoader->r_image.width(), pDataLoader->r_image.height(), QImage::Format_ARGB32)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } + qDebug()<<"doLoadPicture 335 xf1"; LPBYTE ptr2 = NULL; for (int i = 0; i < height(); i++) { @@ -2304,18 +2496,22 @@ } } } + qDebug()<<"doLoadPicture 335 xf 2"; if (!stdProof && !ScCore->IsDefaultTransform(xform)) cmsDeleteTransform (xform); } + qDebug()<<"doLoadPicture 336"; if ((inputProf) && (inputProfisEmbedded) && !ScCore->IsDefaultProfile(inputProf)) cmsCloseProfile(inputProf); if (isCMYK) cmsChangeBuffersFormat(cmSettings.cmykImageProofingTransform(), TYPE_CMYK_8, TYPE_RGBA_8); else cmsChangeBuffersFormat(cmSettings.rgbImageProofingTransform(), TYPE_RGBA_8, TYPE_RGBA_8); + qDebug()<<"doLoadPicture 339"; } else { + qDebug()<<"doLoadPicture 4"; switch (reqType) { case CMYKData: @@ -2324,11 +2520,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2352,11 +2548,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2370,11 +2566,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2401,11 +2597,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2415,26 +2611,24 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } } + qDebug()<<"doLoadPicture 8"; // if (((reqType == CMYKData) || ((reqType == RawData) && isCMYK)) && !bilevel) // setAlphaBuffer(false); - setDotsPerMeterX (qMax(2834, (int) (imgInfo.xres / 0.0254))); - setDotsPerMeterY (qMax(2834, (int) (imgInfo.yres / 0.0254))); - if (imgInfo.isEmbedded && useEmbedded) - imgInfo.isEmbedded = true; - else - imgInfo.isEmbedded = false; - if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) + setDotsPerMeterX (qMax(2834, (int) (q->imgInfo.xres / 0.0254))); + setDotsPerMeterY (qMax(2834, (int) (q->imgInfo.yres / 0.0254))); + q->imgInfo.isEmbedded=q->imgInfo.isEmbedded && useEmbedded; + if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) { QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage(), 1, 0, 0); } @@ -2443,5 +2637,8 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + grossNumKBytes+=(numBytes()/1000); return true; } + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: ui/pdfopts.cpp =================================================================== --- ui/pdfopts.cpp (revision 13796) +++ ui/pdfopts.cpp (working copy) @@ -13,6 +13,18 @@ * * ***************************************************************************/ #include "pdfopts.h" +#include "commonstrings.h" +#include "ui/customfdialog.h" +#include "ui/scrspinbox.h" +#include "pdfoptions.h" +#include "prefsfile.h" +#include "prefsmanager.h" +#include "scconfig.h" +#include "scpaths.h" +#include "scribusview.h" +#include "units.h" +#include "util.h" +#include "util_icon.h" #include <QByteArray> #include <QCheckBox> @@ -28,18 +40,6 @@ #include <QToolTip> #include <QVBoxLayout> -#include "commonstrings.h" -#include "ui/customfdialog.h" -#include "pdfoptions.h" -#include "prefsfile.h" -#include "prefsmanager.h" -#include "scconfig.h" -#include "scpaths.h" -#include "scribusview.h" -#include "units.h" -#include "util.h" -#include "util_icon.h" - PDFExportDialog::PDFExportDialog( QWidget* parent, const QString & docFileName, const QMap<QString, int > & DocFonts, ScribusView *currView, PDFOptions & pdfOptions, @@ -173,11 +173,7 @@ } } - bool doIt = false; - if (multiFile->isChecked()) - doIt = true; - else - doIt = overwrite(this, fn); + bool doIt = multiFile->isChecked() || overwrite(this, fn); if (doIt) { EffVal = Options->EffVal; Index: ui/mergedoc.cpp =================================================================== --- ui/mergedoc.cpp (revision 13796) +++ ui/mergedoc.cpp (working copy) @@ -5,6 +5,17 @@ for which a new license (GPL+exception) is in place. */ +#include "mergedoc.h" +#include "scconfig.h" +#include "commonstrings.h" +#include "ui/customfdialog.h" +#include "fileloader.h" +#include "prefsfile.h" +#include "prefsmanager.h" +#include "sccombobox.h" +#include "scpaths.h" +#include "util_icon.h" + #include <QHBoxLayout> #include <QGridLayout> #include <QPixmap> @@ -18,17 +29,8 @@ #include <QApplication> #include <QCursor> #include <QToolTip> +#include <QDir> -#include "scconfig.h" -#include "mergedoc.h" -#include "commonstrings.h" -#include "ui/customfdialog.h" -#include "fileloader.h" -#include "prefsfile.h" -#include "prefsmanager.h" -#include "sccombobox.h" -#include "scpaths.h" -#include "util_icon.h" MergeDoc::MergeDoc(QWidget* parent, bool importMasterPages, int targetDocPageCount, int currentPage) : QDialog(parent) { Index: ui/effectsdialog.cpp =================================================================== --- ui/effectsdialog.cpp (revision 13796) +++ ui/effectsdialog.cpp (working copy) @@ -58,10 +58,7 @@ { double sx = ix / 220.0; double sy = iy / 220.0; - if (sy < sx) - image.createLowRes(sx); - else - image.createLowRes(sy); + image.lowerResolution(qMax(sx, sy)); imageScale = qMin(sx, sy); } EffectsDialogLayout = new QHBoxLayout( this ); @@ -726,7 +723,7 @@ return; ScImage im(image); saveValues(false); - im.applyEffect(effectsList, doc->PageColors, false); + im.applyEffects(effectsList, doc->PageColors, false); QPixmap Bild = QPixmap(pixmapLabel1->width(), pixmapLabel1->height()); int x = (pixmapLabel1->width() - im.qImage().width()) / 2; int y = (pixmapLabel1->height() - im.qImage().height()) / 2; Index: ui/masterpagepalette.cpp =================================================================== --- ui/masterpagepalette.cpp (revision 13796) +++ ui/masterpagepalette.cpp (working copy) @@ -24,6 +24,7 @@ #include "newtemp.h" #include "page.h" #include "pagestructs.h" +#include "selection.h" #include "prefsmanager.h" #include "scribus.h" #include "scribusXml.h" Index: canvasmode_rotate.cpp =================================================================== --- canvasmode_rotate.cpp (revision 13796) +++ canvasmode_rotate.cpp (working copy) @@ -21,10 +21,12 @@ #include "canvas.h" #include "ui/contextmenu.h" +#include "ui/scrspinbox.h" #include "fpoint.h" #include "pageitem.h" #include "ui/pageselector.h" #include "prefsmanager.h" +#include "scribusdoc.h" #include "scribusview.h" #include "selection.h" #include "undomanager.h" Index: text/storytext.cpp =================================================================== --- text/storytext.cpp (revision 13796) +++ text/storytext.cpp (working copy) @@ -336,7 +336,7 @@ for (int i = 0; i < txt.length(); ++i) { ScText * item = new ScText(clone); - item->ch= txt.at(i); + item->ch=txt.at(i); item->setContext(cStyleContext); d->insert(pos + i, item); d->len++; Index: style.h =================================================================== --- style.h (revision 13796) +++ style.h (working copy) @@ -21,7 +21,6 @@ #include <QString> #include "scfonts.h" #include "scribusapi.h" -#include "sccolor.h" #include "styles/stylecontext.h" #include "desaxe/saxio.h" @@ -46,9 +45,9 @@ public: // static const short NOVALUE = -16000; - Style(): m_isDefaultStyle(false), m_name(""), m_context(NULL), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(): m_isDefaultStyle(false), m_context(NULL), m_contextversion(-1), m_shortcut() {} - Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_shortcut() {} Style& operator=(const Style& o) { //assert(typeinfo() == o.typeinfo()); @@ -80,7 +79,7 @@ bool isDefaultStyle() const { return m_isDefaultStyle; } QString name() const { return m_name; } - void setName(const QString& n) { m_name = n.isEmpty() ? "" : n; } + void setName(const QString& n) { m_name = n; } bool hasName() const { return ! m_name.isEmpty(); } virtual QString displayName() const = 0;/*{ @@ -140,7 +139,7 @@ */ void applyStyle(const Style& other) { if (other.hasParent()) - setParent( other.parent() == INHERIT_PARENT? "" :other.parent()); + setParent( other.parent() == INHERIT_PARENT? QString() :other.parent()); m_contextversion = -1; } /** @@ -148,7 +147,7 @@ */ void eraseStyle(const Style& other) { if (other.parent() == parent()) - setParent(""); + setParent(QString()); m_contextversion = -1; } }; Index: scribus.cpp =================================================================== --- scribus.cpp (revision 13796) +++ scribus.cpp (working copy) @@ -179,9 +179,11 @@ #include "scraction.h" #include "ui/scrapbookpalette.h" #include "scribus.h" +#include "scribusdoc.h" #include "scribusXml.h" #include "scribusapp.h" #include "scribuscore.h" +#include "scribusview.h" #include "scribuswin.h" #include "ui/search.h" #include "selection.h" Index: plugins/scriptplugin/cmdobj.cpp =================================================================== --- plugins/scriptplugin/cmdobj.cpp (revision 13796) +++ plugins/scriptplugin/cmdobj.cpp (working copy) @@ -10,8 +10,8 @@ #include "util_math.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" - PyObject *scribus_newrect(PyObject* /* self */, PyObject* args) { double x, y, w, h; Index: plugins/scriptplugin/cmdpage.cpp =================================================================== --- plugins/scriptplugin/cmdpage.cpp (revision 13796) +++ plugins/scriptplugin/cmdpage.cpp (working copy) @@ -9,8 +9,8 @@ #include "page.h" #include "scribuscore.h" #include "commonstrings.h" +#include "scribusdoc.h" - PyObject *scribus_actualpage(PyObject* /* self */) { if(!checkHaveDocument()) Index: plugins/scriptplugin/cmdutil.cpp =================================================================== --- plugins/scriptplugin/cmdutil.cpp (revision 13796) +++ plugins/scriptplugin/cmdutil.cpp (working copy) @@ -8,6 +8,7 @@ #include "units.h" #include "page.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "selection.h" ScribusMainWindow* Carrier; Index: plugins/scriptplugin/cmdgetprop.cpp =================================================================== --- plugins/scriptplugin/cmdgetprop.cpp (revision 13796) +++ plugins/scriptplugin/cmdgetprop.cpp (working copy) @@ -7,6 +7,7 @@ #include "cmdgetprop.h" #include "cmdutil.h" #include "scribuscore.h" +#include "scribusdoc.h" PyObject *scribus_getfillcolor(PyObject* /* self */, PyObject* args) { Index: plugins/scriptplugin/cmdtext.cpp =================================================================== --- plugins/scriptplugin/cmdtext.cpp (revision 13796) +++ plugins/scriptplugin/cmdtext.cpp (working copy) @@ -11,6 +11,7 @@ #include "selection.h" #include "util.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "hyphenator.h" PyObject *scribus_getfontsize(PyObject* /* self */, PyObject* args) Index: plugins/scriptplugin/cmdmani.cpp =================================================================== --- plugins/scriptplugin/cmdmani.cpp (revision 13796) +++ plugins/scriptplugin/cmdmani.cpp (working copy) @@ -9,6 +9,7 @@ #include "ui/propertiespalette.h" //CB argh.. noooooooooooooooooooooooooooooooooooo FIXME see other FIXME #include "selection.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "undomanager.h" PyObject *scribus_loadimage(PyObject* /* self */, PyObject* args) Index: plugins/scriptplugin/objimageexport.cpp =================================================================== --- plugins/scriptplugin/objimageexport.cpp (revision 13796) +++ plugins/scriptplugin/objimageexport.cpp (working copy) @@ -13,6 +13,7 @@ #include <QFileInfo> #include <vector> #include "scribuscore.h" +#include "scribusdoc.h" typedef struct { Index: plugins/scriptplugin/cmdsetprop.cpp =================================================================== --- plugins/scriptplugin/cmdsetprop.cpp (revision 13796) +++ plugins/scriptplugin/cmdsetprop.cpp (working copy) @@ -7,6 +7,7 @@ #include "cmdsetprop.h" #include "cmdutil.h" #include "scribuscore.h" +#include "scribusdoc.h" PyObject *scribus_setgradfill(PyObject* /* self */, PyObject* args) { Index: plugins/scriptplugin/cmddoc.cpp =================================================================== --- plugins/scriptplugin/cmddoc.cpp (revision 13796) +++ plugins/scriptplugin/cmddoc.cpp (working copy) @@ -9,6 +9,7 @@ #include "units.h" #include "documentinformation.h" #include "scribuscore.h" +#include "scribusdoc.h" /* newDocument(size, margins, orientation, firstPageNumber, Index: plugins/scriptplugin/cmdcolor.cpp =================================================================== --- plugins/scriptplugin/cmdcolor.cpp (revision 13796) +++ plugins/scriptplugin/cmdcolor.cpp (working copy) @@ -9,6 +9,7 @@ #include "prefsmanager.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "sccolorengine.h" PyObject *scribus_colornames(PyObject* /* self */) Index: plugins/scriptplugin/scriptercore.cpp =================================================================== --- plugins/scriptplugin/scriptercore.cpp (revision 13796) +++ plugins/scriptplugin/scriptercore.cpp (working copy) @@ -26,6 +26,7 @@ #include "pconsole.h" #include "scraction.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scpaths.h" #include "selection.h" #include "prefsfile.h" Index: plugins/scriptplugin/objprinter.cpp =================================================================== --- plugins/scriptplugin/objprinter.cpp (revision 13796) +++ plugins/scriptplugin/objprinter.cpp (working copy) @@ -17,6 +17,7 @@ #include "pslib.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "util_file.h" #include "util_ghostscript.h" #include "util_printer.h" Index: plugins/scriptplugin/cmdmisc.cpp =================================================================== --- plugins/scriptplugin/cmdmisc.cpp (revision 13796) +++ plugins/scriptplugin/cmdmisc.cpp (working copy) @@ -13,6 +13,7 @@ #include <QList> #include "scribuscore.h" +#include "scribusdoc.h" #include "fonts/scfontmetrics.h" #include "prefsmanager.h" Index: plugins/gettext/csvim/csvim.cpp =================================================================== --- plugins/gettext/csvim/csvim.cpp (revision 13796) +++ plugins/gettext/csvim/csvim.cpp (working copy) @@ -5,6 +5,9 @@ for which a new license (GPL+exception) is in place. */ #include "csvim.h" +#include "gtwriter.h" +#include "gtparagraphstyle.h" +#include "gtframestyle.h" #include "scribusstructs.h" QString FileFormatName() Index: plugins/gettext/csvim/csvim.h =================================================================== --- plugins/gettext/csvim/csvim.h (revision 13796) +++ plugins/gettext/csvim/csvim.h (working copy) @@ -9,8 +9,6 @@ #include "pluginapi.h" #include "csvdia.h" -#include <gtwriter.h> -#include <gtparagraphstyle.h> #include <QByteArray> #include <QFile> #include <QFileInfo> @@ -18,6 +16,9 @@ #include <QStringList> #include <QTextCodec> +class gtParagraphStyle; +class gtWriter; + extern "C" PLUGIN_API void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer); extern "C" PLUGIN_API QString FileFormatName(); Index: plugins/gettext/sxwim/contentreader.cpp =================================================================== --- plugins/gettext/sxwim/contentreader.cpp (revision 13796) +++ plugins/gettext/sxwim/contentreader.cpp (working copy) @@ -25,10 +25,11 @@ ***************************************************************************/ #include "contentreader.h" +#include "gtparagraphstyle.h" #ifdef HAVE_XML -#include <scribusstructs.h> +#include "scribusstructs.h" #include <QByteArray> ContentReader* ContentReader::creader = NULL; Index: plugins/gettext/textfilter/tffilter.cpp =================================================================== --- plugins/gettext/textfilter/tffilter.cpp (revision 13796) +++ plugins/gettext/textfilter/tffilter.cpp (working copy) @@ -18,6 +18,7 @@ #include <QCheckBox> #include "scribusapi.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "prefsmanager.h" #include "prefsfile.h" #include "util_icon.h" Index: plugins/gettext/odtim/contentreader.h =================================================================== --- plugins/gettext/odtim/contentreader.h (revision 13796) +++ plugins/gettext/odtim/contentreader.h (working copy) @@ -38,10 +38,11 @@ #endif #include <QXmlAttributes> #include <QMap> -#include <gtstyle.h> -#include <gtwriter.h> -#include "stylereader.h" +class ListStyle; +class gtStyle; +class gtWriter; +class StyleReader; typedef std::vector<std::pair<QString, QString> > Properties; typedef QMap<QString, Properties > TMap; Index: plugins/gettext/odtim/contentreader.cpp =================================================================== --- plugins/gettext/odtim/contentreader.cpp (revision 13796) +++ plugins/gettext/odtim/contentreader.cpp (working copy) @@ -28,7 +28,13 @@ #include <QByteArray> #include "contentreader.h" #include "scribusstructs.h" +#include "gtwriter.h" +#include "gtstyle.h" +#include "gtparagraphstyle.h" +#include "stylereader.h" + + ContentReader* ContentReader::creader = NULL; extern xmlSAXHandlerPtr cSAXHandler; Index: plugins/short-words/shortwords.cpp =================================================================== --- plugins/short-words/shortwords.cpp (revision 13796) +++ plugins/short-words/shortwords.cpp (working copy) @@ -35,6 +35,7 @@ #include "swprefsgui.h" #include "scpaths.h" #include "scribus.h" +#include "scribusdoc.h" #include "util_icon.h" int scribusshortwords_getPluginAPIVersion() Index: plugins/short-words/parse.cpp =================================================================== --- plugins/short-words/parse.cpp (revision 13796) +++ plugins/short-words/parse.cpp (working copy) @@ -24,6 +24,7 @@ #include "configuration.h" #include "scribus.h" +#include "scribusdoc.h" #include "page.h" #include "pageitem.h" #include "selection.h" Index: plugins/saveastemplateplugin/satdialog.cpp =================================================================== --- plugins/saveastemplateplugin/satdialog.cpp (revision 13796) +++ plugins/saveastemplateplugin/satdialog.cpp (working copy) @@ -12,6 +12,7 @@ #include <QXmlDefaultHandler> #include <QXmlSimpleReader> +#include <QDir> #include "prefsmanager.h" #include "prefsfile.h" Index: plugins/aiimplugin/importai.h =================================================================== --- plugins/aiimplugin/importai.h (revision 13796) +++ plugins/aiimplugin/importai.h (working copy) @@ -12,16 +12,17 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include "vgradient.h" +#include "text/storytext.h" #include <QList> #include <QMatrix> // #include <QPainterPath> class MultiProgressDialog; class ScribusDoc; +class PageItem; class Selection; class TransactionSettings; Index: plugins/tools/lenseffects/lenseffects.cpp =================================================================== --- plugins/tools/lenseffects/lenseffects.cpp (revision 13796) +++ plugins/tools/lenseffects/lenseffects.cpp (working copy) @@ -27,6 +27,7 @@ #include "lenseffects.h" #include "lensdialog.h" #include "scribuscore.h" +#include "selection.h" int lenseffects_getPluginAPIVersion() { Index: plugins/tools/lenseffects/lenseffects.h =================================================================== --- plugins/tools/lenseffects/lenseffects.h (revision 13796) +++ plugins/tools/lenseffects/lenseffects.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Lens Effects" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathfinder/pathfinder.cpp =================================================================== --- plugins/tools/pathfinder/pathfinder.cpp (revision 13796) +++ plugins/tools/pathfinder/pathfinder.cpp (working copy) @@ -24,18 +24,20 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ****************************************************************************/ -#include <QMessageBox> -#include <QPixmap> -#include "pageitem_polygon.h" #include "pathfinder.h" #include "pathfinderdialog.h" #include "ui/propertiespalette.h" +#include "pageitem_polygon.h" +#include "selection.h" #include "scribuscore.h" #include "sccolorengine.h" #include "util_color.h" #include "util_math.h" #include "util_icon.h" +#include <QMessageBox> +#include <QPixmap> + int pathfinder_getPluginAPIVersion() { return PLUGIN_API_VERSION; Index: plugins/tools/pathfinder/pathfinderdialog.cpp =================================================================== --- plugins/tools/pathfinder/pathfinderdialog.cpp (revision 13796) +++ plugins/tools/pathfinder/pathfinderdialog.cpp (working copy) @@ -25,7 +25,10 @@ #include "util_icon.h" #include "fpointarray.h" #include "sccolorengine.h" +#include "pageitem.h" +#include "scribusdoc.h" + #include <QPixmap> #include <QPainter> #include <QMatrix> Index: plugins/tools/pathfinder/pathfinder.h =================================================================== --- plugins/tools/pathfinder/pathfinder.h (revision 13796) +++ plugins/tools/pathfinder/pathfinder.h (working copy) @@ -30,7 +30,6 @@ #include <QColor> #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Finder" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathfinder/pathfinderdialog.h =================================================================== --- plugins/tools/pathfinder/pathfinderdialog.h (revision 13796) +++ plugins/tools/pathfinder/pathfinderdialog.h (working copy) @@ -12,9 +12,10 @@ #include <QPainterPath> #include <QColor> #include <QList> -#include "pageitem.h" -#include "scribusdoc.h" +class PageItem; +class ScribusDoc; + class PLUGIN_API PathFinderDialog : public QDialog, Ui::PathFinderBase { Q_OBJECT Index: plugins/tools/pathconnect/pathconnect.cpp =================================================================== --- plugins/tools/pathconnect/pathconnect.cpp (revision 13796) +++ plugins/tools/pathconnect/pathconnect.cpp (working copy) @@ -26,6 +26,8 @@ #include "pathconnect.h" #include "pathconnectdialog.h" +#include "selection.h" +#include "scribusdoc.h" int pathconnect_getPluginAPIVersion() { Index: plugins/tools/pathconnect/pathconnect.h =================================================================== --- plugins/tools/pathconnect/pathconnect.h (revision 13796) +++ plugins/tools/pathconnect/pathconnect.h (working copy) @@ -30,10 +30,10 @@ #include "fpointarray.h" #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" #include "scribuscore.h" -#include "scribusdoc.h" +class ScribusDoc; + /** \brief This is a simple "Path Connect" plugin for Scribus 1.3 and later. \author Franz Schmid \date November 2008 Index: plugins/tools/pathstroker/pathstroker.cpp =================================================================== --- plugins/tools/pathstroker/pathstroker.cpp (revision 13796) +++ plugins/tools/pathstroker/pathstroker.cpp (working copy) @@ -28,7 +28,9 @@ #include "pageitem_polygon.h" #include "commonstrings.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" #include "util.h" #include <QPainterPathStroker> @@ -117,11 +119,7 @@ QVector<double> m_array; PageItem *currItem = currDoc->m_Selection->itemAt(0); FPointArray path = currItem->PoLine; - QPainterPath pp; - if (currItem->itemType() == PageItem::PolyLine) - pp = path.toQPainterPath(false); - else - pp = path.toQPainterPath(true); + QPainterPath pp = path.toQPainterPath(currItem->itemType() != PageItem::PolyLine); if (currItem->NamedLStyle.isEmpty()) { QPainterPathStroker stroke; Index: plugins/tools/pathstroker/pathstroker.h =================================================================== --- plugins/tools/pathstroker/pathstroker.h (revision 13796) +++ plugins/tools/pathstroker/pathstroker.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Stroker" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/pathcut/pathcut.cpp =================================================================== --- plugins/tools/pathcut/pathcut.cpp (revision 13796) +++ plugins/tools/pathcut/pathcut.cpp (working copy) @@ -26,7 +26,9 @@ #include "pathcut.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" #include "util.h" #include "util_icon.h" #include <QPainterPathStroker> Index: plugins/tools/pathcut/pathcut.h =================================================================== --- plugins/tools/pathcut/pathcut.h (revision 13796) +++ plugins/tools/pathcut/pathcut.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Path Cutter" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/transform/transformeffect.cpp =================================================================== --- plugins/tools/transform/transformeffect.cpp (revision 13796) +++ plugins/tools/transform/transformeffect.cpp (working copy) @@ -27,6 +27,7 @@ #include "transformeffect.h" #include "transformdialog.h" #include "scribuscore.h" +#include "selection.h" int transformeffect_getPluginAPIVersion() { Index: plugins/tools/transform/transformeffect.h =================================================================== --- plugins/tools/transform/transformeffect.h (revision 13796) +++ plugins/tools/transform/transformeffect.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple "Transform Effect" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/tools/spellcheck/aspellplugin.cpp =================================================================== --- plugins/tools/spellcheck/aspellplugin.cpp (revision 13796) +++ plugins/tools/spellcheck/aspellplugin.cpp (working copy) @@ -4,9 +4,13 @@ a copyright and/or license notice that predates the release of Scribus 1.3.2 for which a new license (GPL+exception) is in place. */ -#include "scraction.h" + #include "aspellplugin.h" #include "aspellpluginimpl.h" +#include "scraction.h" +#include "scribus.h" +#include "scribusdoc.h" +#include "pageitem.h" // See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods // do. That documentatation is not duplicated here. Index: plugins/tools/spellcheck/aspellpluginimpl.cpp =================================================================== --- plugins/tools/spellcheck/aspellpluginimpl.cpp (revision 13796) +++ plugins/tools/spellcheck/aspellpluginimpl.cpp (working copy) @@ -5,6 +5,13 @@ for which a new license (GPL+exception) is in place. */ #include "aspellpluginimpl.h" +// Scribus include files +#include "scribusdoc.h" // For ScribusDoc +#include "scribus.h" // For ScribusMainWindow +#include "selection.h" // Item selected +#include "prefsfile.h" // Stored plugin preferences +#include "prefsmanager.h" // Preferences manager +#include "pageitem.h" #include "pageitem_textframe.h" #include "text/specialchars.h" #include "util.h" Index: plugins/tools/spellcheck/aspellpluginimpl.h =================================================================== --- plugins/tools/spellcheck/aspellpluginimpl.h (revision 13796) +++ plugins/tools/spellcheck/aspellpluginimpl.h (working copy) @@ -15,17 +15,15 @@ #include <QString> #include <QStringList> #include <QHash> -// Scribus include files -#include "scribusdoc.h" // For ScribusDoc -#include "scribus.h" // For ScribusMainWindow -#include "selection.h" // Item selected -#include "prefsfile.h" // Stored plugin preferences -#include "prefsmanager.h" // Preferences manager // Local include files #include "ui_aspellpluginbase.h" // For GUI from QT4 designer // #include "donedlgimpl.h" // For spell-checking done dialog #include "suggest.h" // For aspell interface class +class ScribusDoc; +class PrefsContext; +class PageItem; + /*! \class AspellPluginImpl \author Gora Mohanty <gora@srijan.in> Index: plugins/tools/subdivide/subdivide.cpp =================================================================== --- plugins/tools/subdivide/subdivide.cpp (revision 13796) +++ plugins/tools/subdivide/subdivide.cpp (working copy) @@ -26,7 +26,9 @@ #include "subdivide.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scribusstructs.h" +#include "selection.h" int subdivide_getPluginAPIVersion() { Index: plugins/tools/subdivide/subdivide.h =================================================================== --- plugins/tools/subdivide/subdivide.h (revision 13796) +++ plugins/tools/subdivide/subdivide.h (working copy) @@ -29,7 +29,6 @@ #include "pluginapi.h" #include "scplugin.h" -#include "selection.h" /** \brief This is a simple Subdivide" plugin for Scribus 1.3 and later. \author Franz Schmid Index: plugins/xfigimplugin/importxfig.cpp =================================================================== --- plugins/xfigimplugin/importxfig.cpp (revision 13796) +++ plugins/xfigimplugin/importxfig.cpp (working copy) @@ -25,6 +25,7 @@ #include "ui/missing.h" #include "ui/multiprogressdialog.h" #include "pagesize.h" +#include "pageitem.h" #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" Index: plugins/xfigimplugin/importxfig.h =================================================================== --- plugins/xfigimplugin/importxfig.h (revision 13796) +++ plugins/xfigimplugin/importxfig.h (working copy) @@ -12,14 +12,15 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include <QList> +#include <QStack> #include <QMatrix> #include <QMultiMap> class MultiProgressDialog; +class PageItem; class ScribusDoc; class Selection; class TransactionSettings; Index: plugins/colorwheel/colorwheel.cpp =================================================================== --- plugins/colorwheel/colorwheel.cpp (revision 13796) +++ plugins/colorwheel/colorwheel.cpp (working copy) @@ -8,6 +8,7 @@ #include "colorwheel.h" #include "cwdialog.h" #include "scribuscore.h" +#include "scribusdoc.h" int colorwheel_getPluginAPIVersion() { Index: plugins/fileloader/oodraw/oodrawimp.h =================================================================== --- plugins/fileloader/oodraw/oodrawimp.h (revision 13796) +++ plugins/fileloader/oodraw/oodrawimp.h (working copy) @@ -11,9 +11,9 @@ #include "loadsaveplugin.h" #include "../../formatidlist.h" #include "stylestack.h" -#include "pageitem.h" #include "scribusstructs.h" +class PageItem; class ScrAction; class ScribusDoc; class Selection; Index: plugins/svgexplugin/svgexplugin.cpp =================================================================== --- plugins/svgexplugin/svgexplugin.cpp (revision 13796) +++ plugins/svgexplugin/svgexplugin.cpp (working copy) @@ -534,7 +534,7 @@ ScImage img; CMSettings cms(m_Doc, Item->IProfile, Item->IRender); img.LoadPicture(Item->Pfile, Item->pixm.imgInfo.actualPageNumber, cms, Item->UseEmbedded, true, ScImage::RGBProof, 72); - img.applyEffect(Item->effectsInUse, m_Doc->PageColors, true); + img.applyEffects(Item->effectsInUse, m_Doc->PageColors, true); if (Options.inlineImages) { QBuffer buffer; Index: plugins/psimport/importps.h =================================================================== --- plugins/psimport/importps.h (revision 13796) +++ plugins/psimport/importps.h (working copy) @@ -12,13 +12,13 @@ #include "qstring.h" #include "pluginapi.h" -#include "pageitem.h" #include "sccolor.h" #include "fpointarray.h" #include <QList> #include <QPainterPath> class MultiProgressDialog; +class PageItem; class ScribusDoc; class Selection; class TransactionSettings; Index: canvasmode_objimport.cpp =================================================================== --- canvasmode_objimport.cpp (revision 13796) +++ canvasmode_objimport.cpp (working copy) @@ -29,6 +29,7 @@ #include "fpoint.h" #include "fpointarray.h" #include "ui/pageselector.h" +#include "ui/scrspinbox.h" #include "prefscontext.h" #include "prefsfile.h" #include "prefsmanager.h" Index: scribus.h =================================================================== --- scribus.h (revision 13796) +++ scribus.h (working copy) @@ -100,6 +100,7 @@ class ReformDoc; class ScToolBar; class ScrAction; +class ScribusDoc; class ScribusCore; class ScribusMainWindow; class ScribusQApp; Index: scpainterexbase.h =================================================================== --- scpainterexbase.h (revision 13796) +++ scpainterexbase.h (working copy) @@ -42,8 +42,8 @@ #include "fpointarray.h" #include "vgradientex.h" #include "sccolorshade.h" -#include "scimage.h" +class ScImage; class ScPattern; class SCRIBUS_API ScPainterExBase Index: canvasmode_panning.cpp =================================================================== --- canvasmode_panning.cpp (revision 13796) +++ canvasmode_panning.cpp (working copy) @@ -28,6 +28,7 @@ #include "fpoint.h" #include "fpointarray.h" #include "scribusview.h" +#include "scribusdoc.h" #include "util.h" #include "util_icon.h" Index: pslib.cpp =================================================================== --- pslib.cpp (revision 13796) +++ pslib.cpp (working copy) @@ -1463,7 +1463,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); QByteArray maskArray; bool alphaLoaded = image.getAlpha(fn, c->pixm.imgInfo.actualPageNumber, maskArray, false, true, 300); if (!alphaLoaded) @@ -1556,7 +1556,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); int w = image.width(); int h = image.height(); PutStream(ToStr(x*scalex) + " " + ToStr(y*scaley) + " tr\n"); Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 13796) +++ CMakeLists.txt (working copy) @@ -265,6 +265,7 @@ ui/scinputdialog.h ui/scmenu.h ui/scmessagebox.h + scimage_p.h scplugin.h scprintengine.h scraction.h Index: latexhelpers.cpp =================================================================== --- latexhelpers.cpp (revision 13796) +++ latexhelpers.cpp (working copy) @@ -24,6 +24,8 @@ #include <QDebug> #include <QFile> +#include <QFileInfo> +#include <QDir> #include <QMessageBox> #include "prefsmanager.h" |
|
i uploaded 150 patch. |
2009-08-02 22:03
|
8308-r13805-update.patch (71,600 bytes)
Index: scribus/CMakeLists.txt =================================================================== --- scribus/CMakeLists.txt (revision 13805) +++ scribus/CMakeLists.txt (working copy) @@ -265,6 +265,7 @@ ui/scinputdialog.h ui/scmenu.h ui/scmessagebox.h + scimage_p.h scplugin.h scprintengine.h scraction.h Index: scribus/fonts/scface.cpp =================================================================== --- scribus/fonts/scface.cpp (revision 13805) +++ scribus/fonts/scface.cpp (working copy) @@ -152,7 +152,6 @@ if ( m && --(m->refs) == 0 ) { m->unload(); delete m; - m = 0; } } Index: scribus/pageitem.cpp =================================================================== --- scribus/pageitem.cpp (revision 13805) +++ scribus/pageitem.cpp (working copy) @@ -4853,7 +4853,7 @@ } effectsInUse.append(ef); } - pixm.applyEffect(effectsInUse, m_Doc->PageColors, false); + pixm.applyEffects(effectsInUse, m_Doc->PageColors, false); // if (reload) pixm.imgInfo.lowResType = lowResTypeBack; if (pixm.imgInfo.lowResType != 0) @@ -4868,7 +4868,7 @@ double ratio = pixels / 3000000.0; scaling *= sqrt(ratio); } - pixm.createLowRes(scaling); + pixm.lowerResolution(scaling); pixm.imgInfo.lowResScale = scaling; } if ((m_Doc->view()->m_canvas->usePreviewVisual())) Index: scribus/pdflib_core.cpp =================================================================== --- scribus/pdflib_core.cpp (revision 13805) +++ scribus/pdflib_core.cpp (working copy) @@ -507,7 +507,7 @@ tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg"); if ((gray) && (!precal)) image.convertToGray(); - if (image.Convert2JPG(tmpFile, Options.Quality, cmyk, gray)) + if (image.saveToJpg(tmpFile, Options.Quality, cmyk, gray)) jpgFileName = tmpFile; } if (jpgFileName.isEmpty()) @@ -2261,7 +2261,7 @@ { ScImage img(pm.toImage()); bool compDataAvail = false; - QByteArray array = img.ImageToArray(); + QByteArray array = img.toArray(); if (Options.Compress) { QByteArray compArray = CompressArray(array); @@ -6920,7 +6920,7 @@ img.imgInfo.progressive = prog; } else - img.scaleImage(qRound(ax), qRound(ay)); + img.scale(qRound(ax), qRound(ay)); ImInfo.sxa = sx * a2; ImInfo.sya = sy * a1; } @@ -6945,14 +6945,13 @@ { if (!ICCProfiles.contains(Profil)) { - ScImage img3; int components = 0; uint embeddedProfile = newObject(); StartObj(embeddedProfile); QByteArray dataP; struct ICCD dataD; if ((Embedded) && (!Options.EmbeddedI)) - img3.getEmbeddedProfile(fn, &dataP, &components); + dataP=ScImage::getEmbeddedProfile(fn, &components); if ((dataP.isEmpty()) || ((img.imgInfo.colorspace == ColorSpaceGray) && (hasColorEffect) && (components == 1))) { if (img.imgInfo.colorspace == ColorSpaceCMYK) @@ -7101,7 +7100,7 @@ } origWidth = img.width(); origHeight = img.height(); - img.applyEffect(c->effectsInUse, c->doc()->PageColors, imgE); + img.applyEffects(c->effectsInUse, c->doc()->PageColors, imgE); if (!((Options.RecalcPic) && (Options.PicRes < (qMax(72.0 / c->imageXScale(), 72.0 / c->imageYScale()))))) { ImInfo.sxa = sx * (1.0 / ImInfo.reso); Index: scribus/plugins/gettext/docim/docim.cpp =================================================================== --- scribus/plugins/gettext/docim/docim.cpp (revision 13805) +++ scribus/plugins/gettext/docim/docim.cpp (working copy) @@ -9,6 +9,7 @@ #include "gtwriter.h" #include "scpaths.h" #include "scribusstructs.h" +#include <QDir> #include <QObject> #include <QByteArray> #include <QMessageBox> Index: scribus/plugins/gettext/htmlim/htmlreader.cpp =================================================================== --- scribus/plugins/gettext/htmlim/htmlreader.cpp (revision 13805) +++ scribus/plugins/gettext/htmlim/htmlreader.cpp (working copy) @@ -26,6 +26,7 @@ #include <QObject> #include <QByteArray> +#include <QDir> #include "htmlreader.h" #include "scribusstructs.h" Index: scribus/plugins/gettext/odtim/contentreader.cpp =================================================================== --- scribus/plugins/gettext/odtim/contentreader.cpp (revision 13805) +++ scribus/plugins/gettext/odtim/contentreader.cpp (working copy) @@ -26,6 +26,7 @@ #include <QGlobalStatic> #include <QByteArray> +#include <QDir> #include "contentreader.h" #include "scribusstructs.h" #include "gtwriter.h" Index: scribus/plugins/gettext/odtim/stylereader.cpp =================================================================== --- scribus/plugins/gettext/odtim/stylereader.cpp (revision 13805) +++ scribus/plugins/gettext/odtim/stylereader.cpp (working copy) @@ -32,6 +32,7 @@ #include <gtframestyle.h> #include <gtfont.h> #include <QByteArray> +#include <QDir> StyleReader* StyleReader::sreader = NULL; Index: scribus/plugins/gettext/sxwim/contentreader.cpp =================================================================== --- scribus/plugins/gettext/sxwim/contentreader.cpp (revision 13805) +++ scribus/plugins/gettext/sxwim/contentreader.cpp (working copy) @@ -31,6 +31,7 @@ #include "scribusstructs.h" #include <QByteArray> +#include <QDir> ContentReader* ContentReader::creader = NULL; Index: scribus/plugins/gettext/sxwim/stylereader.cpp =================================================================== --- scribus/plugins/gettext/sxwim/stylereader.cpp (revision 13805) +++ scribus/plugins/gettext/sxwim/stylereader.cpp (working copy) @@ -24,19 +24,20 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - #include "stylereader.h" - - #include <scribusstructs.h> - #include <gtmeasure.h> - #include <gtparagraphstyle.h> - #include <gtframestyle.h> - #include <gtfont.h> +#include "stylereader.h" + +#include <scribusstructs.h> +#include <gtmeasure.h> +#include <gtparagraphstyle.h> +#include <gtframestyle.h> +#include <gtfont.h> +#include <QDir> #include <QByteArray> - StyleReader* StyleReader::sreader = NULL; +StyleReader* StyleReader::sreader = NULL; + +extern xmlSAXHandlerPtr sSAXHandler; - extern xmlSAXHandlerPtr sSAXHandler; - StyleReader::StyleReader(QString documentName, gtWriter *w, bool textOnly, bool prefix, bool combineStyles) { Index: scribus/plugins/saveastemplateplugin/satdialog.cpp =================================================================== --- scribus/plugins/saveastemplateplugin/satdialog.cpp (revision 13805) +++ scribus/plugins/saveastemplateplugin/satdialog.cpp (working copy) @@ -13,6 +13,7 @@ #include <QDir> #include <QXmlDefaultHandler> #include <QXmlSimpleReader> +#include <QDir> #include "prefsmanager.h" #include "prefsfile.h" Index: scribus/plugins/svgexplugin/svgexplugin.cpp =================================================================== --- scribus/plugins/svgexplugin/svgexplugin.cpp (revision 13805) +++ scribus/plugins/svgexplugin/svgexplugin.cpp (working copy) @@ -534,7 +534,7 @@ ScImage img; CMSettings cms(m_Doc, Item->IProfile, Item->IRender); img.LoadPicture(Item->Pfile, Item->pixm.imgInfo.actualPageNumber, cms, Item->UseEmbedded, true, ScImage::RGBProof, 72); - img.applyEffect(Item->effectsInUse, m_Doc->PageColors, true); + img.applyEffects(Item->effectsInUse, m_Doc->PageColors, true); if (Options.inlineImages) { QBuffer buffer; Index: scribus/plugins/tools/pathstroker/pathstroker.cpp =================================================================== --- scribus/plugins/tools/pathstroker/pathstroker.cpp (revision 13805) +++ scribus/plugins/tools/pathstroker/pathstroker.cpp (working copy) @@ -119,11 +119,7 @@ QVector<double> m_array; PageItem *currItem = currDoc->m_Selection->itemAt(0); FPointArray path = currItem->PoLine; - QPainterPath pp; - if (currItem->itemType() == PageItem::PolyLine) - pp = path.toQPainterPath(false); - else - pp = path.toQPainterPath(true); + QPainterPath pp = path.toQPainterPath(currItem->itemType() != PageItem::PolyLine); if (currItem->NamedLStyle.isEmpty()) { QPainterPathStroker stroke; Index: scribus/pslib.cpp =================================================================== --- scribus/pslib.cpp (revision 13805) +++ scribus/pslib.cpp (working copy) @@ -1463,7 +1463,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); QByteArray maskArray; bool alphaLoaded = image.getAlpha(fn, c->pixm.imgInfo.actualPageNumber, maskArray, false, true, 300); if (!alphaLoaded) @@ -1556,7 +1556,7 @@ PS_Error_ImageLoadFailure(fn); return false; } - image.applyEffect(c->effectsInUse, colorsToUse, true); + image.applyEffects(c->effectsInUse, colorsToUse, true); int w = image.width(); int h = image.height(); PutStream(ToStr(x*scalex) + " " + ToStr(y*scaley) + " tr\n"); Index: scribus/sccolor.cpp =================================================================== --- scribus/sccolor.cpp (revision 13805) +++ scribus/sccolor.cpp (working copy) @@ -331,7 +331,7 @@ addColors(colorList, overwrite); } -ScribusDoc* ColorList::document(void) +ScribusDoc* ColorList::document(void) const { return m_doc; } Index: scribus/sccolor.h =================================================================== --- scribus/sccolor.h (revision 13805) +++ scribus/sccolor.h (working copy) @@ -153,7 +153,7 @@ ColorList& operator= (const ColorList& list); /** \brief Get the document the list is related , return in cpp due to scribusdoc class delcaration */ - ScribusDoc* document(void); + ScribusDoc* document(void) const; /** \brief Assign the doc to which the list belong to.*/ void setDocument(ScribusDoc* doc); Index: scribus/scimage.cpp =================================================================== --- scribus/scimage.cpp (revision 13805) +++ scribus/scimage.cpp (working copy) @@ -5,12 +5,14 @@ for which a new license (GPL+exception) is in place. */ +#include "scimage.h" +#include "scimage_p.h" #include "cmsettings.h" #include "scclocale.h" -#include "scimage.h" #include "scribus.h" #include "scpaths.h" #include "scribuscore.h" +#include "scribusdoc.h" #include "scimgdataloader_gimp.h" #include "scimgdataloader_jpeg.h" #include "scimgdataloader_ps.h" @@ -22,6 +24,7 @@ #include <QMessageBox> #include <QList> #include <QByteArray> +#include <QTime> #include <cassert> #include <cmath> #include <cstdlib> @@ -69,42 +72,116 @@ longjmp (myerr->setjmp_buffer, 1); } -ScImage::ScImage(const QImage & image) : QImage(image) +//we start unloading images immediately in ScImage::LoadPicture when grossNumKBytes > 128*1024 +static long grossNumKBytes=0; + + +ScImage::Private& ScImage::Private::operator=(const ScImage::Private& other) { + QImage::operator=(other); + + height_=other.height_; + width_=other.width_; + + delete imLoadSettings; imLoadSettings=0; + if( other.imLoadSettings ) + { + imLoadSettings = new ImageLoadSettings(other.imLoadSettings->cmSettings); + *imLoadSettings = *other.imLoadSettings; + } + + imEffectSettings=other.imEffectSettings; + + if (!isNull()) + clearTimer.start(); + + return *this; +} + +void ScImage::Private::clear() +{ + qDebug()<<"clearImage()"; + if (imLoadSettings) + qDebug()<<imLoadSettings->fileName; + grossNumKBytes-=(numBytes()/1000); + *((QImage*)this)=QImage(); +} + + +ScImage::ScImage(const QImage& image) + : d(new Private(this)) +{ initialize(); + + d->height_=image.height(); + d->width_=image.width(); } - // ScImage will use implicit sharing: -ScImage::ScImage(const ScImage & image) : QImage(image.copy()) +ScImage::ScImage(const ScImage& other) + : d(new Private(this)) { initialize(); + *d=*(other.d); } -ScImage::ScImage() : QImage() +ScImage::ScImage() + : d(new Private(this)) { initialize(); } -ScImage::ScImage( int width, int height ) : QImage( width, height, QImage::Format_ARGB32 ) +ScImage::ScImage(int width, int height) + : d(new Private(this, width, height)) { initialize(); } -const QImage& ScImage::qImage() + +QImage ScImage::qImage() const { - return *this; + d->restore(); + qDebug()<<"we are in const QImage& ScImage::qImage() "<<endl; + return *((QImage*)d); } QImage* ScImage::qImagePtr() { - return this; + d->restore(); + qDebug()<<"we are in const QImagePtr::qImage() "<<endl; + return d; } +int ScImage::height() const +{ + if (d->height_==-1) + d->restore(); + return d->height_; +} + +int ScImage::width() const +{ + if (d->width_==-1) + d->restore(); + return d->width_; +} + +bool ScImage::hasAlpha() const +{ + return d->hasAlphaChannel(); +} + +ScImage& ScImage::operator=(const ScImage& other) +{ + *d=*other.d; + return *this; +} + QImage ScImage::scaled(int h, int w, Qt::AspectRatioMode mode, Qt::TransformationMode transformMode) const { - return QImage::scaled(h, w, mode, transformMode); + d->restore(); + return d->scaled(h, w, mode, transformMode); } @@ -131,254 +208,300 @@ imgInfo.exifInfo.thumbnail = QImage(); imgInfo.BBoxX = 0; imgInfo.BBoxH = 0; + + QObject::connect(&(d->clearTimer), SIGNAL(timeout()), d, SLOT(clear())); + d->clearTimer.setInterval(10000); + d->clearTimer.setSingleShot(false); } ScImage::~ScImage() { + delete d; } -void ScImage::applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk) +void ScImage::Private::restore() { + if (isNull() && imLoadSettings) + { + doLoadPicture(imLoadSettings->fileName, imLoadSettings->page, imLoadSettings->cmSettings, imLoadSettings->useEmbedded, imLoadSettings->useProf, imLoadSettings->requestType, imLoadSettings->gsRes, 0, false); + int oldWidth=width_; + int oldHeight=height_; + + width_=width(); + height_=height(); + foreach(const ImageEffectSettings& imEffectSetting, imEffectSettings) + { + if (imEffectSetting.convertToGray) + q->convertToGray(); + else if (imEffectSetting.scale) + q->scale(oldWidth, oldHeight); + else + doApplyEffect(imEffectSetting.effectsList, imEffectSetting.colors, imEffectSetting.cmyk); + } + qDebug()<<"restoring"<<imLoadSettings->fileName; + } + else + qDebug()<<"not restoring"; + if (imLoadSettings) + clearTimer.start(); +} + +//TODO const ColorList& colors +void ScImage::applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ + qDebug()<<"restoring"; + if (d->imLoadSettings) + qDebug()<<d->imLoadSettings->fileName; + + Private::ImageEffectSettings s; + s.effectsList = effectsList; + s.colors = colors; + s.cmyk = cmyk; + d->imEffectSettings.append(s); + + if (!d->isNull()) + d->doApplyEffect(effectsList, colors, cmyk); +} + +void ScImage::Private::doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk) +{ ScribusDoc* doc = colors.document(); - if (effectsList.count() != 0) + Q_FOREACH(const ImageEffect& effect, effectsList) { - for (int a = 0; a < effectsList.count(); ++a) + if (effect.effectCode == EF_INVERT) + invert(cmyk); + if (effect.effectCode == EF_GRAYSCALE) + toGrayscale(cmyk); + if (effect.effectCode == EF_COLORIZE) { - if (effectsList.at(a).effectCode == EF_INVERT) - invert(cmyk); - if (effectsList.at(a).effectCode == EF_GRAYSCALE) - toGrayscale(cmyk); - if (effectsList.at(a).effectCode == EF_COLORIZE) + QString tmpstr = effect.effectParameters; + QString col = CommonStrings::None; + int shading = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + // fp >> col; + col = fp.readLine(); + fp >> shading; + colorize(doc, colors[col], shading, cmyk); + } + if (effect.effectCode == EF_BRIGHTNESS) + { + QString tmpstr = effect.effectParameters; + int brightnessValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> brightnessValue; + brightness(brightnessValue, cmyk); + } + if (effect.effectCode == EF_CONTRAST) + { + QString tmpstr = effect.effectParameters; + int contrastValue = 0; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> contrastValue; + contrast(contrastValue, cmyk); + } + if (effect.effectCode == EF_SHARPEN) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + sharpen(radius, sigma); + } + if (effect.effectCode == EF_BLUR) + { + QString tmpstr = effect.effectParameters; + double radius, sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> radius; + fp >> sigma; + blur(static_cast<int>(radius)); + } + if (effect.effectCode == EF_SOLARIZE) + { + QString tmpstr = effect.effectParameters; + double sigma; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> sigma; + solarize(sigma, cmyk); + } + if (effect.effectCode == EF_DUOTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + int shading1 = 100; + QString col2 = CommonStrings::None; + int shading2 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + fp >> shading1; + fp >> shading2; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col = CommonStrings::None; - int shading = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - // fp >> col; - col = fp.readLine(); - fp >> shading; - colorize(doc, colors[col], shading, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BRIGHTNESS) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int brightnessValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> brightnessValue; - brightness(brightnessValue, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_CONTRAST) + int lin2; + fp >> lin2; + duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + } + if (effect.effectCode == EF_TRITONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int contrastValue = 0; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> contrastValue; - contrast(contrastValue, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SHARPEN) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - sharpen(radius, sigma); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_BLUR) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double radius, sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> radius; - fp >> sigma; - blur(static_cast<int>(radius)); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_SOLARIZE) + int lin3; + fp >> lin3; + tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + } + if (effect.effectCode == EF_QUADTONE) + { + QString tmpstr = effect.effectParameters; + QString col1 = CommonStrings::None; + QString col2 = CommonStrings::None; + QString col3 = CommonStrings::None; + QString col4 = CommonStrings::None; + int shading1 = 100; + int shading2 = 100; + int shading3 = 100; + int shading4 = 100; + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + col1 = fp.readLine(); + col2 = fp.readLine(); + col3 = fp.readLine(); + col4 = fp.readLine(); + fp >> shading1; + fp >> shading2; + fp >> shading3; + fp >> shading4; + int numVals; + double xval, yval; + FPointArray curve1; + curve1.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - double sigma; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> sigma; - solarize(sigma, cmyk); + fp >> xval; + fp >> yval; + curve1.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_DUOTONE) + int lin1; + fp >> lin1; + FPointArray curve2; + curve2.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - int shading1 = 100; - QString col2 = CommonStrings::None; - int shading2 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - fp >> shading1; - fp >> shading2; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - duotone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, cmyk); + fp >> xval; + fp >> yval; + curve2.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_TRITONE) + int lin2; + fp >> lin2; + FPointArray curve3; + curve3.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - tritone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, cmyk); + fp >> xval; + fp >> yval; + curve3.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_QUADTONE) + int lin3; + fp >> lin3; + FPointArray curve4; + curve4.resize(0); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - QString col1 = CommonStrings::None; - QString col2 = CommonStrings::None; - QString col3 = CommonStrings::None; - QString col4 = CommonStrings::None; - int shading1 = 100; - int shading2 = 100; - int shading3 = 100; - int shading4 = 100; - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - col1 = fp.readLine(); - col2 = fp.readLine(); - col3 = fp.readLine(); - col4 = fp.readLine(); - fp >> shading1; - fp >> shading2; - fp >> shading3; - fp >> shading4; - int numVals; - double xval, yval; - FPointArray curve1; - curve1.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve1.addPoint(xval, yval); - } - int lin1; - fp >> lin1; - FPointArray curve2; - curve2.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve2.addPoint(xval, yval); - } - int lin2; - fp >> lin2; - FPointArray curve3; - curve3.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve3.addPoint(xval, yval); - } - int lin3; - fp >> lin3; - FPointArray curve4; - curve4.resize(0); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve4.addPoint(xval, yval); - } - int lin4; - fp >> lin4; - quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + fp >> xval; + fp >> yval; + curve4.addPoint(xval, yval); } - if (effectsList.at(a).effectCode == EF_GRADUATE) + int lin4; + fp >> lin4; + quadtone(doc, colors[col1], shading1, curve1, lin1, colors[col2], shading2, curve2, lin2, colors[col3], shading3, curve3, lin3, colors[col4], shading4, curve4, lin4, cmyk); + } + if (effect.effectCode == EF_GRADUATE) + { + QString tmpstr = effect.effectParameters; + int numVals; + double xval, yval; + FPointArray curve; + curve.resize(0); + ScTextStream fp(&tmpstr, QIODevice::ReadOnly); + fp >> numVals; + for (int nv = 0; nv < numVals; nv++) { - QString tmpstr = effectsList.at(a).effectParameters; - int numVals; - double xval, yval; - FPointArray curve; - curve.resize(0); - ScTextStream fp(&tmpstr, QIODevice::ReadOnly); - fp >> numVals; - for (int nv = 0; nv < numVals; nv++) - { - fp >> xval; - fp >> yval; - curve.addPoint(xval, yval); - } - int lin; - fp >> lin; - doGraduate(curve, cmyk, lin); + fp >> xval; + fp >> yval; + curve.addPoint(xval, yval); } + int lin; + fp >> lin; + doGraduate(curve, cmyk, lin); } } } @@ -392,7 +515,7 @@ *memory=(void *) NULL; } */ -void ScImage::solarize(double factor, bool cmyk) +void ScImage::Private::solarize(double factor, bool cmyk) { QVector<int> curveTable(256); int fk = qRound(255 / factor); @@ -404,15 +527,15 @@ } // Stack Blur Algorithm by Mario Klingemann <mario@quasimondo.com> -void ScImage::blur(int radius) +void ScImage::Private::blur(int radius) { if (radius < 1) { return; } QRgb *pix = (QRgb*)bits(); - int w = width(); - int h = height(); + int w = width_; + int h = height_; int wm = w-1; int hm = h-1; int wh = w*h; @@ -647,7 +770,7 @@ delete [] stack; } -bool ScImage::convolveImage(QImage *dest, const unsigned int order, const double *kernel) +bool ScImage::Private::convolveImage(QImage *dest, const unsigned int order, const double *kernel) { long widthk; double red, green, blue, alpha; @@ -663,7 +786,7 @@ normal_kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!normal_kernel) return(false); - *dest = QImage(width(), height(), QImage::Format_ARGB32); + *dest = QImage(width_, height_, QImage::Format_ARGB32); normalize=0.0; for(i=0; i < (widthk*widthk); i++) normalize += kernel[i]; @@ -683,11 +806,11 @@ sy = y-(widthk/2); for(mcy=0; mcy < widthk; ++mcy, ++sy) { - my = sy < 0 ? 0 : sy > height()-1 ? height()-1 : sy; + my = sy < 0 ? 0 : sy > height_-1 ? height_-1 : sy; sx = x+(-widthk/2); for(mcx=0; mcx < widthk; ++mcx, ++sx) { - mx = sx < 0 ? 0 : sx > width()-1 ? width()-1 : sx; + mx = sx < 0 ? 0 : sx > width_-1 ? width_-1 : sx; int px = pixel(mx, my); red += (*k)*(qRed(px)*257); green += (*k)*(qGreen(px)*257); @@ -696,7 +819,7 @@ ++k; } } - red = red < 0 ? 0 : red > 65535 ? 65535 : red+0.5; + red = red < 0 ? 0 : red > 65535 ? 6553 : red+0.5; green = green < 0 ? 0 : green > 65535 ? 65535 : green+0.5; blue = blue < 0 ? 0 : blue > 65535 ? 65535 : blue+0.5; alpha = alpha < 0 ? 0 : alpha > 65535 ? 65535 : alpha+0.5; @@ -710,7 +833,7 @@ return(true); } -int ScImage::getOptimalKernelWidth(double radius, double sigma) +int ScImage::Private::getOptimalKernelWidth(double radius, double sigma) { double normalize, value; long width; @@ -732,7 +855,7 @@ return((int)width-2); } -void ScImage::sharpen(double radius, double sigma) +void ScImage::Private::sharpen(double radius, double sigma) { double alpha, normalize, *kernel; int widthk; @@ -741,7 +864,7 @@ if(sigma == 0.0) return; widthk = getOptimalKernelWidth(radius, sigma); - if(width() < widthk) + if(width_ < widthk) return; kernel = (double *)malloc(widthk*widthk*sizeof(double)); if(!kernel) @@ -776,7 +899,7 @@ return; } -void ScImage::contrast(int contrastValue, bool cmyk) +void ScImage::Private::contrast(int contrastValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 - contrastValue); @@ -789,7 +912,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::brightness(int brightnessValue, bool cmyk) +void ScImage::Private::brightness(int brightnessValue, bool cmyk) { QVector<int> curveTable(256); QPoint p1(0,0 + brightnessValue); @@ -802,7 +925,7 @@ applyCurve(curveTable, cmyk); } -void ScImage::doGraduate(FPointArray curve, bool cmyk, bool linear) +void ScImage::Private::doGraduate(FPointArray curve, bool cmyk, bool linear) { QVector<int> curveTable(256); for (int x = 0 ; x < 256 ; x++) @@ -812,10 +935,10 @@ applyCurve(curveTable, cmyk); } -void ScImage::applyCurve(const QVector<int>& curveTable, bool cmyk) +void ScImage::Private::applyCurve(const QVector<int>& curveTable, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; QRgb *s; QRgb r; int c, m, y, k; @@ -847,10 +970,10 @@ } } -void ScImage::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) +void ScImage::Private::colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int cc, cm, cy, ck; int hu, sa, v; ScColor tmp2; @@ -897,10 +1020,10 @@ } } -void ScImage::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) +void ScImage::Private::duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, m, m1, y, y1, k, k1; int cn, c1n, mn, m1n, yn, y1n, kn, k1n; uchar cb; @@ -953,10 +1076,10 @@ } } -void ScImage::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) +void ScImage::Private::tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, m, m1, m2, y, y1, y2, k, k1, k2; int cn, c1n, c2n, mn, m1n, m2n, yn, y1n, y2n, kn, k1n, k2n; uchar cb; @@ -1021,10 +1144,10 @@ } } -void ScImage::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) +void ScImage::Private::quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int c, c1, c2, c3, m, m1, m2, m3, y, y1, y2, y3, k, k1, k2, k3; int cn, c1n, c2n, c3n, mn, m1n, m2n, m3n, yn, y1n, y2n, y3n, kn, k1n, k2n, k3n; uchar cb; @@ -1101,10 +1224,10 @@ } } -void ScImage::invert(bool cmyk) +void ScImage::Private::invert(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; unsigned char *p; QRgb * s; unsigned char c, m, y, k; @@ -1116,7 +1239,7 @@ if (cmyk) { p = (unsigned char *) s; - c = 255 - qMin(255, p[0] + p[3]); + c = 255 - qMin(255, p[0] + p[3]); m = 255 - qMin(255, p[1] + p[3]); y = 255 - qMin(255, p[2] + p[3]); k = qMin(qMin(c, m), y); @@ -1132,10 +1255,10 @@ } } -void ScImage::toGrayscale(bool cmyk) +void ScImage::Private::toGrayscale(bool cmyk) { - int h = height(); - int w = width(); + int h = height_; + int w = width_; int k; QRgb * s; QRgb r; @@ -1160,7 +1283,7 @@ } } -void ScImage::swapRGBA() +void ScImage::Private::swapRGBA() { unsigned int *ptr; unsigned char *p; @@ -1168,7 +1291,7 @@ for (int i = 0; i < height(); ++i) { ptr = (unsigned int *) scanLine(i); - for (int j = 0; j < width(); ++j) + for (int j = 0; j < width_; ++j) { p = (unsigned char *) ptr; r = p[0]; @@ -1180,18 +1303,21 @@ } } -void ScImage::createLowRes(double scale) +//TODO rename to 'makeLowRes' +void ScImage::lowerResolution(double scale) { int w = qRound(width() / scale); int h = qRound(height() / scale); QImage tmp = scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (tmp.format() != QImage::Format_ARGB32) tmp = tmp.convertToFormat(QImage::Format_ARGB32); - QImage::operator=(tmp); + *((QImage*)d)=tmp; } -bool ScImage::Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray) +bool ScImage::saveToJpg(QString fn, int Quality, bool isCMYK, bool isGray) const { + d->restore(); + struct jpeg_compress_struct cinfo; struct my_error_mgr jerr; FILE *outfile; @@ -1242,7 +1368,7 @@ uchar *row = row_pointer[0]; if (isCMYK) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1256,7 +1382,7 @@ { if (isGray) { - QRgb* rgba = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgba = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; ++i) { *row++ = qRed(*rgba); @@ -1265,7 +1391,7 @@ } else { - QRgb* rgb = (QRgb*)scanLine(cinfo.next_scanline); + QRgb* rgb = (QRgb*)d->scanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row++ = qRed(*rgb); @@ -1284,8 +1410,10 @@ return true; } -QByteArray ScImage::ImageToArray() +QByteArray ScImage::toArray() const { + d->restore(); + int i = 0; int h = height(); int w = width(); @@ -1297,7 +1425,7 @@ return imgArray; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1312,15 +1440,20 @@ return imgArray; } -void ScImage::convertToGray(void) +void ScImage::convertToGray() { + d->restore(); + Private::ImageEffectSettings t; + t.convertToGray = true; + d->imEffectSettings.append(t); + int k; int h = height(); int w = width(); QRgb *s, r; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s; @@ -1330,8 +1463,10 @@ } } -bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) +bool ScImage::writeRGBDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1345,7 +1480,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1364,8 +1499,10 @@ return success; } -bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) +bool ScImage::writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1379,7 +1516,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); if (precal) // image data is already grayscale, no need for weighted conversion { for( int xi=0; xi < w; ++xi ) @@ -1411,8 +1548,10 @@ return success; } -bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) +bool ScImage::writeCMYKDataToFilter(ScStreamFilter* filter) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1426,7 +1565,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1446,8 +1585,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1462,7 +1603,7 @@ return false; for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1502,8 +1643,10 @@ return success; } -bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) +bool ScImage::writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const { + d->restore(); + QRgb r, *s; QByteArray buffer; bool success = true; @@ -1521,7 +1664,7 @@ unsigned char* maskData = (unsigned char*) mask.constData(); for( int yi=0; yi < h; ++yi ) { - s = (QRgb*)(scanLine( yi )); + s = (QRgb*)(d->scanLine( yi )); for( int xi=0; xi < w; ++xi ) { r = *s++; @@ -1563,8 +1706,13 @@ return success; } -void ScImage::scaleImage(int nwidth, int nheight) +void ScImage::scale(int nwidth, int nheight) { + d->restore(); + Private::ImageEffectSettings t; + t.scale = true; + d->imEffectSettings.append(t); + QImage dst(nwidth, nheight, QImage::Format_ARGB32); QRgb* xelrow = 0; QRgb* tempxelrow = 0; @@ -1621,13 +1769,13 @@ for ( row = 0; row < newrows; ++row ) { if ( newrows == rows ) - tempxelrow = xelrow = (QRgb*)scanLine(rowsread++); + tempxelrow = xelrow = (QRgb*)d->scanLine(rowsread++); else { while ( fracrowleft < fracrowtofill ) { if ( needtoreadrow && rowsread < rows ) - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); for ( col = 0, xP = xelrow; col < cols; ++col, ++xP ) { as[col] += fracrowleft * qAlpha( *xP ); @@ -1641,7 +1789,7 @@ } if ( needtoreadrow && rowsread < rows ) { - xelrow = (QRgb*)scanLine(rowsread++); + xelrow = (QRgb*)d->scanLine(rowsread++); needtoreadrow = 0; } register long a=0; @@ -1756,11 +1904,11 @@ delete [] gs; if ( bs ) // Robust, bs might be 0 one day delete [] bs; - QImage::operator=(QImage(nwidth, nheight, QImage::Format_ARGB32)); + *((QImage*)this->d)=QImage(nwidth, nheight, QImage::Format_ARGB32); for( int yi=0; yi < dst.height(); ++yi ) { QRgb *s = (QRgb*)(dst.scanLine( yi )); - QRgb *d = (QRgb*)(scanLine( yi )); + QRgb *d = (QRgb*)(this->d->scanLine( yi )); for(int xi=0; xi < dst.width(); ++xi ) { (*d) = (*s); @@ -1768,7 +1916,8 @@ d++; } } - return; + d->width_=d->width(); + d->height_=d->height(); } bool ScImage::getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes, int scaleXSize, int scaleYSize) @@ -1824,10 +1973,8 @@ { if (pDataLoader->imageInfoRecord().valid) { - if ((pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK)) - rImage = pDataLoader->r_image.convertToQImage(true); - else - rImage = pDataLoader->r_image.convertToQImage(false); + bool cmyk=(pDataLoader->r_image.channels() == 5) || (pDataLoader->imageInfoRecord().colorspace == ColorSpaceCMYK); + rImage = pDataLoader->r_image.convertToQImage(cmyk); } } else @@ -1893,18 +2040,17 @@ return gotAlpha; } -void ScImage::getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page) +QByteArray ScImage::getEmbeddedProfile(const QString & fn, int *components, int page) { - Q_ASSERT(profile); + QByteArray profile; Q_ASSERT(components); ScImgDataLoader* pDataLoader = NULL; cmsHPROFILE prof = 0; - profile->resize(0); *components = 0; QFileInfo fi = QFileInfo(fn); if (!fi.exists()) - return; + return QByteArray(); QString ext = fi.suffix().toLower(); if (extensionIndicatesPSD(ext)) @@ -1931,18 +2077,54 @@ *components = 4; if (static_cast<int>(cmsGetColorSpace(prof)) == icSigGrayData) *components = 1; - *profile = embeddedProfile; + profile = embeddedProfile; } cmsCloseProfile(prof); } delete pDataLoader; } + return profile; } + bool ScImage::LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK, bool showMsg) { + delete d->imLoadSettings; + d->imLoadSettings = new Private::ImageLoadSettings(cmSettings); + + d->imLoadSettings->fileName=fn; + d->imLoadSettings->page=page; +// d->imLoadSettings->cmSettings=cmSettings; + d->imLoadSettings->useEmbedded=useEmbedded; + d->imLoadSettings->useProf=useProf; + d->imLoadSettings->requestType=requestType; + d->imLoadSettings->gsRes=gsRes; + + d->imEffectSettings.clear(); + + d->height_=-1; + d->width_=-1; + + //TODO + QTime a;a.start(); + bool ok=d->doLoadPicture(fn, page, cmSettings, useEmbedded, useProf, requestType, gsRes, realCMYK, showMsg); + d->height_=d->height(); + d->width_=d->width(); + qDebug()<<"LoadPicture"<<fn<<realCMYK<<showMsg<<a.elapsed()<<d->numBytes(); + + //so low-memory systems don't get lost in swap on document loading + if (grossNumKBytes>128*1024) + d->clear(); + return ok; +} + +bool ScImage::Private::doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, + bool useEmbedded, bool useProf, RequestType requestType, + int gsRes, bool *realCMYK, bool showMsg) +{ + qDebug()<<"doLoadPicture"<<fn; // requestType - 0: CMYK, 1: RGB, 2: RGB Proof 3 : RawData, 4: Thumbnail // gsRes - is the resolution that ghostscript will render at bool isCMYK = false; @@ -1960,8 +2142,10 @@ int cmsProofFlags = 0; auto_ptr<ScImgDataLoader> pDataLoader; QFileInfo fi = QFileInfo(fn); + qDebug()<<"doLoadPicture 0"; if (!fi.exists()) return ret; + qDebug()<<"doLoadPicture 01"; QString ext = fi.suffix().toLower(); QString tmp, dummy, cmd1, cmd2, BBox, tmp2; QChar tc; @@ -1987,7 +2171,7 @@ else if (extensionIndicatesPSD(ext)) { pDataLoader.reset( new ScImgDataLoader_PSD() ); - pDataLoader->setRequest(imgInfo.isRequest, imgInfo.RequestProps); + pDataLoader->setRequest(q->imgInfo.isRequest, q->imgInfo.RequestProps); } else if (extensionIndicatesJPEG(ext)) pDataLoader.reset( new ScImgDataLoader_JPEG() ); @@ -1999,7 +2183,7 @@ if (pDataLoader->loadPicture(fn, page, gsRes, (requestType == Thumbnail))) { QImage::operator=(pDataLoader->image()); - imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo = pDataLoader->imageInfoRecord(); if (requestType == Thumbnail) reqType = RGBData; // if (!cmSettings.useColorManagement() || !useProf) @@ -2007,13 +2191,13 @@ // imgInfo.isEmbedded = false; // imgInfo.profileName = ""; // } - if (imgInfo.colorspace == ColorSpaceCMYK) + if (q->imgInfo.colorspace == ColorSpaceCMYK) { isCMYK = true; if(realCMYK) *realCMYK = true; } - else if (imgInfo.colorspace == ColorSpaceGray) + else if (q->imgInfo.colorspace == ColorSpaceGray) bilevel = true; pDataLoader->image() = QImage(); } @@ -2028,14 +2212,17 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + qDebug()<<"doLoadPicture 000"; return false; } + qDebug()<<"doLoadPicture 111"; if (!(extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext))) { if (isNull()) return ret; } + qDebug()<<"doLoadPicture 112"; QByteArray embeddedProfile = pDataLoader->embeddedProfile(); if (cmSettings.useColorManagement() && useProf) @@ -2054,15 +2241,15 @@ { if (ScCore->InputProfilesCMYK.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile)) { - imgInfo.profileName = cmSettings.profileName(); + q->imgInfo.profileName = cmSettings.profileName(); inputProfisEmbedded = true; - profilePath = ScCore->InputProfilesCMYK[imgInfo.profileName].toLocal8Bit(); + profilePath = ScCore->InputProfilesCMYK[q->imgInfo.profileName].toLocal8Bit(); inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageCMYKProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageCMYKProfile; inputProfisEmbedded = false; } } @@ -2070,15 +2257,15 @@ { if (ScCore->InputProfiles.contains(cmSettings.profileName()) && (cmSettings.profileName() != cmSettings.doc()->CMSSettings.DefaultImageRGBProfile)) { - imgInfo.profileName = cmSettings.profileName(); - profilePath = ScCore->InputProfiles[imgInfo.profileName].toLocal8Bit(); + q->imgInfo.profileName = cmSettings.profileName(); + profilePath = ScCore->InputProfiles[q->imgInfo.profileName].toLocal8Bit(); inputProfisEmbedded = true; inputProf = cmsOpenProfileFromFile(profilePath.data(), "r"); } else { inputProf = cmSettings.doc()->DocInputImageRGBProf; - imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; + q->imgInfo.profileName = cmSettings.doc()->CMSSettings.DefaultImageRGBProfile; inputProfisEmbedded = false; } } @@ -2099,6 +2286,7 @@ cmsHPROFILE printerProf = cmSettings.printerProfile() ? cmSettings.printerProfile() : ScCore->defaultCMYKProfile; if (useProf && inputProf && screenProf && printerProf) { + qDebug()<<"doLoadPicture 33"; bool isPsdTiff = (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)); DWORD SC_TYPE_YMCK_8 = (COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(1)|DOSWAP_SH(1)|SWAPFIRST_SH(1)); DWORD inputProfFormat = TYPE_BGRA_8; @@ -2132,6 +2320,7 @@ } if (!cmSettings.useColorManagement() || cmSettings.useBlackPoint()) cmsFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + qDebug()<<"doLoadPicture 334"; switch (reqType) { case CMYKData: // CMYK @@ -2149,11 +2338,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2163,7 +2352,7 @@ { if (cmSettings.useColorManagement() && cmSettings.doSoftProofing()) { - if ((imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) + if ((q->imgInfo.profileName == cmSettings.defaultImageRGBProfile()) || (q->imgInfo.profileName == cmSettings.defaultImageCMYKProfile())) { if (isCMYK) xform = cmSettings.cmykImageProofingTransform(); @@ -2187,29 +2376,32 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } + qDebug()<<"doLoadPicture 335"; if (xform) { + qDebug()<<"doLoadPicture 335 xform"; if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(QImage(pDataLoader->r_image.width(), pDataLoader->r_image.height(), QImage::Format_ARGB32)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } + qDebug()<<"doLoadPicture 335 xf1"; LPBYTE ptr2 = NULL; for (int i = 0; i < height(); i++) { @@ -2304,18 +2496,22 @@ } } } + qDebug()<<"doLoadPicture 335 xf 2"; if (!stdProof && !ScCore->IsDefaultTransform(xform)) cmsDeleteTransform (xform); } + qDebug()<<"doLoadPicture 336"; if ((inputProf) && (inputProfisEmbedded) && !ScCore->IsDefaultProfile(inputProf)) cmsCloseProfile(inputProf); if (isCMYK) cmsChangeBuffersFormat(cmSettings.cmykImageProofingTransform(), TYPE_CMYK_8, TYPE_RGBA_8); else cmsChangeBuffersFormat(cmSettings.rgbImageProofingTransform(), TYPE_RGBA_8, TYPE_RGBA_8); + qDebug()<<"doLoadPicture 339"; } else { + qDebug()<<"doLoadPicture 4"; switch (reqType) { case CMYKData: @@ -2324,11 +2520,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2352,11 +2548,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2370,11 +2566,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2401,11 +2597,11 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(false)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } @@ -2415,26 +2611,24 @@ if (extensionIndicatesPSD(ext) || extensionIndicatesTIFF(ext)) { QImage::operator=(pDataLoader->r_image.convertToQImage(true, true)); - profileName = imgInfo.profileName; - hasEmbeddedProfile = imgInfo.isEmbedded; - imgInfo = pDataLoader->imageInfoRecord(); - imgInfo.profileName = profileName; - imgInfo.isEmbedded = hasEmbeddedProfile; + profileName = q->imgInfo.profileName; + hasEmbeddedProfile = q->imgInfo.isEmbedded; + q->imgInfo = pDataLoader->imageInfoRecord(); + q->imgInfo.profileName = profileName; + q->imgInfo.isEmbedded = hasEmbeddedProfile; // JG : this line overwrite image profile info and should not be needed here!!!! // imgInfo = pDataLoader->imageInfoRecord(); } break; } } + qDebug()<<"doLoadPicture 8"; // if (((reqType == CMYKData) || ((reqType == RawData) && isCMYK)) && !bilevel) // setAlphaBuffer(false); - setDotsPerMeterX (qMax(2834, (int) (imgInfo.xres / 0.0254))); - setDotsPerMeterY (qMax(2834, (int) (imgInfo.yres / 0.0254))); - if (imgInfo.isEmbedded && useEmbedded) - imgInfo.isEmbedded = true; - else - imgInfo.isEmbedded = false; - if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) + setDotsPerMeterX (qMax(2834, (int) (q->imgInfo.xres / 0.0254))); + setDotsPerMeterY (qMax(2834, (int) (q->imgInfo.yres / 0.0254))); + q->imgInfo.isEmbedded=q->imgInfo.isEmbedded && useEmbedded; + if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) { QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage(), 1, 0, 0); } @@ -2443,5 +2637,8 @@ QString msg = pDataLoader->getMessage(); qWarning("%s", msg.toLocal8Bit().data() ); } + grossNumKBytes+=(numBytes()/1000); return true; } + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: scribus/scimage.h =================================================================== --- scribus/scimage.h (revision 13805) +++ scribus/scimage.h (working copy) @@ -10,34 +10,34 @@ #include "scconfig.h" #include "scribusapi.h" #include "scimagestructs.h" +#include "fpointarray.h" +#include "sccolor.h" + #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <QImage> #include <QString> -#include <QDataStream> -#include <QMap> -#include <QList> -#include <QVector> -#include <QFile> -#include <QDir> -#include <QStringList> -#include "fpointarray.h" -#include "sccolor.h" class ScribusDoc; class ScStreamFilter; class CMSettings; -class SCRIBUS_API ScImage : private QImage +/** + * clears its internal data if itsn't accessed for some time (10 seconds) + * and restores it on the next access, reapplying all the effects and transformations + * (graying and scaling) + */ +class SCRIBUS_API ScImage { + public: ScImage(); - ScImage(const QImage & image); - ScImage(const ScImage & image); - ScImage( int width, int height ); + ScImage(const QImage& image); + ScImage(const ScImage& image); + ScImage(int width, int height); ~ScImage(); enum RequestType @@ -66,68 +66,59 @@ }; void initialize(); + ScImage & operator=(const ScImage & other); - const QImage& qImage(); + + QImage qImage() const; + /** + * be careful not to save the pointer until the next event loop run: + * it may be cleared by timer + */ QImage* qImagePtr(); QImage scaled(int h, int w, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + + int height() const; + int width() const; + bool hasAlpha() const; - int height() const { return QImage::height(); } - int width() const { return QImage::width(); } - bool hasAlpha() const { return QImage::hasAlphaChannel(); } - - // Routines for PDF/PS output of images - QByteArray ImageToArray(); + bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - void convertToGray(void); + void convertToGray(); - bool writeRGBDataToFilter(ScStreamFilter* filter); - bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal); - bool writeCMYKDataToFilter(ScStreamFilter* filter); + void applyEffects(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + /// Generate a low res image for user preview + void lowerResolution(double scale); + /// Scale this image in-place + void scale(int width, int height); - bool writePSImageToFilter(ScStreamFilter* filter, int pl); - bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl); + // Routines for PDF/PS output of images + QByteArray toArray() const; - bool getAlpha(QString fn, int page, QByteArray& alpha, bool PDF, bool pdf14, int gsRes = 72, int scaleXSize = 0, int scaleYSize = 0); - bool Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray); + bool writeRGBDataToFilter(ScStreamFilter* filter) const; + bool writeGrayDataToFilter(ScStreamFilter* filter, bool precal) const; + bool writeCMYKDataToFilter(ScStreamFilter* filter) const; - // Image effects - void applyEffect(const ScImageEffectList& effectsList, ColorList& colors, bool cmyk); + bool writePSImageToFilter(ScStreamFilter* filter, int pl) const; + bool writePSImageToFilter(ScStreamFilter* filter, const QByteArray& mask, int pl) const; - // Generate a low res image for user preview - void createLowRes(double scale); + bool saveToJpg(QString fn, int quality, bool isCMYK, bool isGray) const; - // Scale this image in-place - void scaleImage(int width, int height); - // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. - // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. - void getEmbeddedProfile(const QString & fn, QByteArray *profile, int *components, int page = 0); - // Load an image into this ScImage instance // TODO: document params, split into smaller functions bool LoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); - ImageInfoRecord imgInfo; -private: + // Retrieve an embedded ICC profile from the file path `fn', storing it in `profile'. + // TODO: Bad API. Should probably be static member returning an ICCProfile (custom class) or something like that. + static QByteArray getEmbeddedProfile(const QString & fn, int *components, int page = 0); - // Image effects - void solarize(double factor, bool cmyk); - void blur(int radius = 0); - void sharpen(double radius= 0.0, double sigma = 1.0); - void contrast(int contrastValue, bool cmyk); - void brightness(int brightnessValue, bool cmyk); - void invert(bool cmyk); - void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); - void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); - void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); - void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); - void toGrayscale(bool cmyk); - void doGraduate(FPointArray curve, bool cmyk, bool linear); - void swapRGBA(); - bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); - int getOptimalKernelWidth(double radius, double sigma); - void applyCurve(const QVector<int>& curveTable, bool cmyk); + ImageInfoRecord imgInfo; +private: + class Private; + mutable Private* d; }; #endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; Index: scribus/scimage_p.h =================================================================== --- scribus/scimage_p.h (revision 0) +++ scribus/scimage_p.h (revision 0) @@ -0,0 +1,114 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#ifndef SCIMAGE_P_H +#define SCIMAGE_P_H + +#include "cmsettings.h" +#include "scimage.h" + +#include <QVector> +#include <QImage> +#include <QObject> +#include <QTimer> + + +struct ScImage::Private: public QObject, public QImage +{ + Q_OBJECT + +private: + ScImage* q; + +public: + Private(ScImage* q_) + : QObject(), QImage() + , q(q_) + , height_(0) + , width_(0) + , imLoadSettings(0) + {} + + Private(ScImage* q_, int width, int height) + : QObject(), QImage(width, height, QImage::Format_ARGB32 ) + , q(q_) + , height_(height) + , width_(width) + , imLoadSettings(0) + {} + + virtual ~Private() + { + delete imLoadSettings; + } + + Private& operator=(const Private& other); + + void restore(); + void doApplyEffect(const ScImageEffectList& effectsList, const ColorList& colors, bool cmyk); + bool doLoadPicture(const QString & fn, int page, const CMSettings& cmSettings, bool useEmbedded, bool useProf, RequestType requestType, int gsRes, bool *realCMYK = 0, bool showMsg = false); + + + struct ImageLoadSettings + { + QString fileName; + int page; + CMSettings cmSettings; + bool useEmbedded; + bool useProf; + RequestType requestType; + int gsRes; + + ImageLoadSettings(const CMSettings& s):cmSettings(s){} + }; + + struct ImageEffectSettings + { + ScImageEffectList effectsList; + ColorList colors; + bool cmyk; + bool convertToGray; + bool scale; //when scaleImage was called; + + ImageEffectSettings() + : cmyk(false) + , convertToGray(false) + , scale(false) + {} + }; + + int height_; + int width_; + QTimer clearTimer; + + ImageLoadSettings* imLoadSettings; + QVector<ImageEffectSettings> imEffectSettings; + + // Image effects + void solarize(double factor, bool cmyk); + void blur(int radius = 0); + void sharpen(double radius= 0.0, double sigma = 1.0); + void contrast(int contrastValue, bool cmyk); + void brightness(int brightnessValue, bool cmyk); + void invert(bool cmyk); + void colorize(ScribusDoc* doc, ScColor color, int shade, bool cmyk); + void duotone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, bool cmyk); + void tritone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, bool cmyk); + void quadtone(ScribusDoc* doc, ScColor color1, int shade1, FPointArray curve1, bool lin1, ScColor color2, int shade2, FPointArray curve2, bool lin2, ScColor color3, int shade3, FPointArray curve3, bool lin3, ScColor color4, int shade4, FPointArray curve4, bool lin4, bool cmyk); + void toGrayscale(bool cmyk); + void doGraduate(FPointArray curve, bool cmyk, bool linear); + void swapRGBA(); + bool convolveImage(QImage *dest, const unsigned int order, const double *kernel); + int getOptimalKernelWidth(double radius, double sigma); + void applyCurve(const QVector<int>& curveTable, bool cmyk); + +public Q_SLOTS: + void clear(); +}; + +#endif + +// kate: space-indent off; indent-width 4; mixedindent off; indent-mode cstyle; tab-width 4; Index: scribus/scpageoutput.cpp =================================================================== --- scribus/scpageoutput.cpp (revision 13805) +++ scribus/scpageoutput.cpp (working copy) @@ -940,7 +940,7 @@ imScaleX *= (72.0 / (double) m_imageRes); imScaleY *= (72.0 / (double) m_imageRes); } - scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); + scImg.applyEffects(item->effectsInUse, m_doc->PageColors, useCmyk); mode = imageMode; pImage = &scImg; } Index: scribus/scribuswin.cpp =================================================================== --- scribus/scribuswin.cpp (revision 13805) +++ scribus/scribuswin.cpp (working copy) @@ -149,12 +149,8 @@ void ScribusWin::setMasterPagesPaletteShown(bool isShown) const { - if (m_masterPagesPalette==NULL) - return; - if (isShown) - m_masterPagesPalette->show(); - else - m_masterPagesPalette->hide(); + if (m_masterPagesPalette) + m_masterPagesPalette->setVisible(isShown); } void ScribusWin::windowActivationChange ( bool oldActive ) Index: scribus/style.h =================================================================== --- scribus/style.h (revision 13805) +++ scribus/style.h (working copy) @@ -45,9 +45,9 @@ public: // static const short NOVALUE = -16000; - Style(): m_isDefaultStyle(false), m_name(""), m_context(NULL), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(): m_isDefaultStyle(false), m_context(NULL), m_contextversion(-1), m_shortcut() {} - Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_parent(""), m_shortcut() {} + Style(StyleContext* b, QString n): m_isDefaultStyle(false), m_name(n), m_context(b), m_contextversion(-1), m_shortcut() {} Style& operator=(const Style& o) { //assert(typeinfo() == o.typeinfo()); @@ -79,7 +79,7 @@ bool isDefaultStyle() const { return m_isDefaultStyle; } QString name() const { return m_name; } - void setName(const QString& n) { m_name = n.isEmpty() ? "" : n; } + void setName(const QString& n) { m_name = n; } bool hasName() const { return ! m_name.isEmpty(); } virtual QString displayName() const = 0;/*{ @@ -139,7 +139,7 @@ */ void applyStyle(const Style& other) { if (other.hasParent()) - setParent( other.parent() == INHERIT_PARENT? "" :other.parent()); + setParent( other.parent() == INHERIT_PARENT? QString() :other.parent()); m_contextversion = -1; } /** @@ -147,7 +147,7 @@ */ void eraseStyle(const Style& other) { if (other.parent() == parent()) - setParent(""); + setParent(QString()); m_contextversion = -1; } }; Index: scribus/text/storytext.cpp =================================================================== --- scribus/text/storytext.cpp (revision 13805) +++ scribus/text/storytext.cpp (working copy) @@ -336,7 +336,7 @@ for (int i = 0; i < txt.length(); ++i) { ScText * item = new ScText(clone); - item->ch= txt.at(i); + item->ch=txt.at(i); item->setContext(cStyleContext); d->insert(pos + i, item); d->len++; Index: scribus/ui/effectsdialog.cpp =================================================================== --- scribus/ui/effectsdialog.cpp (revision 13805) +++ scribus/ui/effectsdialog.cpp (working copy) @@ -58,10 +58,7 @@ { double sx = ix / 220.0; double sy = iy / 220.0; - if (sy < sx) - image.createLowRes(sx); - else - image.createLowRes(sy); + image.lowerResolution(qMax(sx, sy)); imageScale = qMin(sx, sy); } EffectsDialogLayout = new QHBoxLayout( this ); @@ -726,7 +723,7 @@ return; ScImage im(image); saveValues(false); - im.applyEffect(effectsList, doc->PageColors, false); + im.applyEffects(effectsList, doc->PageColors, false); QPixmap Bild = QPixmap(pixmapLabel1->width(), pixmapLabel1->height()); int x = (pixmapLabel1->width() - im.qImage().width()) / 2; int y = (pixmapLabel1->height() - im.qImage().height()) / 2; Index: scribus/ui/pdfopts.cpp =================================================================== --- scribus/ui/pdfopts.cpp (revision 13805) +++ scribus/ui/pdfopts.cpp (working copy) @@ -174,11 +174,7 @@ } } - bool doIt = false; - if (multiFile->isChecked()) - doIt = true; - else - doIt = overwrite(this, fn); + bool doIt = multiFile->isChecked() || overwrite(this, fn); if (doIt) { EffVal = Options->EffVal; |
|
I committed the file interdependency part of the patch to 1.5.0svn and uploaded an updated patch. I did a basic test with a 20-30 page doc with lots of images. When scrolling, there are lots of display issues with images : image distorted or being only displayed partially. Something to look at... |
|
Hi. First of all, I'm sorry for being silent for such a long time. which renderer did you test with? I compiled scribus on Linux with QtArthur and didn't see any glitches. If you still have that multiimage doc, I would be happy to test it on my machine in different setups. |
|
please don't forget me ;) |
|
well, it's a patch which may not be very easy to apply... but right now, i guess it would be nice to have it applied in 1.5 so that problems are sorted out (as long as the drawbacks are indeed only drawing artifacts...) but jean may have good reasons not to apply it (like missing time...) |
|
Please re-test with cairo as Qt Arthur will be disabled in 1.5.0svn soon-ish. Jean, do you still have that document? |
|
ok, i'm compiling fresh Scribus now. btw never got lucky with building scribus on win32. and why do you want to disable Qt Arthur? is it because of performance or missing features? |
|
Missing features, eg gradient mesh which the very latest cairo has, performance, etc etc |
|
This looks like it can offer a perfomance boost. What's the status of this? |
|
Shaforostoff, ping |
|
Because we are coming up on the anniversary of Shaforostoff's reply, I thought I would make a plea him to respond and make this patch work. Shaforostoff, please respond :( |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-07-28 13:18 | Shaforostoff | New Issue | |
2009-07-28 13:18 | Shaforostoff | File Added: offload-images_and_decouple-header-dependencies.patch | |
2009-07-28 13:25 | Shaforostoff | Note Added: 0022247 | |
2009-07-28 18:51 | jghali | Note Added: 0022254 | |
2009-07-28 18:55 | jghali | Note Edited: 0022254 | |
2009-07-28 19:03 | Shaforostoff | Note Added: 0022255 | |
2009-07-29 12:26 | Shaforostoff | File Added: offload-images_and_decouple-header-dependencies_150.patch | |
2009-07-29 12:26 | Shaforostoff | Note Added: 0022260 | |
2009-08-02 21:57 | jghali | File Added: 8308-r13805-update.patch | |
2009-08-02 21:59 | jghali | File Deleted: 8308-r13805-update.patch | |
2009-08-02 22:03 | jghali | File Added: 8308-r13805-update.patch | |
2009-08-02 22:07 | jghali | Note Added: 0022270 | |
2009-08-02 22:07 | jghali | Note Edited: 0022270 | |
2009-12-16 23:49 | Shaforostoff | Note Added: 0022971 | |
2009-12-16 23:49 | Shaforostoff | Note Edited: 0022971 | |
2009-12-17 03:23 | christoph_s | Status | new => assigned |
2009-12-17 03:23 | christoph_s | Assigned To | => jghali |
2009-12-21 08:21 | jghali | Assigned To | jghali => |
2009-12-21 08:21 | jghali | Status | assigned => new |
2010-03-30 07:53 | Shaforostoff | Note Added: 0023627 | |
2010-03-30 16:04 | ale | Note Added: 0023629 | |
2011-01-27 18:09 | cbradney | Note Added: 0025486 | |
2011-01-27 19:14 | Shaforostoff | Note Added: 0025487 | |
2011-01-27 19:30 | cbradney | Note Added: 0025488 | |
2014-08-18 15:59 | Kunda | Note Added: 0033266 | |
2014-08-18 15:59 | Kunda | Status | new => feedback |
2014-08-18 15:59 | Kunda | Product Version | 1.3.5svn => 1.5.0svn |
2014-08-18 16:17 | Kunda | Relationship added | child of 0004024 |
2014-08-18 16:20 | Kunda | Relationship deleted | child of 0004024 |
2014-08-18 16:21 | Kunda | Relationship added | related to 0002438 |
2014-08-29 21:43 | Kunda | Note Added: 0033367 | |
2014-10-24 23:00 | Kunda | Patch | => Yes |
2015-01-15 14:09 | Kunda | Note Added: 0034368 | |
2015-04-29 01:49 | Kunda | Relationship added | related to 0004890 |
2015-09-17 20:10 | Kunda | Category | Graphics / Image Frames => Graphics/Img Frames |
2015-09-17 20:11 | Kunda | Category | Graphics/Img Frames => Graphics / Image Frames |