Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 2011 → Rev 2012

/branches/Version13x/Scribus/scribus/scimage.h
46,6 → 46,7
ScImage(QImage image);
ScImage( int width, int height );
~ScImage() {};
void initialize();
QString ImageToTxt();
QString ImageToCMYK();
QString ImageToGray();
54,6 → 55,8
void Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray);
QString MaskToTxt(bool PDF = true);
QString MaskToTxt14();
void swapRGBA();
void createHalfRes();
void scaleImage(int width, int height);
bool LoadPicture(QString fn, QString Prof, int rend, bool useEmbedded, bool useProf, int requestType, int gsRes, bool *realCMYK = 0);
QString getAlpha(QString fn, bool PDF, bool pdf14);
113,6 → 116,9
bool valid;
bool isRequest;
bool progressive;
bool isHalfRes;
double pathXoffset;
double pathYoffset;
QMap<QString, FPointArray> PDSpathData;
QMap<int, LoadRequest> RequestProps;
QString clipPath;
140,5 → 146,7
bool marker_is_icc (jpeg_saved_marker_ptr marker);
bool marker_is_photoshop (jpeg_saved_marker_ptr marker);
bool read_jpeg_marker (UINT8 requestmarker, j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned int *icc_data_len);
char* iccbuf;
uint icclen;
};
#endif
/branches/Version13x/Scribus/scribus/tabtools.h
86,6 → 86,7
LinkButton* chainButton;
QButtonGroup* buttonGroup5;
QCheckBox* checkRatioImage;
QCheckBox* checkHalfRes;
QWidget* subTabPolygon;
PolygonWidget* polyWidget;
QWidget* subTabZoom;
/branches/Version13x/Scribus/scribus/util.cpp
729,7 → 729,7
break;
}
}
if (countUniCode == face->num_glyphs-1)
if (countUniCode >= face->num_glyphs-1)
{
FT_Set_Charmap(face, face->charmaps[chmapUniCode]);
retVal = 0;
/branches/Version13x/Scribus/scribus/prefs.cpp
140,10 → 140,14
ProPfad = new QLineEdit( GroupBox200, "Datei1" );
ProPfad->setMinimumSize( QSize( 268, 22 ) );
ProPfad->setText(prefsData->ProfileDir);
if (ScApp->HaveDoc)
ProPfad->setEnabled(false);
PfadText2 = new QLabel( ProPfad, tr("&ICC Profiles:"), GroupBox200, "Pfadtext1" );
FileC2 = new QToolButton( GroupBox200, "FileC1" );
FileC2->setMinimumSize( QSize( 88, 24 ) );
FileC2->setText( tr( "C&hange..." ) );
if (ScApp->HaveDoc)
FileC2->setEnabled(false);
GroupBox200Layout->addWidget( PfadText2, 1, 0 );
GroupBox200Layout->addWidget( ProPfad, 1, 1 );
GroupBox200Layout->addWidget( FileC2, 1, 2 );
/branches/Version13x/Scribus/scribus/about.cpp
51,7 → 51,7
tabLayout1->addWidget( pixmapLabel1 );
buildID = new QLabel( tab, "BB" );
buildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1 %2 %3 ").arg("24").arg("April").arg("2005");
QString bu = tr("%1 %2 %3 ").arg("26").arg("April").arg("2005");
#ifdef HAVE_CMS
bu += "C";
#else
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
97,6 → 97,7
toolSettings.scaleY = prefsData->toolSettings.scaleY;
toolSettings.scaleType = prefsData->toolSettings.scaleType;
toolSettings.aspectRatio = prefsData->toolSettings.aspectRatio;
toolSettings.halfRes = prefsData->toolSettings.halfRes;
toolSettings.dCols = prefsData->toolSettings.dCols;
toolSettings.dGap = prefsData->toolSettings.dGap;
toolSettings.dLineArt = PenStyle(prefsData->toolSettings.dLineArt);
/branches/Version13x/Scribus/scribus/scribusview.h
144,6 → 144,7
QImage PageToPixmap(int Nr, int maxGr);
QImage MPageToPixmap(QString name, int maxGr);
void RecalcPictures(ProfilesL *Pr, QProgressBar *dia = 0);
void RecalcPicturesRes();
void FromHRuler(QMouseEvent *m);
void FromVRuler(QMouseEvent *m);
void SetYGuide(QMouseEvent *m, int oldIndex);
/branches/Version13x/Scribus/scribus/scribusXml.cpp
3093,6 → 3093,7
dc9.setAttribute("POLYS", static_cast<int>(Vor->toolSettings.polyS));
dc9.setAttribute("PSCALE", static_cast<int>(Vor->toolSettings.scaleType));
dc9.setAttribute("PASPECT", static_cast<int>(Vor->toolSettings.aspectRatio));
dc9.setAttribute("HalfRes", static_cast<int>(Vor->toolSettings.halfRes));
dc9.setAttribute("StartArrow", Vor->toolSettings.dStartArrow);
dc9.setAttribute("EndArrow", Vor->toolSettings.dEndArrow);
elem.appendChild(dc9);
3431,6 → 3432,7
Vorein->toolSettings.scaleY = QStodouble(dc.attribute("PICTSCY","1"));
Vorein->toolSettings.scaleType = static_cast<bool>(QStoInt(dc.attribute("PSCALE", "1")));
Vorein->toolSettings.aspectRatio = static_cast<bool>(QStoInt(dc.attribute("PASPECT", "0")));
Vorein->toolSettings.halfRes = static_cast<bool>(QStoInt(dc.attribute("HalfRes", "0")));
Vorein->toolSettings.polyC = QStoInt(dc.attribute("POLYC", "4"));
Vorein->toolSettings.polyF = QStodouble(dc.attribute("POLYF", "0.5"));
Vorein->toolSettings.polyR = QStodouble(dc.attribute("POLYR", "0"));
/branches/Version13x/Scribus/scribus/tabtools.cpp
463,6 → 463,10
subTabImageLayout->addWidget( shadingFillImage, 3, 1, Qt::AlignLeft );
textLabel20b = new QLabel(shadingFillImage, tr( "S&hading:" ), subTabImage, "textLabel20b" );
subTabImageLayout->addWidget( textLabel20b, 3, 0 );
checkHalfRes = new QCheckBox( subTabImage, "checkHalfRes" );
checkHalfRes->setText( tr( "Low Resolution Preview" ) );
checkHalfRes->setChecked(prefsData->halfRes);
subTabImageLayout->addMultiCellWidget( checkHalfRes, 4, 4, 0, 1 );
subStackTools->addWidget( subTabImage, 3 );
 
subTabPolygon = new QWidget( subStackTools, "subTabPolygon" );
/branches/Version13x/Scribus/scribus/scribusstructs.h
377,6 → 377,7
double scaleY;
bool scaleType;
bool aspectRatio;
bool halfRes;
/* Magnifier Tool */
int magMin;
int magMax;
/branches/Version13x/Scribus/scribus/extimageprops.cpp
294,15 → 294,22
QWMatrix cl;
cl.scale(72.0 / currentItem->pixm.imgInfo.xres, 72.0 / currentItem->pixm.imgInfo.yres);
currentItem->PoLine.map(cl);
currentItem->FrameType = 3;
currentItem->Clip = FlattenPath(currentItem->PoLine, currentItem->Segments);
currentItem->ClipEdited = true;
double lx = currentItem->Xpos;
double ly = currentItem->Ypos;
int oldFT = currentItem->FrameType;
currentItem->FrameType = 3;
currentItem->LocalX = 0;
currentItem->LocalY = 0;
viewWidget->AdjustItemSize(currentItem);
viewWidget->MoveItem(lx- currentItem->Xpos, ly - currentItem->Ypos, currentItem, false);
if (oldFT == 3)
{
viewWidget->MoveItem(lx- currentItem->Xpos, ly - currentItem->Ypos, currentItem, false);
}
currentItem->pixm.imgInfo.pathXoffset = currentItem->Xpos - lx;
currentItem->pixm.imgInfo.pathYoffset = currentItem->Ypos - ly;
viewWidget->setRedrawBounding(currentItem);
viewWidget->updateContents();
}
 
/branches/Version13x/Scribus/scribus/pageitem.cpp
534,6 → 534,8
}
p->scale(LocalScX, LocalScY);
p->translate(LocalX*LocalScX*sc, LocalY*LocalScY*sc);
if (Doc->toolSettings.halfRes)
p->scale(2, 2);
if (InvPict)
{
QImage ip = pixm.copy();
/branches/Version13x/Scribus/scribus/scribusview.cpp
7534,9 → 7534,9
 
void ScribusView::updatePict(QString name)
{
for (uint a = 0; a < Doc->Items.count(); ++a)
for (uint a = 0; a < Doc->DocItems.count(); ++a)
{
PageItem *currItem = Doc->Items.at(a);
PageItem *currItem = Doc->DocItems.at(a);
if ((currItem->PicAvail) && (currItem->Pfile == name))
{
bool fho = currItem->imageFlippedH();
7564,6 → 7564,38
emit DocChanged();
}
 
void ScribusView::RecalcPicturesRes()
{
for (uint a = 0; a < Doc->DocItems.count(); ++a)
{
PageItem *currItem = Doc->DocItems.at(a);
if (currItem->PicAvail)
{
bool fho = currItem->imageFlippedH();
bool fvo = currItem->imageFlippedV();
LoadPict(currItem->Pfile, currItem->ItemNr, true);
currItem->setImageFlippedH(fho);
currItem->setImageFlippedV(fvo);
AdjustPictScale(currItem);
}
}
for (uint a = 0; a < Doc->MasterItems.count(); ++a)
{
PageItem *currItem = Doc->MasterItems.at(a);
if (currItem->PicAvail)
{
bool fho = currItem->imageFlippedH();
bool fvo = currItem->imageFlippedV();
LoadPict(currItem->Pfile, currItem->ItemNr, true);
currItem->setImageFlippedH(fho);
currItem->setImageFlippedV(fvo);
AdjustPictScale(currItem);
}
}
updateContents();
emit DocChanged();
}
 
void ScribusView::removePict(QString name)
{
for (uint a = 0; a < Doc->DocItems.count(); ++a)
10428,6 → 10460,8
Item->IProfile = "Embedded " + Item->pixm.imgInfo.profileName;
Item->EmProfile = "Embedded " + Item->pixm.imgInfo.profileName;
}
if (Doc->toolSettings.halfRes)
Item->pixm.createHalfRes();
if (!Doc->loading)
{
emit RasterPic(Item->isRaster);
/branches/Version13x/Scribus/scribus/scimage.cpp
52,36 → 52,21
 
ScImage::ScImage(QImage image) : QImage(image)
{
imgInfo.xres = 72;
imgInfo.yres = 72;
imgInfo.colorspace = 0;
imgInfo.valid = false;
imgInfo.isRequest = false;
imgInfo.progressive = false;
imgInfo.PDSpathData.clear();
imgInfo.RequestProps.clear();
imgInfo.clipPath = "";
imgInfo.usedPath = "";
imgInfo.layerInfo.clear();
initialize();
}
 
ScImage::ScImage() : QImage()
{
imgInfo.xres = 72;
imgInfo.yres = 72;
imgInfo.colorspace = 0;
imgInfo.valid = false;
imgInfo.isRequest = false;
imgInfo.progressive = false;
imgInfo.PDSpathData.clear();
imgInfo.RequestProps.clear();
imgInfo.clipPath = "";
imgInfo.usedPath = "";
imgInfo.layerInfo.clear();
initialize();
}
 
ScImage::ScImage( int width, int height ) : QImage( width, height, 32 )
{
initialize();
}
 
void ScImage::initialize()
{
imgInfo.xres = 72;
imgInfo.yres = 72;
imgInfo.colorspace = 0;
88,13 → 73,54
imgInfo.valid = false;
imgInfo.isRequest = false;
imgInfo.progressive = false;
imgInfo.isHalfRes = false;
imgInfo.PDSpathData.clear();
imgInfo.RequestProps.clear();
imgInfo.clipPath = "";
imgInfo.usedPath = "";
imgInfo.layerInfo.clear();
imgInfo.pathXoffset = 0.0;
imgInfo.pathYoffset = 0.0;
}
 
void ScImage::swapRGBA()
{
for (int i = 0; i < height(); ++i)
{
unsigned int *ptr = (unsigned int *) scanLine(i);
unsigned char r, b;
for (int j = 0; j < width(); ++j)
{
unsigned char *p = (unsigned char *) ptr;
r = p[0];
b = p[2];
p[2] = r;
p[0] = b;
ptr++;
}
}
}
 
void ScImage::createHalfRes()
{
int w = width() / 2;
int h = height() / 2;
QImage tmp = smoothScale(w, h);
create(w, h, 32);
for( int yi=0; yi < tmp.height(); ++yi )
{
QRgb *s = (QRgb*)(tmp.scanLine( yi ));
QRgb *d = (QRgb*)(scanLine( yi ));
for(int xi=0; xi < tmp.width(); ++xi )
{
(*d) = (*s);
s++;
d++;
}
}
imgInfo.isHalfRes = true;
}
 
void ScImage::Convert2JPG(QString fn, int Quality, bool isCMYK, bool isGray)
{
struct jpeg_compress_struct cinfo;
1332,6 → 1358,14
imgInfo.xres = qRound(hRes / 65536.0);
imgInfo.yres = qRound(vRes / 65536.0);
break;
case 0x040f:
{
icclen = resSize;
char* buffer = (char*)malloc(resSize);
iccbuf = buffer;
s.readRawBytes(buffer, resSize);
}
break;
default:
break;
}
2213,7 → 2247,7
bilevel = true;
}
}
*this = static_cast<ScImage>(swapRGB());
swapRGBA();
#ifdef HAVE_CMS
DWORD EmbedLen = 0;
LPBYTE EmbedBuffer;
2223,15 → 2257,33
tiffProf = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
Descriptor = cmsTakeProductDesc(tiffProf);
imgInfo.profileName = QString(Descriptor);
// free(EmbedBuffer);
}
else
imgInfo.profileName = "";
#endif // HAVE_CMS
uint32 ClipLen = 0;
uint8 ClipBuffer;
QString db;
if (TIFFGetField(tif, TIFFTAG_CLIPPATH, &ClipLen, &ClipBuffer))
qDebug("%s", db.setNum(ClipLen).ascii());
DWORD PhotoshopLen = 0;
LPBYTE PhotoshopBuffer;
if (TIFFGetField(tif, TIFFTAG_PHOTOSHOP, &PhotoshopLen, &PhotoshopBuffer) )
{
if (PhotoshopLen != 0)
{
QByteArray arrayPhot(PhotoshopLen);
arrayPhot.duplicate((const char*)PhotoshopBuffer,PhotoshopLen);
QDataStream strPhot(arrayPhot,IO_ReadOnly);
strPhot.setByteOrder( QDataStream::BigEndian );
PSDHeader fakeHeader;
fakeHeader.width = width();
fakeHeader.height = height();
parseRessourceData(strPhot, fakeHeader, PhotoshopLen);
imgInfo.valid = (imgInfo.PDSpathData.size())>0?true:false;
}
}
// uint32 ClipLen = 0;
// uint8 ClipBuffer;
// QString db;
// if (TIFFGetField(tif, TIFFTAG_CLIPPATH, &ClipLen, &ClipBuffer))
// qDebug("%s", db.setNum(ClipLen).ascii());
TIFFClose(tif);
if (resolutionunit == RESUNIT_INCH)
{
2253,6 → 2305,7
imgInfo.colorspace = 2;
else
imgInfo.colorspace = 0;
imgInfo.layerInfo.clear();
}
}
#endif // HAVE_TIFF
2273,8 → 2326,23
// Check if it's a supported format.
if( !IsSupported( header ) )
return ret;
iccbuf = 0;
icclen = 0;
if( !LoadPSD(s, header) )
return ret;
#ifdef HAVE_CMS
if (icclen>0)
{
if (useEmbedded && CMSuse && useProf)
{
tiffProf = cmsOpenProfileFromMem(iccbuf, icclen);
const char *Descriptor;
Descriptor = cmsTakeProductDesc(tiffProf);
imgInfo.profileName = QString(Descriptor);
}
free(iccbuf);
}
#endif // HAVE_CMS
if (header.color_mode == CM_CMYK)
isCMYK = true;
else
2329,10 → 2397,10
tiffProf = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen);
Descriptor = cmsTakeProductDesc(tiffProf);
imgInfo.profileName = QString(Descriptor);
free(EmbedBuffer);
}
else
imgInfo.profileName = "";
free(EmbedBuffer);
#endif // HAVE_CMS
DWORD PhotoshopLen = 0;
LPBYTE PhotoshopBuffer;
2369,30 → 2437,30
 
if (read_jpeg_marker(PHOTOSHOP_MARKER,&cinfo, &PhotoshopBuffer, &PhotoshopLen) )
{
if (PhotoshopLen != 0)
{
QByteArray arrayPhot(PhotoshopLen);
arrayPhot.assign((const char*)PhotoshopBuffer,PhotoshopLen);
QDataStream strPhot(arrayPhot,IO_ReadOnly);
strPhot.setByteOrder( QDataStream::BigEndian );
PSDHeader fakeHeader;
fakeHeader.width = cinfo.output_width;
fakeHeader.height = cinfo.output_height;
if (cinfo.output_components == 4)
imgInfo.colorspace = 1;
else if (cinfo.output_components == 3)
imgInfo.colorspace = 0;
else if (cinfo.output_components == 1)
imgInfo.colorspace = 2;
imgInfo.progressive = jpeg_has_multiple_scans(&cinfo);
parseRessourceData(strPhot, fakeHeader, PhotoshopLen);
// Photoshop resolution is more accurate than jpeg header resolution
xres = imgInfo.xres;
yres = imgInfo.yres;
setDotsPerMeterX( int(100. * imgInfo.xres / 2.54) );
setDotsPerMeterY( int(100. * imgInfo.yres / 2.54) );
imgInfo.valid = (imgInfo.PDSpathData.size())>0?true:false; // The only interest is vectormask
}
if (PhotoshopLen != 0)
{
QByteArray arrayPhot(PhotoshopLen);
arrayPhot.assign((const char*)PhotoshopBuffer,PhotoshopLen);
QDataStream strPhot(arrayPhot,IO_ReadOnly);
strPhot.setByteOrder( QDataStream::BigEndian );
PSDHeader fakeHeader;
fakeHeader.width = cinfo.output_width;
fakeHeader.height = cinfo.output_height;
if (cinfo.output_components == 4)
imgInfo.colorspace = 1;
else if (cinfo.output_components == 3)
imgInfo.colorspace = 0;
else if (cinfo.output_components == 1)
imgInfo.colorspace = 2;
imgInfo.progressive = jpeg_has_multiple_scans(&cinfo);
parseRessourceData(strPhot, fakeHeader, PhotoshopLen);
// Photoshop resolution is more accurate than jpeg header resolution
xres = imgInfo.xres;
yres = imgInfo.yres;
setDotsPerMeterX( int(100. * imgInfo.xres / 2.54) );
setDotsPerMeterY( int(100. * imgInfo.yres / 2.54) );
imgInfo.valid = (imgInfo.PDSpathData.size())>0?true:false; // The only interest is vectormask
}
}
if ( cinfo.output_components == 3 || cinfo.output_components == 4)
create( cinfo.output_width, cinfo.output_height, 32 );
2486,6 → 2554,7
(void) jpeg_finish_decompress(&cinfo);
fclose (infile);
jpeg_destroy_decompress (&cinfo);
imgInfo.layerInfo.clear();
}
else
{
/branches/Version13x/Scribus/scribus/scribus.cpp
491,6 → 491,7
Prefs.LeftPageFirst = false;
Prefs.toolSettings.scaleType = true;
Prefs.toolSettings.aspectRatio = true;
Prefs.toolSettings.halfRes = false;
Prefs.MinWordLen = 3;
Prefs.HyCount = 2;
Prefs.Language = "";
3006,6 → 3007,11
doc->toolSettings.scaleY = static_cast<double>(dia->tabTools->scalingVertical->value()) / 100.0;
doc->toolSettings.scaleType = dia->tabTools->buttonGroup3->isChecked();
doc->toolSettings.aspectRatio = dia->tabTools->checkRatioImage->isChecked();
if (doc->toolSettings.halfRes != dia->tabTools->checkHalfRes->isChecked())
{
doc->toolSettings.halfRes = dia->tabTools->checkHalfRes->isChecked();
view->RecalcPicturesRes();
}
dia->tabTools->polyWidget->getValues(&doc->toolSettings.polyC, &doc->toolSettings.polyFd, &doc->toolSettings.polyF, &doc->toolSettings.polyS, &doc->toolSettings.polyR);
doc->ScratchBottom = dia->bottomScratch->value() / doc->unitRatio;
doc->ScratchLeft = dia->leftScratch->value() / doc->unitRatio;
7811,6 → 7817,7
Prefs.toolSettings.scaleY = static_cast<double>(dia->tabTools->scalingVertical->value()) / 100.0;
Prefs.toolSettings.scaleType = dia->tabTools->buttonGroup3->isChecked();
Prefs.toolSettings.aspectRatio = dia->tabTools->checkRatioImage->isChecked();
Prefs.toolSettings.halfRes = dia->tabTools->checkHalfRes->isChecked();
Prefs.AutoSave = dia->ASon->isChecked();
Prefs.AutoSaveTime = dia->ASTime->value() * 60 * 1000;
Prefs.MinWordLen = dia->tabHyphenator->wordLen->value();