/trunk/Scribus/scribus/downloadmanager/scdlthread.cpp |
---|
16,10 → 16,6 |
connect(this, SIGNAL(runSignal()), this, SLOT(runSlot())); |
} |
ScDLThread::~ScDLThread() |
{ |
} |
void ScDLThread::run() |
{ |
emit runSignal(); |
/trunk/Scribus/scribus/downloadmanager/scdlthread.h |
---|
15,7 → 15,8 |
Q_OBJECT |
public: |
ScDLThread(QObject * parent = nullptr); |
~ScDLThread(); |
~ScDLThread() = default; |
void run(); |
void addURL(const QUrl &url, bool overwrite, const QString& location, const QString& destinationLocation); |
/trunk/Scribus/scribus/fontlistmodel.cpp |
---|
64,7 → 64,7 |
return m_font_names.size(); |
} |
int FontListModel::rowCount() |
int FontListModel::rowCount() const |
{ |
return m_font_names.size(); |
} |
300,7 → 300,7 |
return true; |
} |
QString FontListModel::nameForIndex(const QModelIndex & idx) |
QString FontListModel::nameForIndex(const QModelIndex & idx) const |
{ |
return m_font_names.at(idx.row()); |
} |
/trunk/Scribus/scribus/fontlistmodel.h |
---|
50,7 → 50,7 |
It returns the count of fonts. */ |
int rowCount(const QModelIndex&) const; |
//! The same behaviour as the previous one. |
int rowCount(); |
int rowCount() const; |
/*! Required inherited method. See Qt4 docs. |
It *must* return the count of ColumnTypes items */ |
int columnCount(const QModelIndex&) const; |
76,7 → 76,7 |
/*! Get the font name for current index. |
\note Remember to use the mapToSource() if you're using QSortFilterProxyModel |
*/ |
QString nameForIndex(const QModelIndex & index); |
QString nameForIndex(const QModelIndex & index) const; |
bool isLive() const { return m_embedFlags.count() == 0; } |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp |
---|
82,7 → 82,7 |
if (read_jpeg_marker(ICC_MARKER, &cinfo, &EmbedBuffer, &EmbedLen)) |
{ |
bool profileIsValid = false; |
QByteArray profArray = QByteArray((const char*) EmbedBuffer, EmbedLen); |
QByteArray profArray((const char*) EmbedBuffer, EmbedLen); |
ScColorProfile prof = ScCore->defaultEngine.openProfileFromMem(profArray); |
if (prof) |
{ |
524,7 → 524,7 |
if (ori != 1) |
{ |
QTransform M; |
QTransform flip = QTransform(-1, 0, 0, 1, 0, 0); |
QTransform flip(-1, 0, 0, 1, 0, 0); |
switch ( ori ) |
{ // notice intentional fallthroughs |
case 2: |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp |
---|
99,7 → 99,7 |
if (png_get_iCCP(pngPtr, pngInfo, &profileName, &compression_type, &profileBuffer, &profileLen)) |
{ |
QByteArray profArray = QByteArray((const char*) profileBuffer, profileLen); |
QByteArray profArray((const char*) profileBuffer, profileLen); |
if ((profArray.size() >= 40) && (profArray[36] == 'a') && (profArray[37] == 'c') && (profArray[38] == 's') && (profArray[39] == 'p')) |
profileData = profArray; |
} |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pdf.cpp |
---|
78,35 → 78,36 |
args.append("-dUseArtBox"); |
args.append(picFile); |
// qDebug() << "scimgdataloader_pdf:" << args; |
int retg = callGS(args); |
if (retg == 0) |
if (retg != 0) |
return false; |
m_image.load(tmpFile); |
QFile::remove(tmpFile); |
if (!ScCore->havePNGAlpha()) |
{ |
m_image.load(tmpFile); |
QFile::remove(tmpFile); |
if (!ScCore->havePNGAlpha()) |
for (int yi = 0; yi < m_image.height(); ++yi) |
{ |
for (int yi = 0; yi < m_image.height(); ++yi) |
QRgb *s = (QRgb*)(m_image.scanLine( yi )); |
for (int xi = 0; xi < m_image.width(); ++xi ) |
{ |
QRgb *s = (QRgb*)(m_image.scanLine( yi )); |
for (int xi = 0; xi < m_image.width(); ++xi ) |
{ |
if ((*s) == 0xffffffff) |
(*s) &= 0x00ffffff; |
s++; |
} |
if ((*s) == 0xffffffff) |
(*s) &= 0x00ffffff; |
s++; |
} |
} |
m_imageInfoRecord.BBoxX = 0; |
m_imageInfoRecord.BBoxH = m_image.height(); |
m_imageInfoRecord.xres = gsRes; |
m_imageInfoRecord.yres = gsRes; |
m_imageInfoRecord.colorspace = ColorSpaceRGB; |
m_image.setDotsPerMeterX ((int) (xres / 0.0254)); |
m_image.setDotsPerMeterY ((int) (yres / 0.0254)); |
m_pixelFormat = Format_BGRA_8; |
return true; |
} |
return false; |
m_imageInfoRecord.BBoxX = 0; |
m_imageInfoRecord.BBoxH = m_image.height(); |
m_imageInfoRecord.xres = gsRes; |
m_imageInfoRecord.yres = gsRes; |
m_imageInfoRecord.colorspace = ColorSpaceRGB; |
m_image.setDotsPerMeterX ((int) (xres / 0.0254)); |
m_image.setDotsPerMeterY ((int) (yres / 0.0254)); |
m_pixelFormat = Format_BGRA_8; |
return true; |
} |
bool ScImgDataLoader_PDF::preloadAlphaChannel(const QString& fn, int page, int gsRes, bool& hasAlpha) |
117,7 → 118,7 |
m_imageInfoRecord.actualPageNumber = page; |
hasAlpha = false; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
if (!fi.exists()) |
return false; |
QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png"); |
124,12 → 125,10 |
QString picFile = QDir::toNativeSeparators(fn); |
QStringList args; |
args.append("-r"+QString::number(gsRes)); |
// args.append("-sOutputFile=\""+tmpFile + "\""); |
args.append("-sOutputFile="+tmpFile); |
args.append("-sOutputFile=" + tmpFile); |
args.append("-dFirstPage=" + QString::number(qMax(1, page))); |
args.append("-dLastPage=" + QString::number(qMax(1, page))); |
args.append("-dUseArtBox"); |
// args.append("\""+picFile+"\""); |
args.append(picFile); |
// qDebug() << "scimgdataloader_pdf(alpha):" << args; |
int retg = callGS(args); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.cpp |
---|
42,22 → 42,7 |
#include "util_formats.h" |
#include "util_math.h" |
ScImgDataLoader_PICT::ScImgDataLoader_PICT() : |
m_baseX(0), |
m_baseY(0), |
m_docWidth(0), |
m_docHeight(0), |
m_resX(0.0), |
m_resY(0.0), |
m_LineW(0.0), |
m_patternMode(false), |
m_currentTextSize(0), |
m_currentFontID(0), |
m_currentFontStyle(0), |
m_postscriptMode(false), |
m_textIsPostScript(false), |
m_pctVersion(0), |
m_skipOpcode(false) |
ScImgDataLoader_PICT::ScImgDataLoader_PICT() |
{ |
initSupportedFormatList(); |
} |
178,7 → 163,7 |
m_backColor = Qt::white; |
m_foreColor = Qt::black; |
m_Coords = QPainterPath(); |
m_LineW = 1.0; |
m_lineW = 1.0; |
m_currentPoint = QPoint(0, 0); |
m_currentPointT = QPoint(0, 0); |
m_ovalSize = QPoint(0, 0); |
768,7 → 753,7 |
redC = qRound((Rc / 65535.0) * 255.0); |
greenC = qRound((Gc / 65535.0) * 255.0); |
blueC = qRound((Bc / 65535.0) * 255.0); |
QColor c = QColor(redC, greenC, blueC); |
QColor c(redC, greenC, blueC); |
if (back) |
m_backColor = c; |
else |
783,7 → 768,7 |
redC = qRound((Rc / 65535.0) * 255.0); |
greenC = qRound((Gc / 65535.0) * 255.0); |
blueC = qRound((Bc / 65535.0) * 255.0); |
QColor c = QColor(redC, greenC, blueC); |
QColor c(redC, greenC, blueC); |
if (back) |
m_backColor = c; |
else |
828,7 → 813,7 |
m_Coords.lineTo(x, y); |
} |
if (opCode == 0x0070) |
m_imagePainter.strokePath(m_Coords, QPen(m_foreColor, m_LineW)); |
m_imagePainter.strokePath(m_Coords, QPen(m_foreColor, m_lineW)); |
else if (opCode == 0x0071) |
m_imagePainter.fillPath(m_Coords, fillBrush); |
else if (opCode == 0x0072) |
853,7 → 838,7 |
// qDebug() << QString("Handle Rect/Oval 0x%1").arg(opCode, 4, 16, QLatin1Char('0')); |
if (opCode == 0x0030) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRect(bounds); |
} |
877,7 → 862,7 |
} |
else if (opCode == 0x0040) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
901,7 → 886,7 |
} |
else if (opCode == 0x0050) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
942,7 → 927,7 |
fillBrush = QBrush(m_foreColor); |
if (opCode == 0x0038) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRect(bounds); |
} |
966,7 → 951,7 |
} |
else if (opCode == 0x0048) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawRoundedRect(bounds, m_ovalSize.x(), m_ovalSize.y()); |
} |
990,7 → 975,7 |
} |
else if (opCode == 0x0058) |
{ |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.setBrush(Qt::NoBrush); |
m_imagePainter.drawEllipse(bounds); |
} |
1226,7 → 1211,7 |
// qDebug() << "Handle Pen Size"; |
quint16 x, y; |
ts >> y >> x; |
m_LineW = qMax(x, y); |
m_lineW = qMax(x, y); |
} |
void ScImgDataLoader_PICT::handleOvalSize(QDataStream &ts) |
1243,7 → 1228,7 |
qint8 dh, dv; |
ts >> y >> x; |
ts >> dh >> dv; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.drawLine(x, y, x + dh, y + dv); |
m_currentPoint = QPoint(x+dh, y+dv); |
// qDebug() << "Handle Short Line" << x << y << "+" << dh << dv << "->" << currentPoint; |
1256,7 → 1241,7 |
if ((dh == 0) && (dv == 0)) |
return; |
QPoint s = m_currentPoint; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.drawLine(s.x(), s.y(), s.x() + dh, s.y() + dv); |
m_currentPoint = QPoint(s.x()+dh, s.y()+dv); |
// qDebug() << "Handle Short Line from" << dh << dv << "->" << currentPoint; |
1267,7 → 1252,7 |
qint16 x1, x2, y1, y2; |
ts >> y1 >> x1; |
ts >> y2 >> x2; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.drawLine(x1, y1, x2, y2); |
m_currentPoint = QPoint(x2, y2); |
// qDebug() << "Handle Line" << x1 << y1 << "->" << currentPoint; |
1280,7 → 1265,7 |
if ((x == 0) && (y == 0)) |
return; |
QPoint s = m_currentPoint; |
m_imagePainter.setPen(QPen(m_foreColor, m_LineW)); |
m_imagePainter.setPen(QPen(m_foreColor, m_lineW)); |
m_imagePainter.drawLine(s.x(), s.y(), x, y); |
m_currentPoint = QPoint(x, y); |
// qDebug() << "Handle Line from" << s << "->" << currentPoint; |
1699,7 → 1684,7 |
QByteArray ScImgDataLoader_PICT::decodeRLE(QByteArray &in, quint16 bytesPerLine, int multByte) |
{ |
QByteArray ret = QByteArray(bytesPerLine, ' '); |
QByteArray ret(bytesPerLine, ' '); |
uchar *ptrOut, *ptrIn; |
ptrOut = (uchar*)ret.data(); |
ptrIn = (uchar*)in.data(); |
1771,7 → 1756,7 |
QBrush ScImgDataLoader_PICT::setFillPattern() |
{ |
QImage image = QImage(8, 8, QImage::Format_Mono); |
QImage image(8, 8, QImage::Format_Mono); |
QVector<QRgb> colors; |
colors.append(m_backColor.rgb()); |
colors.append(m_foreColor.rgb()); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_pict.h |
---|
64,15 → 64,17 |
QByteArray decodeRLE(QByteArray &in, quint16 bytesPerLine, int multByte); |
QBrush setFillPattern(); |
int m_baseX, m_baseY; |
int m_docWidth; |
int m_docHeight; |
double m_resX, m_resY; |
int m_baseX { 0 }; |
int m_baseY { 0 }; |
int m_docWidth { 0 }; |
int m_docHeight { 0 }; |
double m_resX { 0.0 }; |
double m_resY { 0.0 }; |
double m_LineW; |
double m_lineW { 0.0 }; |
QColor m_backColor; |
QColor m_foreColor; |
bool m_patternMode; |
bool m_patternMode { false }; |
QByteArray m_patternData; |
QRect m_currRect; |
QBrush m_currPatternBrush; |
79,9 → 81,9 |
QRect m_lastImageRect; |
QPoint m_ovalSize; |
QMap<int, QString> m_fontMap; |
int m_currentTextSize; |
int m_currentFontID; |
int m_currentFontStyle; |
int m_currentTextSize { 0 }; |
int m_currentFontID { 0 }; |
int m_currentFontStyle { 0 }; |
QByteArray m_imageData; |
QPainterPath m_Coords; |
88,10 → 90,10 |
QPoint m_currentPoint; |
QPoint m_currentPointT; |
QPainter m_imagePainter; |
bool m_postscriptMode; |
bool m_textIsPostScript; |
int m_pctVersion; |
bool m_skipOpcode; |
bool m_postscriptMode { false }; |
bool m_textIsPostScript { false }; |
int m_pctVersion { 0 }; |
bool m_skipOpcode { false }; |
}; |
#endif |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp |
---|
40,24 → 40,7 |
#endif |
} |
ScImgDataLoader_PS::ScImgDataLoader_PS() : |
m_isDCS1(false), |
m_isDCS2(false), |
m_isDCS2multi(false), |
m_isPhotoshop(false), |
m_hasPhotoshopImageData(false), |
m_doThumbnail(false), |
m_hasThumbnail(false), |
m_inTrailer(false), |
m_BBoxInTrailer(false), |
m_isRotated(false), |
m_psXSize(0), |
m_psYSize(0), |
m_psDepth(0), |
m_psMode(0), |
m_psChannel(0), |
m_psBlock(0), |
m_psDataType(0) |
ScImgDataLoader_PS::ScImgDataLoader_PS() |
{ |
initSupportedFormatList(); |
} |
468,7 → 451,7 |
break; |
} |
} |
if ((psFound) && (!isAtend)) |
if (psFound && !isAtend) |
break; |
} |
} |
483,15 → 466,18 |
double b = 0; |
double h = 0; |
bool found = false; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
if (!fi.exists()) |
return false; |
QString ext = fi.suffix().toLower(); |
if (ext.isEmpty()) |
ext = getImageType(fn); |
QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + QString("sc%1.png").arg(qMax(1, page))); |
QString tmpFiles = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc%d.png"); |
QString picFile = QDir::toNativeSeparators(fn); |
float xres = gsRes; |
float yres = gsRes; |
538,7 → 524,7 |
m_imageInfoRecord.exifInfo.width = qRound(b); |
m_imageInfoRecord.exifInfo.height = qRound(h); |
m_image = m_imageInfoRecord.exifInfo.thumbnail; |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
if (m_isPhotoshop && m_hasPhotoshopImageData) |
{ |
m_imageInfoRecord.exifInfo.width = m_psXSize; |
m_imageInfoRecord.exifInfo.height = m_psYSize; |
577,7 → 563,7 |
loadDCS1(fn, gsRes); |
else if (m_isDCS2) |
loadDCS2(fn, gsRes); |
else if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
else if (m_isPhotoshop && m_hasPhotoshopImageData) |
loadPhotoshop(fn, gsRes); |
else if ((!m_imageInfoRecord.isEmbedded) || ((m_imageInfoRecord.isEmbedded) && (m_profileComponents == 3))) |
{ |
599,7 → 585,7 |
if (retg == 0) |
{ |
m_image.load(tmpFile); |
if ((extensionIndicatesEPS(ext) && m_BBoxInTrailer) || (m_isRotated)) |
if ((extensionIndicatesEPS(ext) && m_BBoxInTrailer) || m_isRotated) |
{ |
int ex = qRound(x * gsRes / 72.0); |
int ey = qRound(m_image.height() - h); |
607,12 → 593,12 |
int eh = qRound(h - y * gsRes / 72.0); |
m_image = m_image.copy(ex, ey, ew, eh); |
} |
if ((!ScCore->havePNGAlpha()) || (m_isRotated)) |
if (!ScCore->havePNGAlpha() || m_isRotated) |
{ |
int wi = m_image.width(); |
int hi = m_image.height(); |
QRgb alphaFF = qRgba(255,255,255,255); |
QRgb alpha00 = qRgba(255,255,255, 0); |
QRgb alphaFF = qRgba(255, 255, 255, 255); |
QRgb alpha00 = qRgba(255, 255, 255, 0); |
QRgb *s; |
for (int yi = 0; yi < hi; ++yi) |
{ |
626,7 → 612,7 |
} |
} |
QStringList files = QStringList("sc*.png"); |
QStringList files("sc*.png"); |
files = QDir(ScPaths::tempFileDir()).entryList(files); |
for (int i=0; i < files.count(); ++i) |
QFile::remove(QDir::toNativeSeparators(ScPaths::tempFileDir() + files[i])); |
705,7 → 691,7 |
f.close(); |
} |
QStringList files = QStringList("sc*.png"); |
QStringList files("sc*.png"); |
files = QDir(ScPaths::tempFileDir()).entryList(files); |
for (int i=0; i < files.count(); ++i) |
QFile::remove(QDir::toNativeSeparators(ScPaths::tempFileDir() + files[i])); |
747,7 → 733,7 |
return; |
} |
QStringList args; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
QString ext = fi.suffix().toLower(); |
QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc1.png"); |
int retg; |
1447,7 → 1433,7 |
ts2 >> x >> y >> b >> h; |
xres = gsRes; |
yres = gsRes; |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
if (m_isPhotoshop && m_hasPhotoshopImageData) |
{ |
m_image = QImage(m_psXSize, m_psYSize, QImage::Format_ARGB32); |
xres = m_psXSize / b * 72.0; |
1473,7 → 1459,7 |
f2.write(imgc.data(), it.value().len); |
f2.close(); |
imgc.resize(0); |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
if (m_isPhotoshop && m_hasPhotoshopImageData) |
{ |
QImage tmpImg; |
loadPhotoshopBinary(tmpFile2, tmpImg); |
1502,7 → 1488,7 |
for (QMap<QString, QString>::Iterator it = m_colorPlates.begin(); it != m_colorPlates.end(); ++it) |
{ |
tmpFile2 = QDir::toNativeSeparators(baseFile+"/"+it.value()); |
if ((m_isPhotoshop) && (m_hasPhotoshopImageData)) |
if (m_isPhotoshop && m_hasPhotoshopImageData) |
{ |
QImage tmpImg; |
loadPhotoshopBinary(tmpFile2, tmpImg); |
1549,7 → 1535,7 |
{ |
QStringList args; |
double x, y, b, h; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
QString ext = fi.suffix().toLower(); |
QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc1.png"); |
QString baseFile = fi.absolutePath(); |
1646,7 → 1632,7 |
m_pixelFormat = Format_YMCK_8; |
} |
void ScImgDataLoader_PS::blendImages(QImage &source, ScColor col) |
void ScImgDataLoader_PS::blendImages(QImage &source, const ScColor& col) |
{ |
int h = source.height(); |
int w = source.width(); |
1682,7 → 1668,7 |
initialize(); |
hasAlpha = false; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
if (!fi.exists()) |
return false; |
QString ext = fi.suffix().toLower(); |
1740,7 → 1726,7 |
} |
} |
QStringList files = QStringList("sc*.png"); |
QStringList files("sc*.png"); |
files = QDir(ScPaths::tempFileDir()).entryList(files); |
for (int i=0; i < files.count(); ++i) |
QFile::remove(QDir::toNativeSeparators(ScPaths::tempFileDir() + files[i])); |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.h |
---|
33,7 → 33,7 |
void loadPhotoshopBinary(const QString& fn, QImage &tmpImg); |
void loadDCS1(const QString& fn, int gsRes); |
void loadDCS2(const QString& fn, int gsRes); |
void blendImages(QImage &source, ScColor col); |
void blendImages(QImage &source, const ScColor& col); |
struct plateOffsets |
{ |
uint pos; |
43,23 → 43,23 |
QMap<QString, QString> m_colorPlates; |
QString m_BBox; |
QString m_Creator; |
bool m_isDCS1; |
bool m_isDCS2; |
bool m_isDCS2multi; |
bool m_isPhotoshop; |
bool m_hasPhotoshopImageData; |
bool m_doThumbnail; |
bool m_hasThumbnail; |
bool m_inTrailer; |
bool m_BBoxInTrailer; |
bool m_isRotated; |
int m_psXSize; |
int m_psYSize; |
int m_psDepth; |
int m_psMode; |
int m_psChannel; |
int m_psBlock; |
int m_psDataType; |
bool m_isDCS1 { false }; |
bool m_isDCS2 { false }; |
bool m_isDCS2multi { false }; |
bool m_isPhotoshop { false }; |
bool m_hasPhotoshopImageData { false }; |
bool m_doThumbnail { false }; |
bool m_hasThumbnail { false }; |
bool m_inTrailer { false }; |
bool m_BBoxInTrailer { false }; |
bool m_isRotated { false }; |
int m_psXSize { 0 }; |
int m_psYSize { 0 }; |
int m_psDepth { 0 }; |
int m_psMode { 0 }; |
int m_psChannel { 0 }; |
int m_psBlock { 0 }; |
int m_psDataType { 0 }; |
QString m_psCommand; |
QMap<QString,ScColor> m_CustColors; |
QStringList m_FontListe; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp |
---|
33,7 → 33,6 |
ScImgDataLoader_PSD::ScImgDataLoader_PSD() |
{ |
m_maxChannels = 0; |
initSupportedFormatList(); |
} |
50,7 → 49,7 |
ScColorProfile prof; |
ScColorMgmtEngine engine(ScCore->defaultEngine); |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
if (!fi.exists()) |
return; |
100,7 → 99,7 |
hasAlpha = false; |
m_imageInfoRecord.RequestProps = req; |
m_imageInfoRecord.isRequest = valid; |
QFileInfo fi = QFileInfo(fn); |
QFileInfo fi(fn); |
if (!fi.exists()) |
return false; |
313,7 → 312,7 |
cdataStart = s.device()->pos(); |
if (tmp != 0) |
{ |
if ((header.color_mode == CM_DUOTONE)) |
if (header.color_mode == CM_DUOTONE) |
{ |
short signature; |
short count; |
1035,13 → 1034,13 |
{ |
unsigned char *s; |
unsigned char *d; |
for (int yi=static_cast<int>(startSrcY); yi < qMin(r2_image.height(), r_image.height()); ++yi) |
for (int yi = static_cast<int>(startSrcY); yi < qMin(r2_image.height(), r_image.height()); ++yi) |
{ |
s = r2_image.scanLine( yi ); |
d = r_image.scanLine( qMin(static_cast<int>(startDstY), r_image.height()-1) ); |
d += qMin(static_cast<int>(startDstX), r_image.width()-1) * r_image.channels(); |
s += qMin(static_cast<int>(startSrcX), r2_image.width()-1) * r2_image.channels(); |
for (int xi=static_cast<int>(startSrcX); xi < qMin(r2_image.width(), r_image.width()); ++xi) |
for (int xi = static_cast<int>(startSrcX); xi < qMin(r2_image.width(), r_image.width()); ++xi) |
{ |
d[0] = s[0]; |
d[1] = s[1]; |
1550,13 → 1549,13 |
return ret; |
} |
bool ScImgDataLoader_PSD::IsValid( const PSDHeader & header ) |
bool ScImgDataLoader_PSD::IsValid( const PSDHeader & header ) const |
{ |
return header.signature == 0x38425053; |
} |
// Check that the header is supported. |
bool ScImgDataLoader_PSD::IsSupported( const PSDHeader & header ) |
bool ScImgDataLoader_PSD::IsSupported( const PSDHeader & header ) const |
{ |
if ( header.version != 1 ) |
return false; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.h |
---|
44,8 → 44,8 |
void initSupportedFormatList(); |
bool IsValid( const PSDHeader & header ); |
bool IsSupported( const PSDHeader & header ); |
bool IsValid( const PSDHeader & header ) const; |
bool IsSupported( const PSDHeader & header ) const; |
bool LoadPSD( QDataStream & s, const PSDHeader & header); |
bool LoadPSDResources( QDataStream & s, const PSDHeader & header, uint dataOffset ); |
56,7 → 56,8 |
bool parseLayer( QDataStream & s, const PSDHeader & header); |
QString getLayerString(QDataStream & s); |
void putDuotone(uchar *ptr, uchar cbyte); |
int m_maxChannels; |
int m_maxChannels { 0 }; |
QVector<int> m_curveTable1; |
QVector<int> m_curveTable2; |
QVector<int> m_curveTable3; |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp |
---|
17,14 → 17,9 |
#include "scimgdataloader_wpg.h" |
#include "third_party/wpg/WPGStreamImplementation.h" |
ScrPainterIm::ScrPainterIm() : |
fillrule(false), |
gradientAngle(0.0), |
isGradient(false), |
fillSet(false), |
strokeSet(false), |
image(nullptr) |
ScrPainterIm::ScrPainterIm() |
{ |
} |
void ScrPainterIm::startGraphics(double width, double height) |
65,7 → 60,7 |
Qt::PenJoinStyle lineJoin; |
Qt::PenCapStyle lineEnd; |
double LineW = 72 * pen.width; |
QColor foreColor = QColor(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue, 255 - pen.foreColor.alpha); |
QColor foreColor(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue, 255 - pen.foreColor.alpha); |
if(!pen.solid) |
{ |
for (unsigned i = 0; i < pen.dashArray.count(); i++) |
/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.h |
---|
27,31 → 27,31 |
public: |
ScrPainterIm(); |
void startGraphics(double imageWidth, double imageHeight); |
void endGraphics(); |
void startLayer(unsigned int id); |
void endLayer(unsigned int id); |
void setPen(const libwpg::WPGPen& pen); |
void setBrush(const libwpg::WPGBrush& brush); |
void setFillRule(FillRule rule); |
void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); |
void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); |
void drawPolygon(const libwpg::WPGPointArray& vertices, bool closed); |
void drawPath(const libwpg::WPGPath& path); |
void drawBitmap(const libwpg::WPGBitmap& bitmap, double hres, double vres); |
void drawImageObject(const libwpg::WPGBinaryData& binaryData); |
void startGraphics(double imageWidth, double imageHeight) override; |
void endGraphics() override; |
void startLayer(unsigned int id) override; |
void endLayer(unsigned int id) override; |
void setPen(const libwpg::WPGPen& pen) override; |
void setBrush(const libwpg::WPGBrush& brush) override; |
void setFillRule(FillRule rule) override; |
void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) override; |
void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry) override; |
void drawPolygon(const libwpg::WPGPointArray& vertices, bool closed) override; |
void drawPath(const libwpg::WPGPath& path) override; |
void drawBitmap(const libwpg::WPGBitmap& bitmap, double hres, double vres) override; |
void drawImageObject(const libwpg::WPGBinaryData& binaryData) override; |
QPainterPath Coords; |
QPainter imagePainter; |
QPen currentPen; |
QBrush currentBrush; |
bool fillrule; |
double gradientAngle; |
bool isGradient; |
bool fillSet; |
bool strokeSet; |
bool fillrule { false }; |
double gradientAngle { 0.0 }; |
bool isGradient { false }; |
bool fillSet { false }; |
bool strokeSet { false }; |
QLinearGradient currentGradient; |
QImage *image; |
QImage* image { nullptr }; |
}; |
class ScImgDataLoader_WPG : public ScImgDataLoader |
/trunk/Scribus/scribus/pagesize.cpp |
---|
36,12 → 36,11 |
} |
PageSize::PageSize(const double w, const double h) |
: m_width(w), |
m_height(h) |
{ |
m_width=w; |
m_height=h; |
m_pageUnitIndex=-1; |
m_pageSizeName=CommonStrings::customPageSize; |
m_trPageSizeName=CommonStrings::trCustomPageSize; |
m_pageSizeName = CommonStrings::customPageSize; |
m_trPageSizeName = CommonStrings::trCustomPageSize; |
} |
PageSize& PageSize::operator=(const PageSize& other) |
52,8 → 51,9 |
void PageSize::init(const QString& sizeName) |
{ |
m_width=m_height=0.0; |
m_pageUnitIndex=-1; |
m_width = 0.0; |
m_height = 0.0; |
m_pageUnitIndex = -1; |
m_pageSizeName.clear(); |
m_trPageSizeName.clear(); |
63,26 → 63,26 |
if (m_pageSizeList.contains(sizeName)) |
{ |
PageSizeInfoMap::Iterator it = m_pageSizeList.find(sizeName); |
m_pageSizeName=it.key(); |
m_width=it.value().width; |
m_height=it.value().height; |
m_pageUnitIndex=it.value().pageUnitIndex; |
m_trPageSizeName=it.value().trSizeName; |
m_pageSizeName = it.key(); |
m_width = it.value().width; |
m_height = it.value().height; |
m_pageUnitIndex = it.value().pageUnitIndex; |
m_trPageSizeName = it.value().trSizeName; |
valuesSet=true; |
} |
else //build based on translated value. |
{ |
PageSizeInfoMap::Iterator it; |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end() && !valuesSet;++it) |
for (it = m_pageSizeList.begin(); it != m_pageSizeList.end() && !valuesSet; ++it) |
{ |
if (sizeName==it.value().trSizeName) |
if (sizeName == it.value().trSizeName) |
{ |
m_pageSizeName=it.key(); |
m_width=it.value().width; |
m_height=it.value().height; |
m_pageUnitIndex=it.value().pageUnitIndex; |
m_trPageSizeName=it.value().trSizeName; |
valuesSet=true; |
m_pageSizeName = it.key(); |
m_width = it.value().width; |
m_height = it.value().height; |
m_pageUnitIndex = it.value().pageUnitIndex; |
m_trPageSizeName = it.value().trSizeName; |
valuesSet = true; |
} |
} |
} |
90,10 → 90,11 |
if (!valuesSet) |
{ |
//qDebug("Non-existent page size selected"); |
m_width=m_height=0.0; |
m_pageUnitIndex=-1; |
m_pageSizeName=CommonStrings::customPageSize; |
m_trPageSizeName=CommonStrings::trCustomPageSize; |
m_width = 0.0; |
m_height = 0.0; |
m_pageUnitIndex = -1; |
m_pageSizeName = CommonStrings::customPageSize; |
m_trPageSizeName = CommonStrings::trCustomPageSize; |
} |
} |
100,9 → 101,7 |
QStringList PageSize::sizeList() const |
{ |
QStringList pageSizes; |
pageSizes.clear(); |
PageSizeInfoMap::ConstIterator it; |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it) |
pageSizes.append(it.key()); |
return QStringList(pageSizes); |
} |
110,9 → 109,7 |
QStringList PageSize::sizeTRList() const |
{ |
QStringList pageSizes; |
pageSizes.clear(); |
PageSizeInfoMap::ConstIterator it; |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it) |
pageSizes.append(it.value().trSizeName); |
return QStringList(pageSizes); |
} |
120,7 → 117,7 |
QStringList PageSize::activeSizeList() const |
{ |
QStringList pageSizes=sizeList(); |
if (PrefsManager::instance().appPrefs.activePageSizes.count()==0) |
if (PrefsManager::instance().appPrefs.activePageSizes.count() == 0) |
return QStringList(pageSizes); |
QStringList activePageSizes(PrefsManager::instance().appPrefs.activePageSizes); |
QStringList activeSizes; |
136,14 → 133,14 |
{ |
QStringList pageTRSizes=sizeTRList(); |
QStringList pageSizes=sizeList(); |
if (PrefsManager::instance().appPrefs.activePageSizes.count()==0) |
if (PrefsManager::instance().appPrefs.activePageSizes.count() == 0) |
return QStringList(pageTRSizes); |
QStringList activePageSizes(PrefsManager::instance().appPrefs.activePageSizes); |
QStringList activeTRSizes; |
for (int i = 0; i < activePageSizes.size(); ++i) |
{ |
int j=pageSizes.indexOf(activePageSizes.at(i)); |
if (j!=-1) |
int j = pageSizes.indexOf(activePageSizes.at(i)); |
if (j != -1) |
{ |
activeTRSizes << pageTRSizes.at(j); |
} |
294,11 → 291,11 |
double height = 1120; |
for (format = 0; format <= 10; format++) |
{ |
info.width=mm2pts(width); |
info.height=mm2pts(height); |
info.pageUnitIndex=SC_MM; |
info.width = mm2pts(width); |
info.height = mm2pts(height); |
info.pageUnitIndex = SC_MM; |
name=QString("PA%1").arg(format); |
info.trSizeName=name; |
info.trSizeName = name; |
m_pageSizeList.insert(name, info); |
tmp = height; |
height = width; |
321,54 → 318,54 |
for (uint i = 0; i < num_mappings_widths; ++i) |
{ |
info.width=in2pts(impWidths[i]); |
info.height=in2pts(impHeights[i]); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=impTrNames[i]; |
info.width = in2pts(impWidths[i]); |
info.height = in2pts(impHeights[i]); |
info.pageUnitIndex = SC_IN; |
info.trSizeName = impTrNames[i]; |
m_pageSizeList.insert(impNames[i], info); |
} |
//Comm10E |
info.width=in2pts(4.125); |
info.height=in2pts(9.5); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=QObject::tr("Comm10E"); |
info.width = in2pts(4.125); |
info.height = in2pts(9.5); |
info.pageUnitIndex = SC_IN; |
info.trSizeName = QObject::tr("Comm10E"); |
m_pageSizeList.insert("Comm10E", info); |
//DLE |
info.width=mm2pts(110); |
info.height=mm2pts(220); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("DLE"); |
info.width = mm2pts(110); |
info.height = mm2pts(220); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("DLE"); |
m_pageSizeList.insert("DLE", info); |
// additional page sizes used by Viva Designer |
//Compact Disc |
info.width=mm2pts(119.9); |
info.height=mm2pts(120.7); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("Compact Disc"); |
info.width = mm2pts(119.9); |
info.height = mm2pts(120.7); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("Compact Disc"); |
m_pageSizeList.insert("Compact Disc", info); |
//Letter Half |
info.width=mm2pts(139.7); |
info.height=mm2pts(215.9); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("Letter Half"); |
info.width = mm2pts(139.7); |
info.height = mm2pts(215.9); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("Letter Half"); |
m_pageSizeList.insert("Letter Half", info); |
//US Letter |
info.width=mm2pts(215.9); |
info.height=mm2pts(279.4); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("US Letter"); |
info.width = mm2pts(215.9); |
info.height = mm2pts(279.4); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("US Letter"); |
m_pageSizeList.insert("US Letter", info); |
//US Legal |
info.width=mm2pts(215.9); |
info.height=mm2pts(355.6); |
info.pageUnitIndex=SC_MM; |
info.trSizeName=QObject::tr("US Legal"); |
info.width = mm2pts(215.9); |
info.height = mm2pts(355.6); |
info.pageUnitIndex = SC_MM; |
info.trSizeName = QObject::tr("US Legal"); |
m_pageSizeList.insert("US Legal", info); |
//11x17 |
info.width=in2pts(11); |
info.height=in2pts(17); |
info.pageUnitIndex=SC_IN; |
info.trSizeName=QObject::tr("11x17"); |
info.width = in2pts(11); |
info.height = in2pts(17); |
info.pageUnitIndex = SC_IN; |
info.trSizeName = QObject::tr("11x17"); |
m_pageSizeList.insert("11x17", info); |
// Arch A 9 × 12 |
428,10 → 425,14 |
//Tabloid |
} |
void PageSize::printSizeList() |
void PageSize::printSizeList() const |
{ |
PageSizeInfoMap::Iterator it; |
for (it=m_pageSizeList.begin();it!=m_pageSizeList.end();++it) |
std::cout << it.key().leftJustified(6).toStdString() << ": " << it.value().width << " x " << it.value().height << ", " << it.value().width*unitGetRatioFromIndex(it.value().pageUnitIndex) << " x " << it.value().height*unitGetRatioFromIndex(it.value().pageUnitIndex) << ", " << it.value().trSizeName.toStdString() << std::endl; |
for (auto it = m_pageSizeList.begin(); it != m_pageSizeList.end(); ++it) |
{ |
std::cout << it.key().leftJustified(6).toStdString() << ": "; |
std::cout << it.value().width << " x " << it.value().height << ", "; |
std::cout << it.value().width * unitGetRatioFromIndex(it.value().pageUnitIndex) << " x " << it.value().height * unitGetRatioFromIndex(it.value().pageUnitIndex) << ", "; |
std::cout << it.value().trSizeName.toStdString() << std::endl; |
} |
} |
/trunk/Scribus/scribus/pagesize.h |
---|
48,8 → 48,8 |
QString nameTR() const { return m_trPageSizeName; } |
double width() const { return m_width; } |
double height() const { return m_height; } |
double originalWidth() const { return m_width*unitGetRatioFromIndex(m_pageUnitIndex); } |
double originalHeight() const { return m_height*unitGetRatioFromIndex(m_pageUnitIndex); } |
double originalWidth() const { return m_width * unitGetRatioFromIndex(m_pageUnitIndex); } |
double originalHeight() const { return m_height * unitGetRatioFromIndex(m_pageUnitIndex); } |
QString originalUnit() const { return unitGetSuffixFromIndex(m_pageUnitIndex); } |
QStringList sizeList() const; |
QStringList sizeTRList() const; |
56,14 → 56,14 |
QStringList activeSizeList() const; |
QStringList activeSizeTRList() const; |
void generateSizeList(); |
void printSizeList(); |
void printSizeList() const; |
QStringList untransPageSizeList(const QStringList &transList); |
private: |
PageSizeInfoMap m_pageSizeList; |
double m_width; |
double m_height; |
int m_pageUnitIndex; |
double m_width { 0.0 }; |
double m_height { 0.0 }; |
int m_pageUnitIndex { -1 }; |
QString m_pageSizeName; |
QString m_trPageSizeName; |
}; |