Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
ScImgDataLoader_PS Class Reference

#include <scimgdataloader_ps.h>

Inheritance diagram for ScImgDataLoader_PS:
Inheritance graph
[legend]
Collaboration diagram for ScImgDataLoader_PS:
Collaboration graph
[legend]

List of all members.

Classes

struct  plateOffsets

Public Member Functions

 ScImgDataLoader_PS (void)
virtual void preloadAlphaChannel (const QString &fn, int res)
virtual void loadEmbeddedProfile (const QString &fn)
virtual bool loadPicture (const QString &fn, int res, bool thumbnail)
const QStringList & supportedFormats (void) const
bool supportFormat (const QString &fmt)
QImage & image (void)
QByteArray & embeddedProfile (void)
ImageInfoRecordimageInfoRecord (void)
void setRequest (bool valid, QMap< int, ImageLoadRequest > req)
bool issuedErrorMsg (void) const
bool issuedWarningMsg (void) const
const QString & getMessage (void) const
virtual void initialize (void)

Public Attributes

RawImage r_image

Protected Types

enum  MsgType { noMsg = 0, warningMsg = 1, errorMsg = 2 }

Protected Member Functions

void initSupportedFormatList ()
void scanForFonts (QString fn)
bool parseData (QString fn)
void loadPhotoshop (QString fn, int gsRes)
void decodeA85 (QByteArray &psdata, QString tmp)
bool loadPSjpeg (QString fn)
bool loadPSjpeg (QString fn, QImage &tmpImg)
void loadPhotoshopBinary (QString fn)
void loadPhotoshopBinary (QString fn, QImage &tmpImg)
void loadDCS1 (QString fn, int gsRes)
void loadDCS2 (QString fn, int gsRes)
void blendImages (QImage &source, ScColor col)
void swapRGBA (void)
void swapRGBA (QImage *img)
QString getPascalString (QDataStream &s)
void parseRessourceData (QDataStream &s, const PSDHeader &header, uint size)

Protected Attributes

QMap< QString, plateOffsetscolorPlates2
QMap< QString, QString > colorPlates
QString BBox
QString Creator
bool isDCS1
bool isDCS2
bool isDCS2multi
bool isPhotoshop
bool hasPhotoshopImageData
bool doThumbnail
bool hasThumbnail
int psXSize
int psYSize
int psDepth
int psMode
int psChannel
int psBlock
int psDataType
QString psCommand
QMap< QString, ScColor > CustColors
QStringList FontListe
QStringList m_supportedFormats
QImage m_image
ImageInfoRecord m_imageInfoRecord
QByteArray m_embeddedProfile
int m_profileComponents
MsgType m_msgType
QString m_message

Detailed Description

Definition at line 13 of file scimgdataloader_ps.h.


Class Documentation

struct ScImgDataLoader_PS::plateOffsets

Definition at line 29 of file scimgdataloader_ps.h.

Class Members
uint len
uint pos

Member Enumeration Documentation

enum ScImgDataLoader::MsgType [protected, inherited]
Enumerator:
noMsg 
warningMsg 
errorMsg 

Definition at line 31 of file scimgdataloader.h.

                    {
              noMsg = 0,
              warningMsg = 1,
              errorMsg = 2
       } MsgType;

Constructor & Destructor Documentation

Definition at line 33 of file scimgdataloader_ps.cpp.

Here is the call graph for this function:


Member Function Documentation

void ScImgDataLoader_PS::blendImages ( QImage &  source,
ScColor  col 
) [protected]

Definition at line 1564 of file scimgdataloader_ps.cpp.

{
       int h = source.height();
       int w = source.width();
       int cyan, c, m, yc, k, cc, mm, yy, kk;
       col.getCMYK(&c, &m, &yc, &k);
       QRgb *p;
       QRgb *pq;
       for (int y=0; y < h; ++y )
       {
              p = (QRgb *)m_image.scanLine( y );
              pq = (QRgb *)source.scanLine( y );
              for (int x=0; x < w; ++x )
              {
                     cyan = 255 - qRed(*pq);
                     if (cyan != 0)
                     {
                            (c == 0) ? cc = qRed(*p) : cc = QMIN(c * cyan / 255 + qRed(*p), 255);
                            (m == 0) ? mm = qGreen(*p) : mm = QMIN(m * cyan / 255 + qGreen(*p), 255);
                            (yc == 0) ? yy = qBlue(*p) : yy = QMIN(yc * cyan / 255 + qBlue(*p), 255);
                            (k == 0) ? kk = qAlpha(*p) : kk = QMIN(k * cyan / 255 + qAlpha(*p), 255);
                            *p = qRgba(cc, mm, yy, kk);
                     }
                     p++;
                     pq++;
              }
       }
}

Here is the caller graph for this function:

void ScImgDataLoader_PS::decodeA85 ( QByteArray &  psdata,
QString  tmp 
) [protected]

Definition at line 787 of file scimgdataloader_ps.cpp.

{
       uchar byte;
       ushort data;
       unsigned long sum = 0;
    int quintet = 0;
       for (uint c = 0; c < tmp.length(); c++)
       {
              byte = uchar(QChar(tmp.at(c)));
              if (byte >= '!' && byte <= 'u')
              {
                     sum = sum * 85 + ((unsigned long)byte - '!');
                     quintet++;
                     if (quintet == 5)
                     {
                            psdata.resize(psdata.size()+4);
                            data = sum >> 24;
                            psdata[psdata.size()-4] = data;
                            data = (sum >> 16) & 0xFF;
                            psdata[psdata.size()-3] = data;
                            data = (sum >> 8) & 0xFF;
                            psdata[psdata.size()-2] = data;
                            data = sum & 0xFF;
                            psdata[psdata.size()-1] = data;
                            quintet = 0;
                            sum = 0;
              }
              }
              else if (byte == 'z')
              {
                     psdata.resize(psdata.size()+4);
                     psdata[psdata.size()-4] = 0;
                     psdata[psdata.size()-3] = 0;
                     psdata[psdata.size()-2] = 0;
                     psdata[psdata.size()-1] = 0;
              }
              else if (byte == '~')
              {
                     if (quintet)
                     {
                            int i;
                            for (i = 0; i < 5 - quintet; i++)
                                   sum *= 85;
                            if (quintet > 1)
                                   sum += (0xFFFFFF >> ((quintet - 2) * 8));
                            for (i = 0; i < quintet - 1; i++)
                            {
                                   data = (sum >> (24 - 8 * i)) & 0xFF;
                                   psdata.resize(psdata.size()+1);
                                   psdata[psdata.size()-1] = data;
                            }
                            quintet = 0;
                     }
                     break;
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

QByteArray& ScImgDataLoader::embeddedProfile ( void  ) [inline, inherited]

Definition at line 53 of file scimgdataloader.h.

{ return m_embeddedProfile; }
const QString& ScImgDataLoader::getMessage ( void  ) const [inline, inherited]

Definition at line 59 of file scimgdataloader.h.

{ return m_message; }
QString ScImgDataLoader::getPascalString ( QDataStream &  s) [protected, inherited]

Definition at line 36 of file scimgdataloader.cpp.

{
       uchar len, tmp;
       uint adj;
       QString ret = "";
       s >> len;
       if (len == 0)
       {
              s >> tmp;
              return ret;
       }
       for( int i = 0; i < len; i++ )
       {
              s >> tmp;
              ret += QChar(tmp);
       }
       adj = (ret.length()+1) % 2;
       s.device()->at( s.device()->at() + adj );
       return ret;
}

Here is the caller graph for this function:

QImage& ScImgDataLoader::image ( void  ) [inline, inherited]

Definition at line 51 of file scimgdataloader.h.

{ return m_image; }
ImageInfoRecord& ScImgDataLoader::imageInfoRecord ( void  ) [inline, inherited]

Definition at line 54 of file scimgdataloader.h.

{ return m_imageInfoRecord; }
void ScImgDataLoader::initialize ( void  ) [virtual, inherited]

Definition at line 14 of file scimgdataloader.cpp.

{
       m_msgType = noMsg;
       m_message.setLength(0);
       m_image = QImage();
       m_imageInfoRecord.init();
       m_embeddedProfile.resize(0);
       m_profileComponents = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::initSupportedFormatList ( void  ) [protected]

Definition at line 38 of file scimgdataloader_ps.cpp.

{
       m_supportedFormats.clear();
       m_supportedFormats.append( "ps" );
       m_supportedFormats.append( "eps" );
       m_supportedFormats.append( "epsi" );
}

Here is the caller graph for this function:

bool ScImgDataLoader::issuedErrorMsg ( void  ) const [inline, inherited]

Definition at line 57 of file scimgdataloader.h.

{ return (m_msgType == errorMsg); }
bool ScImgDataLoader::issuedWarningMsg ( void  ) const [inline, inherited]

Definition at line 58 of file scimgdataloader.h.

{ return (m_msgType == warningMsg); }
void ScImgDataLoader_PS::loadDCS1 ( QString  fn,
int  gsRes 
) [protected]

Definition at line 1457 of file scimgdataloader_ps.cpp.

{
       QStringList args;
       double x, y, b, h;
       QFileInfo fi = QFileInfo(fn);
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
       QString baseFile = fi.dirPath(true);
       QString picFile;
       float xres = gsRes;
       float yres = gsRes;
       QTextStream ts2(&BBox, IO_ReadOnly);
       ts2 >> x >> y >> b >> h;
       xres = gsRes;
       yres = gsRes;
       m_image.create( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), 32 );
       m_image.fill(qRgba(0, 0, 0, 0));
       if ((ext == "eps") || (ext == "epsi"))
              args.append("-dEPSCrop");
       args.append("-r"+QString::number(gsRes));
       args.append("-sOutputFile="+tmpFile);
       picFile = QDir::convertSeparators(baseFile+"/"+colorPlates["Cyan"]);
       args.append(picFile);
       int retg = callGS(args);
       if (retg == 0)
       {
              QImage tmpImg;
              tmpImg.load(tmpFile);
              blendImages(tmpImg, ScColor(255, 0, 0, 0));
              unlink(tmpFile);
       }
       args.clear();

       if ((ext == "eps") || (ext == "epsi"))
              args.append("-dEPSCrop");
       args.append("-r"+QString::number(gsRes));
       args.append("-sOutputFile="+tmpFile);
       picFile = QDir::convertSeparators(baseFile+"/"+colorPlates["Magenta"]);
       args.append(picFile);
       retg = callGS(args);
       if (retg == 0)
       {
              QImage tmpImg;
              tmpImg.load(tmpFile);
              blendImages(tmpImg, ScColor(0, 255, 0, 0));
              unlink(tmpFile);
       }
       args.clear();

       if ((ext == "eps") || (ext == "epsi"))
              args.append("-dEPSCrop");
       args.append("-r"+QString::number(gsRes));
       args.append("-sOutputFile="+tmpFile);
       picFile = QDir::convertSeparators(baseFile+"/"+colorPlates["Yellow"]);
       args.append(picFile);
       retg = callGS(args);
       if (retg == 0)
       {
              QImage tmpImg;
              tmpImg.load(tmpFile);
              blendImages(tmpImg, ScColor(0, 0, 255, 0));
              unlink(tmpFile);
       }
       args.clear();

       if ((ext == "eps") || (ext == "epsi"))
              args.append("-dEPSCrop");
       args.append("-r"+QString::number(gsRes));
       args.append("-sOutputFile="+tmpFile);
       picFile = QDir::convertSeparators(baseFile+"/"+colorPlates["Black"]);
       args.append(picFile);
       retg = callGS(args);
       if (retg == 0)
       {
              QImage tmpImg;
              tmpImg.load(tmpFile);
              blendImages(tmpImg, ScColor(0, 0, 0, 255));
              unlink(tmpFile);
       }
       args.clear();

       if ((ext == "eps") || (ext == "epsi"))
       {
              m_imageInfoRecord.BBoxX = static_cast<int>(x);
              m_imageInfoRecord.BBoxH = static_cast<int>(h);
              x = x * gsRes / 72.0;
              y = y * gsRes / 72.0;
              b = b * gsRes / 72.0;
              if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
              {
                     int yc = qRound(m_image.height() - y - (h-y));
                     m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
              }
       }
       else
       {
              m_imageInfoRecord.BBoxX = 0;
              m_imageInfoRecord.BBoxH = m_image.height();
       }
       m_imageInfoRecord.xres = qRound(gsRes);
       m_imageInfoRecord.yres = qRound(gsRes);
       m_imageInfoRecord.colorspace = 1;
       m_imageInfoRecord.type = 7;
       m_image.setDotsPerMeterX ((int) (xres / 0.0254));
       m_image.setDotsPerMeterY ((int) (yres / 0.0254));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::loadDCS2 ( QString  fn,
int  gsRes 
) [protected]

Definition at line 1335 of file scimgdataloader_ps.cpp.

{
       QStringList args;
       double x, y, b, h;
       QFileInfo fi = QFileInfo(fn);
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
       QString tmpFile2 = QDir::convertSeparators(ScPaths::getTempFileDir() + "tmp.eps");
       QString baseFile = fi.dirPath(true);
       QString picFile = QDir::convertSeparators(fn);
       float xres = gsRes;
       float yres = gsRes;
       QTextStream ts2(&BBox, IO_ReadOnly);
       ts2 >> x >> y >> b >> h;
       xres = gsRes;
       yres = gsRes;
       if ((isPhotoshop) && (hasPhotoshopImageData))
       {
              m_image.create(psXSize, psYSize, 32);
              xres = psXSize / b * 72.0;
              yres = psYSize / h * 72.0;
       }
       else
              m_image.create( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), 32 );
       m_image.fill(qRgba(0, 0, 0, 0));
       if (!isDCS2multi)
       {
              for (QMap<QString, plateOffsets>::Iterator it = colorPlates2.begin(); it != colorPlates2.end(); ++it)
              {
                     QByteArray imgc(it.data().len);
                     QFile f(picFile);
                     if (f.open(IO_ReadOnly))
                     {
                            f.at(it.data().pos);
                            uint readB = f.readBlock(imgc.data(), it.data().len);
                            readB = 0;
                     }
                     f.close();
                     QFile f2(tmpFile2);
                     if (f2.open(IO_WriteOnly))
                            f2.writeBlock(imgc.data(), it.data().len);
                     f2.close();
                     imgc.resize(0);
                     if ((isPhotoshop) && (hasPhotoshopImageData))
                     {
                            QImage tmpImg;
                            loadPhotoshopBinary(tmpFile2, tmpImg);
                            blendImages(tmpImg, CustColors[it.key()]);
                     }
                     else
                     {
                            args.append("-dEPSCrop");
                            args.append("-r"+QString::number(gsRes));
                            args.append("-sOutputFile="+tmpFile);
                            args.append(tmpFile2);
                            int retg = callGS(args);
                            if (retg == 0)
                            {
                                   QImage tmpImg;
                                   tmpImg.load(tmpFile);
                                   blendImages(tmpImg, CustColors[it.key()]);
                                   unlink(tmpFile);
                            }
                     }
                     unlink(tmpFile2);
              }
       }
       else
       {
              for (QMap<QString, QString>::Iterator it = colorPlates.begin(); it != colorPlates.end(); ++it)
              {
                     tmpFile2 = QDir::convertSeparators(baseFile+"/"+it.data());
                     if ((isPhotoshop) && (hasPhotoshopImageData))
                     {
                            QImage tmpImg;
                            loadPhotoshopBinary(tmpFile2, tmpImg);
                            blendImages(tmpImg, CustColors[it.key()]);
                     }
                     else
                     {
                            args.append("-dEPSCrop");
                            args.append("-r"+QString::number(gsRes));
                            args.append("-sOutputFile="+tmpFile);
                            args.append(tmpFile2);
                            int retg = callGS(args);
                            if (retg == 0)
                            {
                                   QImage tmpImg;
                                   tmpImg.load(tmpFile);
                                   blendImages(tmpImg, CustColors[it.key()]);
                                   unlink(tmpFile);
                            }
                            args.clear();
                     }
              }
       }
       if ((ext == "eps") || (ext == "epsi"))
       {
              m_imageInfoRecord.BBoxX = static_cast<int>(x);
              m_imageInfoRecord.BBoxH = static_cast<int>(h);
              x = x * gsRes / 72.0;
              y = y * gsRes / 72.0;
              b = b * gsRes / 72.0;
              if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
              {
                     int yc = qRound(m_image.height() - y - (h-y));
                     m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
              }
       }
       else
       {
              m_imageInfoRecord.BBoxX = 0;
              m_imageInfoRecord.BBoxH = m_image.height();
       }
       m_imageInfoRecord.xres = qRound(xres);
       m_imageInfoRecord.yres = qRound(yres);
       m_imageInfoRecord.colorspace = 1;
       m_imageInfoRecord.type = 7;
       m_image.setDotsPerMeterX ((int) (xres / 0.0254));
       m_image.setDotsPerMeterY ((int) (yres / 0.0254));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::loadEmbeddedProfile ( const QString &  fn) [virtual]

Implements ScImgDataLoader.

Definition at line 46 of file scimgdataloader_ps.cpp.

{
       QChar tc;
       QString tmp;
       m_embeddedProfile.resize(0);
       m_profileComponents = 0;
       if ( !QFile::exists(fn) )
              return;
       QFile f(fn);
       if (f.open(IO_ReadOnly))
       {
              QTextStream ts(&f);
              while (!ts.atEnd())
              {
                     tmp = ts.readLine();
                     if (tmp.startsWith("%%BeginICCProfile:"))
                     {
                            QByteArray psdata;
                            while (!ts.atEnd())
                            {
                                   tmp = ts.readLine();
                                   for (uint a = 2; a < tmp.length(); a += 2)
                                   {
                                          bool ok;
                                          ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
                                          psdata.resize(psdata.size()+1);
                                          psdata[psdata.size()-1] = data;
                                   }
                                   if (tmp.startsWith("%%EndICCProfile"))
                                   {
                                          cmsHPROFILE prof = cmsOpenProfileFromMem(psdata.data(), psdata.size());
                                          if (prof)
                                          {
                                                 if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
                                                        m_profileComponents = 3;
                                                 if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
                                                        m_profileComponents = 4;
                                                 const char *Descriptor;
                                                 Descriptor = cmsTakeProductDesc(prof);
                                                 m_imageInfoRecord.profileName = QString(Descriptor);
                                                 m_imageInfoRecord.isEmbedded = true;
                                                 m_embeddedProfile.duplicate((const char*)psdata.data(), psdata.size());
                                          }
                                          cmsCloseProfile(prof);
                                          break;
                                   }
                            }
                     }
              }
       }
}
void ScImgDataLoader_PS::loadPhotoshop ( QString  fn,
int  gsRes 
) [protected]

Definition at line 672 of file scimgdataloader_ps.cpp.

{
       if ((psDataType >= 1) && (psDataType <= 6) && ((psMode == 3) || (psMode == 4)))
       {
              loadPhotoshopBinary(fn);
              return;
       }
       QStringList args;
       double x, y, b, h;
       QFileInfo fi = QFileInfo(fn);
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
       int retg;
       int GsMajor;
       int GsMinor;
       getNumericGSVersion(GsMajor, GsMinor);
       QTextStream ts2(&BBox, IO_ReadOnly);
       ts2 >> x >> y >> b >> h;
       h = h * gsRes / 72.0;
       if ((ext == "eps") || (ext == "epsi"))
              args.append("-dEPSCrop");
       if (psMode == 4)
              args.append("-dGrayValues=256");
       if ((GsMajor >= 8) && (GsMinor >= 53))
              args.append("-dNOPSICC");          // prevent GS from applying an embedded ICC profile as it will be applied later on in ScImage.
       args.append("-r"+QString::number(gsRes));
       args.append("-sOutputFile="+tmpFile);
       args.append(QDir::convertSeparators(fn));
       if (psMode == 4)
              retg = callGS(args, "bitcmyk");
       else
              retg = callGS(args);
       if (retg == 0)
       {
              if (psMode == 4)
              {
                     m_image.create( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), 32 );
                     m_image.fill(qRgba(0, 0, 0, 0));
                     int w = qRound(b * gsRes / 72.0);
                     int w2 = 4*w;
                     int h2 = qRound(h * gsRes / 72.0);
                     uint *p;
                     int cyan, magenta, yellow, black;
                     QByteArray imgc(w2);
                     QFile f(tmpFile);
                     if (f.open(IO_ReadOnly))
                     {
                            for (int y=0; y < h2; ++y )
                            {
                                   p = (uint *)m_image.scanLine( y );
                                   f.readBlock(imgc.data(), w2);
                                   for (int x=0; x < w2; x += 4 )
                                   {
                                          cyan = uchar(imgc[x]);
                                          magenta = uchar(imgc[x + 1]);
                                          yellow = uchar(imgc[x + 2]);
                                          black = uchar(imgc[x + 3]);
                                          *p = qRgba(cyan, magenta, yellow, black);
                                          p++;
                                   }
                            }
                            f.close();
                     }
                     m_imageInfoRecord.colorspace = 1;
                     m_imageInfoRecord.type = 7;
              }
              else
              {
                     m_image.load(tmpFile);
                     m_image.setAlphaBuffer(true);
                     if (ScCore->havePNGAlpha() != 0)
                     {
                            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 *s;
                            for( int yi=0; yi < hi; ++yi )
                            {
                                   s = (QRgb*)(m_image.scanLine( yi ));
                                   for(int xi=0; xi < wi; ++xi )
                                   {
                                          if((*s) == alphaFF)
                                                 (*s) &= alpha00;
                                          s++;
                                   }
                            }
                     }
                     m_imageInfoRecord.type = 7;
                     m_imageInfoRecord.colorspace = 0;
              }
              unlink(tmpFile);
              if ((ext == "eps") || (ext == "epsi"))
              {
                     m_imageInfoRecord.BBoxX = static_cast<int>(x);
                     m_imageInfoRecord.BBoxH = static_cast<int>(h);
                     x = x * gsRes / 72.0;
                     y = y * gsRes / 72.0;
                     b = b * gsRes / 72.0;
                     if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
                     {
                            int yc = qRound(m_image.height() - y - (h-y));
                            m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
                     }
              }
              else
              {
                     m_imageInfoRecord.BBoxX = 0;
                     m_imageInfoRecord.BBoxH = m_image.height();
              }
              m_image.setDotsPerMeterX ((int) (m_imageInfoRecord.xres / 0.0254));
              m_image.setDotsPerMeterY ((int) (m_imageInfoRecord.yres / 0.0254));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::loadPhotoshopBinary ( QString  fn) [protected]

Definition at line 1084 of file scimgdataloader_ps.cpp.

{
       double x, y, b, h;
       QTextStream ts2(&BBox, IO_ReadOnly);
       ts2 >> x >> y >> b >> h;
       QFileInfo fi = QFileInfo(fn);
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
       QFile f2(tmpFile);
       QString tmp;
       m_image.create(psXSize, psYSize, 32);
       m_image.fill(qRgba(0, 0, 0, 0));
       m_imageInfoRecord.xres = qRound(psXSize / b * 72.0);
       m_imageInfoRecord.yres = qRound(psYSize / h * 72.0);
       QByteArray psdata;
       QFile f(fn);
       int yCount = 0;
       if (f.open(IO_ReadOnly))
       {
              if (psDataType > 2)
              {
                     f2.open(IO_WriteOnly);
              }
              QTextStream ts(&f);
              while (!ts.atEnd())
              {
                     tmp = ts.readLine();
                     if (tmp == psCommand)
                     {
                            if (psDataType == 1)
                            {
                                   QRgb *p;
                                   uchar cc, cm, cy, ck;
                                   for (int yh = 0; yh < m_image.height(); ++yh )
                                   {
                                          if (psMode == 4)
                                                 psdata.resize(psXSize * (4 + psChannel));
                                          else
                                                 psdata.resize(psXSize * (3 + psChannel));
                                          f.readBlock(psdata.data(), psdata.size());
                                          p = (QRgb *)m_image.scanLine( yh );
                                          for (int xh = 0; xh < m_image.width(); ++xh )
                                          {
                                                 cc = psdata[xh];
                                                 cm = psdata[psXSize+xh];
                                                 cy = psdata[psXSize*2+xh];
                                                 ck = psdata[psXSize*3+xh];
                                                 if (psMode == 4)
                                                        *p = qRgba(cc, cm, cy, ck);
                                                 else
                                                        *p = qRgba(cc, cm, cy, 255);
                                                 p++;
                                          }
                                   }
                            }
                            else if (psDataType > 1)
                            {
                                   while (!ts.atEnd())
                                   {
                                          tmp = ts.readLine();
                                          if ((tmp.isEmpty()) || (tmp.startsWith("%%EndBinary")))
                                                 break;
                                          if (psDataType == 2)
                                          {
                                                 for (uint a = 0; a < tmp.length(); a += 2)
                                                 {
                                                        bool ok;
                                                        ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
                                                        psdata.resize(psdata.size()+1);
                                                        psdata[psdata.size()-1] = data;
                                                 }
                                          }
                                          else
                                          {
                                                 decodeA85(psdata, tmp);
                                                 f2.writeBlock(psdata.data(), psdata.size());
                                                 psdata.resize(0);
                                          }
                                   }
                                   if (psDataType > 2)
                                   {
                                          f2.close();
                                          loadPSjpeg(tmpFile);
                                          unlink(tmpFile);
                                   }
                                   else
                                   {
                                          QRgb *p;
                                          uchar cc, cm, cy, ck;
                                          for (int yh = 0; yh < m_image.height(); ++yh )
                                          {
                                                 p = (QRgb *)m_image.scanLine( yh );
                                                 for (int xh = 0; xh < m_image.width(); ++xh )
                                                 {
                                                        cc = psdata[yCount+xh];
                                                        cm = psdata[yCount+psXSize+xh];
                                                        cy = psdata[yCount+psXSize*2+xh];
                                                        if (psMode == 4)
                                                        {
                                                               ck = psdata[yCount+psXSize*3+xh];
                                                               *p = qRgba(cc, cm, cy, ck);
                                                        }
                                                        else
                                                               *p = qRgba(cc, cm, cy, 255);
                                                        p++;
                                                 }
                                                 if (psMode == 4)
                                                        yCount += psXSize * (4 + psChannel);
                                                 else
                                                        yCount += psXSize * (3 + psChannel);
                                          }
                                   }
                            }
                            if (psMode == 4)
                                   m_imageInfoRecord.colorspace = 1;
                            else
                                   m_imageInfoRecord.colorspace = 0;
                            m_imageInfoRecord.type = 7;
                            m_imageInfoRecord.BBoxX = 0;
                            m_imageInfoRecord.BBoxH = m_image.height();
                            m_image.setDotsPerMeterX ((int) (m_imageInfoRecord.xres / 0.0254));
                            m_image.setDotsPerMeterY ((int) (m_imageInfoRecord.yres / 0.0254));
                            f.close();
                            return;
                     }
              }
              f.close();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::loadPhotoshopBinary ( QString  fn,
QImage &  tmpImg 
) [protected]

Definition at line 1214 of file scimgdataloader_ps.cpp.

{
       double x, y, b, h;
       QTextStream ts2(&BBox, IO_ReadOnly);
       ts2 >> x >> y >> b >> h;
       QFileInfo fi = QFileInfo(fn);
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
       QFile f2(tmpFile);
       QString tmp;
       tmpImg.create(psXSize, psYSize, 32);
       tmpImg.fill(qRgba(0, 0, 0, 0));
       QByteArray psdata;
       QFile f(fn);
       int yCount = 0;
       if (f.open(IO_ReadOnly))
       {
              if (psDataType > 2)
              {
                     f2.open(IO_WriteOnly);
              }
              QTextStream ts(&f);
              while (!ts.atEnd())
              {
                     tmp = ts.readLine();
                     if (tmp == psCommand)
                     {
                            if (psDataType == 1)
                            {
                                   QRgb *p;
                                   uchar cc, cm, cy, ck;
                                   for (int yh = 0; yh < tmpImg.height(); ++yh )
                                   {
                                          if (psMode == 4)
                                                 psdata.resize(psXSize * (4 + psChannel));
                                          else
                                                 psdata.resize(psXSize * (3 + psChannel));
                                          f.readBlock(psdata.data(), psdata.size());
                                          p = (QRgb *)tmpImg.scanLine( yh );
                                          for (int xh = 0; xh < tmpImg.width(); ++xh )
                                          {
                                                 cc = psdata[xh];
                                                 cm = psdata[psXSize+xh];
                                                 cy = psdata[psXSize*2+xh];
                                                 if (psMode == 4)
                                                 {
                                                        ck = psdata[psXSize*3+xh];
                                                        *p = qRgba(cc, cm, cy, ck);
                                                 }
                                                 else
                                                        *p = qRgba(cc, cm, cy, 255);
                                                 p++;
                                          }
                                   }
                            }
                            else if (psDataType > 1)
                            {
                                   while (!ts.atEnd())
                                   {
                                          tmp = ts.readLine();
                                          if ((tmp.isEmpty()) || (tmp.startsWith("%%EndBinary")))
                                                 break;
                                          if (psDataType == 2)
                                          {
                                                 for (uint a = 0; a < tmp.length(); a += 2)
                                                 {
                                                        bool ok;
                                                        ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
                                                        psdata.resize(psdata.size()+1);
                                                        psdata[psdata.size()-1] = data;
                                                 }
                                          }
                                          else
                                          {
                                                 decodeA85(psdata, tmp);
                                                 f2.writeBlock(psdata.data(), psdata.size());
                                                 psdata.resize(0);
                                          }
                                   }
                                   if (psDataType > 2)
                                   {
                                          f2.close();
                                          loadPSjpeg(tmpFile, tmpImg);
                                          unlink(tmpFile);
                                   }
                                   else
                                   {
                                          QRgb *p;
                                          uchar cc, cm, cy, ck;
                                          for (int yh = 0; yh < tmpImg.height(); ++yh )
                                          {
                                                 p = (QRgb *)tmpImg.scanLine( yh );
                                                 for (int xh = 0; xh < tmpImg.width(); ++xh )
                                                 {
                                                        cc = psdata[yCount+xh];
                                                        cm = psdata[yCount+psXSize+xh];
                                                        cy = psdata[yCount+psXSize*2+xh];
                                                        if (psMode == 4)
                                                        {
                                                               ck = psdata[yCount+psXSize*3+xh];
                                                               *p = qRgba(cc, cm, cy, ck);
                                                        }
                                                        else
                                                               *p = qRgba(cc, cm, cy, 255);
                                                        p++;
                                                 }
                                                 if (psMode == 4)
                                                        yCount += psXSize * (4 + psChannel);
                                                 else
                                                        yCount += psXSize * (3 + psChannel);
                                          }
                                   }
                            }
                            f.close();
                            return;
                     }
              }
              f.close();
       }
}

Here is the call graph for this function:

bool ScImgDataLoader_PS::loadPicture ( const QString &  fn,
int  res,
bool  thumbnail 
) [virtual]

Implements ScImgDataLoader.

Definition at line 435 of file scimgdataloader_ps.cpp.

{
       QStringList args;
       double x, y, b, h;
       bool found = false;
       QString tmp, dummy, cmd1, cmd2, tmp2;
       QFileInfo fi = QFileInfo(fn);
       if (!fi.exists())
              return false;
       QString ext = fi.extension(false).lower();
       if (ext.isEmpty())
              ext = getImageType(fn);
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
       QString picFile = QDir::convertSeparators(fn);
       float xres = gsRes;
       float yres = gsRes;

       initialize();
       m_imageInfoRecord.type = 3;
       m_imageInfoRecord.exifDataValid = false;
       doThumbnail = thumbnail;
       colorPlates2.clear();
       colorPlates.clear();
       CustColors.clear();
       CustColors.insert("Cyan", ScColor(255, 0, 0, 0));
       CustColors.insert("Magenta", ScColor(0, 255, 0, 0));
       CustColors.insert("Yellow", ScColor(0, 0, 255, 0));
       CustColors.insert("Black", ScColor(0, 0, 0, 255));
       found = parseData(fn);
       if (FontListe.count() != 0)
       {
              scanForFonts(fn);
              if (FontListe.count() != 0)
              {
                     bool missing = false;
                     QString missingF = "";
                     for (uint fo = 0; fo < FontListe.count(); fo++)
                     {
                            if (!PrefsManager::instance()->appPrefs.AvailFonts.contains(FontListe[fo]))
                            {
                                   missing = true;
                                   missingF += FontListe[fo]+"\n";
                            }
                     }
                     if (missing)
                     {
                            m_message = QObject::tr("The Font(s):\n%1 are not available.\nThey have been replaced by \"Courier\"\nTherefore the image may be not correct").arg(missingF);
                            m_msgType = warningMsg;
                     }
              }
       }
       if ((thumbnail) && (m_imageInfoRecord.exifDataValid) && (!m_imageInfoRecord.exifInfo.thumbnail.isNull()))
       {
              QTextStream ts2(&BBox, IO_ReadOnly);
              ts2 >> x >> y >> b >> h;
              m_imageInfoRecord.exifInfo.width = qRound(b);
              m_imageInfoRecord.exifInfo.height = qRound(h);
              m_image = m_imageInfoRecord.exifInfo.thumbnail;
              if ((isPhotoshop) && (hasPhotoshopImageData))
              {
                     m_imageInfoRecord.exifInfo.width = qRound(psXSize);
                     m_imageInfoRecord.exifInfo.height = qRound(psYSize);
                     m_imageInfoRecord.type = 7;
                     if (psMode == 4)
                     {
                            m_imageInfoRecord.colorspace = 1;
                            QRgb *s;
                            unsigned char cc, cm, cy, ck;
                            for( int yit=0; yit < m_image.height(); ++yit )
                            {
                                   s = (QRgb*)(m_image.scanLine( yit ));
                                   for(int xit=0; xit < m_image.width(); ++xit )
                                   {
                                          cc = 255 - qRed(*s);
                                          cm = 255 - qGreen(*s);
                                          cy = 255 - qBlue(*s);
                                          ck = QMIN(QMIN(cc, cm), cy);
                                          *s = qRgba(cc-ck,cm-ck,cy-ck,ck);
                                          s++;
                                   }
                            }
                     }
                     else
                            m_imageInfoRecord.colorspace = 0;
              }
              else
                     m_imageInfoRecord.colorspace = 0;
              return true;
       }
       if (found)
       {
              if (isDCS1)
                     loadDCS1(fn, gsRes);
              else if (isDCS2)
                     loadDCS2(fn, gsRes);
              else if ((isPhotoshop) && (hasPhotoshopImageData))
                     loadPhotoshop(fn, gsRes);
              else if ((!m_imageInfoRecord.isEmbedded) || ((m_imageInfoRecord.isEmbedded) && (m_profileComponents == 3)))
              {
                     QTextStream ts2(&BBox, IO_ReadOnly);
                     ts2 >> x >> y >> b >> h;
                     h = h * gsRes / 72.0;
                     QStringList args;
                     xres = gsRes;
                     yres = gsRes;
                     if ((ext == "eps") || (ext == "epsi"))
                            args.append("-dEPSCrop");
                     args.append("-r"+QString::number(gsRes));
                     args.append("-sOutputFile="+tmpFile);
                     args.append(picFile);
                     int retg = callGS(args);
                     if (retg == 0)
                     {
                            m_image.load(tmpFile);
                            m_image.setAlphaBuffer(true);
                            if (ScCore->havePNGAlpha() != 0)
                            {
                                   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 *s;
                                   for( int yi=0; yi < hi; ++yi )
                                   {
                                          s = (QRgb*)(m_image.scanLine( yi ));
                                          for(int xi=0; xi < wi; ++xi )
                                          {
                                                 if((*s) == alphaFF)
                                                        (*s) &= alpha00;
                                                 s++;
                                          }
                                   }
                            }
                            unlink(tmpFile);
                            if ((ext == "eps") || (ext == "epsi"))
                            {
                                   m_imageInfoRecord.BBoxX = static_cast<int>(x);
                                   m_imageInfoRecord.BBoxH = static_cast<int>(h);
                                   x = x * gsRes / 72.0;
                                   y = y * gsRes / 72.0;
                                   b = b * gsRes / 72.0;
                                   if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
                                   {
                                          int yc = qRound(m_image.height() - y - (h-y));
                                          m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
                                   }
                            }
                            else
                            {
                                   m_imageInfoRecord.BBoxX = 0;
                                   m_imageInfoRecord.BBoxH = m_image.height();
                            }
                            m_imageInfoRecord.xres = qRound(gsRes);
                            m_imageInfoRecord.yres = qRound(gsRes);
                            if ((m_imageInfoRecord.isEmbedded) && (m_profileComponents == 3))
                                   m_imageInfoRecord.type = 7;
                            m_imageInfoRecord.colorspace = 0;
                            m_image.setDotsPerMeterX ((int) (xres / 0.0254));
                            m_image.setDotsPerMeterY ((int) (yres / 0.0254));
                     }
              }
              else
              {
                     QTextStream ts2(&BBox, IO_ReadOnly);
                     ts2 >> x >> y >> b >> h;
                     h = h * gsRes / 72.0;
                     QStringList args;
                     xres = gsRes;
                     yres = gsRes;
                     if ((ext == "eps") || (ext == "epsi"))
                            args.append("-dEPSCrop");
                     args.append("-dGrayValues=256");
                     args.append("-r"+QString::number(gsRes));
                     args.append("-sOutputFile="+tmpFile);
                     args.append(picFile);
                     int retg = callGS(args, "bitcmyk");
                     if (retg == 0)
                     {
                            m_image.create( qRound(b * gsRes / 72.0), qRound(h * gsRes / 72.0), 32 );
                            m_image.fill(qRgba(0, 0, 0, 0));
                            int w = qRound(b * gsRes / 72.0);
                            int w2 = 4*w;
                            int h2 = qRound(h * gsRes / 72.0);
                            uint *p;
                            int cyan, magenta, yellow, black;
                            QByteArray imgc(w2);
                            QFile f(tmpFile);
                            if (f.open(IO_ReadOnly))
                            {
                                   for (int y=0; y < h2; ++y )
                                   {
                                          p = (uint *)m_image.scanLine( y );
                                          f.readBlock(imgc.data(), w2);
                                          for (int x=0; x < w2; x += 4 )
                                          {
                                                 cyan = uchar(imgc[x]);
                                                 magenta = uchar(imgc[x + 1]);
                                                 yellow = uchar(imgc[x + 2]);
                                                 black = uchar(imgc[x + 3]);
                                                 *p = qRgba(cyan, magenta, yellow, black);
                                                 p++;
                                          }
                                   }
                                   f.close();
                            }
                            unlink(tmpFile);
                            if ((ext == "eps") || (ext == "epsi"))
                            {
                                   m_imageInfoRecord.BBoxX = static_cast<int>(x);
                                   m_imageInfoRecord.BBoxH = static_cast<int>(h);
                                   x = x * gsRes / 72.0;
                                   y = y * gsRes / 72.0;
                                   b = b * gsRes / 72.0;
                                   if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
                                   {
                                          int yc = qRound(m_image.height() - y - (h-y));
                                          m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
                                   }
                            }
                            else
                            {
                                   m_imageInfoRecord.BBoxX = 0;
                                   m_imageInfoRecord.BBoxH = m_image.height();
                            }
                            m_imageInfoRecord.xres = qRound(gsRes);
                            m_imageInfoRecord.yres = qRound(gsRes);
                            m_imageInfoRecord.colorspace = 1;
                            m_imageInfoRecord.type = 7;
                            m_image.setDotsPerMeterX ((int) (xres / 0.0254));
                            m_image.setDotsPerMeterY ((int) (yres / 0.0254));
                     }
              }
              return true;
       }
       return false;
}

Here is the call graph for this function:

bool ScImgDataLoader_PS::loadPSjpeg ( QString  fn) [protected]

Definition at line 858 of file scimgdataloader_ps.cpp.

{
       if (!QFile::exists(fn))
              return false;
       struct jpeg_decompress_struct cinfo;
       struct my_error_mgr         jerr;
       FILE     *infile;
       cinfo.err = jpeg_std_error (&jerr.pub);
       jerr.pub.error_exit = my_error_exit;
       infile = NULL;
       if (setjmp (jerr.setjmp_buffer))
       {
              jpeg_destroy_decompress (&cinfo);
              if (infile)
                     fclose (infile);
              return false;
       }
       jpeg_create_decompress (&cinfo);
       if ((infile = fopen (fn.local8Bit(), "rb")) == NULL)
              return false;
       jpeg_stdio_src(&cinfo, infile);
       jpeg_read_header(&cinfo, true);
       jpeg_start_decompress(&cinfo);
       if ( cinfo.output_components == 3 || cinfo.output_components == 4)
              m_image.create( cinfo.output_width, cinfo.output_height, 32 );
       else if ( cinfo.output_components == 1 )
       {
              m_image.create( cinfo.output_width, cinfo.output_height, 8, 256 );
              for (int i=0; i<256; i++)
                     m_image.setColor(i, qRgb(i,i,i));
       }
       if (!m_image.isNull())
       {
              uchar** lines = m_image.jumpTable();
              while (cinfo.output_scanline < cinfo.output_height)
                     (void) jpeg_read_scanlines(&cinfo, lines + cinfo.output_scanline, cinfo.output_height);
              if ( cinfo.output_components == 3 )
              {
                     uchar *in;
                     QRgb *out;
                     for (uint j=0; j<cinfo.output_height; j++)
                     {
                            in = m_image.scanLine(j) + cinfo.output_width * 3;
                            out = (QRgb*) m_image.scanLine(j);
                            for (uint i=cinfo.output_width; i--; )
                            {
                                   in -= 3;
                                   out[i] = qRgb(in[0], in[1], in[2]);
                            }
                     }
              }
              if ( cinfo.output_components == 4 )
              {
                     QRgb *ptr;
                     unsigned char c, m, y ,k;
                     unsigned char *p;
                     for (int i = 0; i < m_image.height(); i++)
                     {
                            ptr = (QRgb*)  m_image.scanLine(i);
                            if ((cinfo.jpeg_color_space == JCS_YCCK) || ((cinfo.jpeg_color_space == JCS_CMYK) && (cinfo.saw_Adobe_marker)))
                            {
                                   for (int j = 0; j <  m_image.width(); j++)
                                   {
                                          p = (unsigned char *) ptr;
                                          c = p[0];
                                          m = p[1];
                                          y =  p[2];
                                          k =  p[3];
                                          *ptr = qRgba(c, m, y, k);
                                          ptr++;
                                   }
                            }
                            else
                            {
                                   for (int j = 0; j <  m_image.width(); j++)
                                   {
                                          p = (unsigned char *) ptr;
                                          c = p[0];
                                          m = p[1];
                                          y =  p[2];
                                          k =  p[3];
                                          *ptr = qRgba(y, m, c, k);
                                          ptr++;
                                   }
                            }
                     }
              }
              if ( cinfo.output_components == 1 )
              {
                     QImage tmpImg = m_image.convertDepth(32);
                     m_image.create( cinfo.output_width, cinfo.output_height, 32 );
                     QRgb *s;
                     QRgb *d;
                     for( int yi=0; yi < tmpImg.height(); ++yi )
                     {
                            s = (QRgb*)(tmpImg.scanLine( yi ));
                            d = (QRgb*)(m_image.scanLine( yi ));
                            for(int xi=0; xi < tmpImg.width(); ++xi )
                            {
                                   (*d) = (*s);
                                   s++;
                                   d++;
                            }
                     }
              }
              m_image.setAlphaBuffer(true);
       }
       (void) jpeg_finish_decompress(&cinfo);
       fclose (infile);
       jpeg_destroy_decompress (&cinfo);
       return (!m_image.isNull());
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ScImgDataLoader_PS::loadPSjpeg ( QString  fn,
QImage &  tmpImg 
) [protected]

Definition at line 971 of file scimgdataloader_ps.cpp.

{
       if (!QFile::exists(fn))
              return false;
       struct jpeg_decompress_struct cinfo;
       struct my_error_mgr         jerr;
       FILE     *infile;
       cinfo.err = jpeg_std_error (&jerr.pub);
       jerr.pub.error_exit = my_error_exit;
       infile = NULL;
       if (setjmp (jerr.setjmp_buffer))
       {
              jpeg_destroy_decompress (&cinfo);
              if (infile)
                     fclose (infile);
              return false;
       }
       jpeg_create_decompress (&cinfo);
       if ((infile = fopen (fn.local8Bit(), "rb")) == NULL)
              return false;
       jpeg_stdio_src(&cinfo, infile);
       jpeg_read_header(&cinfo, true);
       jpeg_start_decompress(&cinfo);
       if ( cinfo.output_components == 3 || cinfo.output_components == 4)
              tmpImg.create( cinfo.output_width, cinfo.output_height, 32 );
       else if ( cinfo.output_components == 1 )
       {
              tmpImg.create( cinfo.output_width, cinfo.output_height, 8, 256 );
              for (int i=0; i<256; i++)
                     tmpImg.setColor(i, qRgb(i,i,i));
       }
       if (!tmpImg.isNull())
       {
              uchar** lines = tmpImg.jumpTable();
              while (cinfo.output_scanline < cinfo.output_height)
                     (void) jpeg_read_scanlines(&cinfo, lines + cinfo.output_scanline, cinfo.output_height);
              if ( cinfo.output_components == 3 )
              {
                     uchar *in;
                     QRgb *out;
                     for (uint j=0; j<cinfo.output_height; j++)
                     {
                            in = tmpImg.scanLine(j) + cinfo.output_width * 3;
                            out = (QRgb*) tmpImg.scanLine(j);
                            for (uint i=cinfo.output_width; i--; )
                            {
                                   in -= 3;
                                   out[i] = qRgb(in[0], in[1], in[2]);
                            }
                     }
              }
              if ( cinfo.output_components == 4 )
              {
                     QRgb *ptr;
                     unsigned char c, m, y ,k;
                     unsigned char *p;
                     for (int i = 0; i < tmpImg.height(); i++)
                     {
                            ptr = (QRgb*)  tmpImg.scanLine(i);
                            if ((cinfo.jpeg_color_space == JCS_YCCK) || ((cinfo.jpeg_color_space == JCS_CMYK) && (cinfo.saw_Adobe_marker)))
                            {
                                   for (int j = 0; j <  tmpImg.width(); j++)
                                   {
                                          p = (unsigned char *) ptr;
                                          c = p[0];
                                          m = p[1];
                                          y =  p[2];
                                          k =  p[3];
                                          *ptr = qRgba(c, m, y, k);
                                          ptr++;
                                   }
                            }
                            else
                            {
                                   for (int j = 0; j <  tmpImg.width(); j++)
                                   {
                                          p = (unsigned char *) ptr;
                                          c = p[0];
                                          m = p[1];
                                          y =  p[2];
                                          k =  p[3];
                                          *ptr = qRgba(y, m, c, k);
                                          ptr++;
                                   }
                            }
                     }
              }
              if ( cinfo.output_components == 1 )
              {
                     QImage tmpImg2 = tmpImg.convertDepth(32);
                     tmpImg.create( cinfo.output_width, cinfo.output_height, 32 );
                     QRgb *s;
                     QRgb *d;
                     for( int yi=0; yi < tmpImg2.height(); ++yi )
                     {
                            s = (QRgb*)(tmpImg2.scanLine( yi ));
                            d = (QRgb*)(tmpImg.scanLine( yi ));
                            for(int xi=0; xi < tmpImg2.width(); ++xi )
                            {
                                   (*d) = (*s);
                                   s++;
                                   d++;
                            }
                     }
              }
              tmpImg.setAlphaBuffer(true);
       }
       (void) jpeg_finish_decompress(&cinfo);
       fclose (infile);
       jpeg_destroy_decompress (&cinfo);
       return (!tmpImg.isNull());
}

Here is the call graph for this function:

bool ScImgDataLoader_PS::parseData ( QString  fn) [protected]

Definition at line 120 of file scimgdataloader_ps.cpp.

{
       QChar tc;
       QString tmp, FarNam;
       ScColor cc;
       double x, y, b, h, c, m, k;
       bool found = false;
       isDCS1 = false;
       isDCS2 = false;
       isDCS2multi = false;
       isPhotoshop = false;
       hasPhotoshopImageData = false;
       hasThumbnail = false;
       int plateCount = 0;
       uint startPos = 0;
       FontListe.clear();
       QFile f(fn);
       if (f.open(IO_ReadOnly))
       {
              QCString tempBuf(9);
              f.readBlock(tempBuf.data(), 8);
              if (getDouble(QString(tempBuf.mid(0, 4)), true) == 0xC5D0D3C6)
              {
                     startPos = getDouble(tempBuf.mid(4, 4), false);
                     if (doThumbnail)
                     {
                            f.at(0);
                            QByteArray tmp2buf(29);
                            f.readBlock(tmp2buf.data(), 28);
                            uint thumbStart = 0;
                            thumbStart = tmp2buf[20] & 0xff;
                            thumbStart |= (tmp2buf[21] << 8) & 0xff00;
                            thumbStart |= (tmp2buf[22] << 16) & 0xff0000;
                            thumbStart |= (tmp2buf[23] << 24) & 0xff000000;
                            uint thumbLen = 0;
                            thumbLen = tmp2buf[24] & 0xff;
                            thumbLen |= (tmp2buf[25] << 8) & 0xff00;
                            thumbLen |= (tmp2buf[26] << 16) & 0xff0000;
                            thumbLen |= (tmp2buf[27] << 24) & 0xff000000;
                            if (thumbLen != 0)
                            {
                                   QByteArray imgc(thumbLen);
                                   f.at(thumbStart);
                                   uint readB = f.readBlock(imgc.data(), thumbLen);
                                   readB = 0;
                                   QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "preview.tiff");
                                   QFile f2(tmpFile);
                                   if (f2.open(IO_WriteOnly))
                                          f2.writeBlock(imgc.data(), thumbLen);
                                   f2.close();
                                   imgc.resize(0);
                                   ScImage thum;
                                   CMSettings cms(0, "", 0);
                                   bool mode = true;
                                   if (thum.LoadPicture(tmpFile, cms, false, false, ScImage::RGBData, 72, &mode))
                                   {
                                          m_imageInfoRecord.exifDataValid = true;
                                          m_imageInfoRecord.exifInfo.thumbnail = thum.qImage().copy();
                                   }
                                   unlink(tmpFile);
                                   hasThumbnail = true;
                            }
                     }
              }
              bool psFound = false;
              QTextStream ts(&f);
              ts.device()->at(startPos);
              while (!ts.atEnd())
              {
                     tmp = ts.readLine();
                     if (tmp.startsWith("%%Creator: "))
                            Creator = tmp.remove("%%Creator: ");
                     if (tmp.startsWith("%%BoundingBox:"))
                     {
                            found = true;
                            BBox = tmp.remove("%%BoundingBox:");
                            if (BBox.contains("(atend)"))
                                   found = false;
                     }
                     if (!found)
                     {
                            if (tmp.startsWith("%%BoundingBox"))
                            {
                                   found = true;
                                   BBox = tmp.remove("%%BoundingBox");
                                   if (BBox.contains("(atend)"))
                                          found = false;
                            }
                     }
                     if (tmp.startsWith("%%CyanPlate:"))
                     {
                            colorPlates.insert("Cyan", tmp.remove("%%CyanPlate: "));
                            isDCS1 = true;
                     }
                     if (tmp.startsWith("%%MagentaPlate:"))
                     {
                            colorPlates.insert("Magenta", tmp.remove("%%MagentaPlate: "));
                            isDCS1 = true;
                     }
                     if (tmp.startsWith("%%YellowPlate:"))
                     {
                            colorPlates.insert("Yellow", tmp.remove("%%YellowPlate: "));
                            isDCS1 = true;
                     }
                     if (tmp.startsWith("%%BlackPlate:"))
                     {
                            colorPlates.insert("Black", tmp.remove("%%BlackPlate: "));
                            isDCS1 = true;
                     }
                     if (tmp.startsWith("%%PlateFile: ("))
                     {
                            tmp = tmp.remove("%%PlateFile: (");
                            int endNam = tmp.find(")");
                            QString plateNam = tmp.left(endNam);
                            tmp = tmp.remove(plateNam+")");
                            QTextStream ts2(&tmp, IO_ReadOnly);
                            QString posStr, dummy, lenStr;
                            ts2 >> dummy >> posStr >> lenStr;
                            if (dummy == "EPS")
                            {
                                   if (posStr.startsWith("#"))
                                   {
                                          posStr = posStr.remove(0, 1);
                                          uint pos = posStr.toUInt();
                                          uint len = lenStr.toUInt();
                                          struct plateOffsets offs;
                                          if (Creator.contains("Photoshop Version 9"))     // This is very strange, it seems that there is a bug in PS 9 which writes weired entries
                                          {
                                                 pos -= (191 + plateCount * 83);
                                                 len -= 83;
                                          }
                                          offs.pos = pos;
                                          offs.len = len;
                                          colorPlates2.insert(plateNam, offs);
                                          isDCS2 = true;
                                          plateCount++;
                                   }
                                   else
                                   {
                                          colorPlates.insert(plateNam, lenStr);
                                          isDCS2 = true;
                                          isDCS2multi = true;
                                   }
                            }
                     }
                     if (tmp.startsWith("%%DocumentFonts:"))
                     {
                            tmp = tmp.remove("%%DocumentFonts:");
                            QTextStream ts2(&tmp, IO_ReadOnly);
                            QString tmp2;
                            ts2 >> tmp2;
                            if (!tmp2.isEmpty())
                                   FontListe.append(tmp2);
                            while (!ts.atEnd())
                            {
                                   uint oldPos = ts.device()->at();
                                   tmp = ts.readLine();
                                   if (!tmp.startsWith("%%+"))
                                   {
                                          ts.device()->at(oldPos);
                                          break;
                                   }
                                   tmp = tmp.remove(0,3);
                                   QTextStream ts2(&tmp, IO_ReadOnly);
                                   QString tmp2;
                                   ts2 >> tmp2;
                                   if (!tmp2.isEmpty())
                                          FontListe.append(tmp2);
                            }
                     }
                     if (tmp.startsWith("%%CMYKCustomColor"))
                     {
                            tmp = tmp.remove(0,18);
                            QTextStream ts2(&tmp, IO_ReadOnly);
                            ts2 >> c >> m >> y >> k;
                            FarNam = ts2.read();
                            FarNam = FarNam.stripWhiteSpace();
                            FarNam = FarNam.remove(0,1);
                            FarNam = FarNam.remove(FarNam.length()-1,1);
                            cc = ScColor(static_cast<int>(255 * c), static_cast<int>(255 * m), static_cast<int>(255 * y), static_cast<int>(255 * k));
                            cc.setSpotColor(true);
                            CustColors.insert(FarNam, cc);
                            while (!ts.atEnd())
                            {
                                   uint oldPos = ts.device()->at();
                                   tmp = ts.readLine();
                                   if (!tmp.startsWith("%%+"))
                                   {
                                          ts.device()->at(oldPos);
                                          break;
                                   }
                                   tmp = tmp.remove(0,3);
                                   QTextStream ts2(&tmp, IO_ReadOnly);
                                   ts2 >> c >> m >> y >> k;
                                   FarNam = ts2.read();
                                   FarNam = FarNam.stripWhiteSpace();
                                   FarNam = FarNam.remove(0,1);
                                   FarNam = FarNam.remove(FarNam.length()-1,1);
                                   cc = ScColor(static_cast<int>(255 * c), static_cast<int>(255 * m), static_cast<int>(255 * y), static_cast<int>(255 * k));
                                   cc.setSpotColor(true);
                                   CustColors.insert(FarNam, cc);
                            }
                     }
                     if (tmp.startsWith("%%EndComments"))
                     {
                            while (!ts.atEnd())
                            {
                                   tmp = ts.readLine();
                                   if ((!tmp.isEmpty()) && (!tmp.startsWith("%")) && (found))
                                   {
                                          psFound = true;
                                          break;
                                   }
                                   if (tmp.startsWith("%%BoundingBox:"))
                                   {
                                          found = true;
                                          BBox = tmp.remove("%%BoundingBox:");
                                          if (BBox.contains("(atend)"))
                                                 found = false;
                                   }
                                   if (!found)
                                   {
                                          if (tmp.startsWith("%%BoundingBox"))
                                          {
                                                 found = true;
                                                 BBox = tmp.remove("%%BoundingBox");
                                                 if (BBox.contains("(atend)"))
                                                        found = false;
                                          }
                                   }
                                   if (tmp.startsWith("%ImageData: "))
                                   {
                                          hasPhotoshopImageData = true;
                                          tmp.remove("%ImageData: ");
                                          QTextStream ts2(&tmp, IO_ReadOnly);
                                          ts2 >> psXSize >> psYSize >> psDepth >> psMode >> psChannel >> psBlock >> psDataType >> psCommand;
                                          psCommand = psCommand.remove(0,1);
                                          psCommand = psCommand.remove(psCommand.length()-1,1);
                                   }
                                   if (tmp.startsWith("%BeginPhotoshop"))
                                   {
                                          QByteArray psdata;
                                          while (!ts.atEnd())
                                          {
                                                 tmp = ts.readLine();
                                                 if (tmp.startsWith("%EndPhotoshop"))
                                                 {
                                                        QDataStream strPhot(psdata,IO_ReadOnly);
                                                        strPhot.setByteOrder( QDataStream::BigEndian );
                                                        PSDHeader fakeHeader;
                                                        QTextStream ts2(&BBox, IO_ReadOnly);
                                                        ts2 >> x >> y >> b >> h;
                                                        fakeHeader.width = qRound(b);
                                                        fakeHeader.height = qRound(h);
                                                        parseRessourceData(strPhot, fakeHeader, psdata.size());
                                                        m_imageInfoRecord.valid = (m_imageInfoRecord.PDSpathData.size()) > 0 ? true : false;
                                                        isPhotoshop = true;
                                                        break;
                                                 }
                                                 for (uint a = 2; a < tmp.length(); a += 2)
                                                 {
                                                        bool ok;
                                                        ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
                                                        psdata.resize(psdata.size()+1);
                                                        psdata[psdata.size()-1] = data;
                                                 }
                                          }
                                          if ((doThumbnail) && ((hasThumbnail) || (!m_imageInfoRecord.exifInfo.thumbnail.isNull())))
                                                 return true;
                                   }
                                   if (tmp.startsWith("%%BeginICCProfile:"))
                                   {
                                          QByteArray psdata;
                                          while (!ts.atEnd())
                                          {
                                                 tmp = ts.readLine();
                                                 for (uint a = 2; a < tmp.length(); a += 2)
                                                 {
                                                        bool ok;
                                                        ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
                                                        psdata.resize(psdata.size()+1);
                                                        psdata[psdata.size()-1] = data;
                                                 }
                                                 if (tmp.startsWith("%%EndICCProfile"))
                                                 {
                                                        cmsHPROFILE prof = cmsOpenProfileFromMem(psdata.data(), psdata.size());
                                                        if (prof)
                                                        {
                                                               if (static_cast<int>(cmsGetColorSpace(prof)) == icSigRgbData)
                                                                      m_profileComponents = 3;
                                                               if (static_cast<int>(cmsGetColorSpace(prof)) == icSigCmykData)
                                                                      m_profileComponents = 4;
                                                               const char *Descriptor;
                                                               Descriptor = cmsTakeProductDesc(prof);
                                                               m_imageInfoRecord.profileName = QString(Descriptor);
                                                               m_imageInfoRecord.isEmbedded = true;
                                                               m_embeddedProfile.duplicate((const char*)psdata.data(), psdata.size());
                                                        }
                                                        cmsCloseProfile(prof);
                                                        break;
                                                 }
                                          }
                                   }
                                   if (psFound)
                                          break;
                            }
                     }
                     if (psFound)
                            break;
              }
       }
       f.close();
       return found;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader::parseRessourceData ( QDataStream &  s,
const PSDHeader header,
uint  size 
) [protected, inherited]

Definition at line 93 of file scimgdataloader.cpp.

{
       uint signature, resSize, offset, resBase, vRes, hRes, adj;
       ushort resID, hResUnit, vResUnit, dummyW;
       QString resName;
       uchar filler;
       offset = 0;
       bool first = false;
       bool pathOpen = false;
       FPoint firstPoint, firstControl;
       FPointArray clip2;
       while ((offset + 6)< size)
       {
              s >> signature;
              offset += 4;
              if(((signature >> 24)&0xff) != '8' ||
                      ((signature >> 16)&0xff) != 'B' ||
                      ((signature >> 8)&0xff) != 'I' ||
                      ((signature )&0xff) != 'M' )
                     break;
              s >> resID;
              offset += 2;
              adj = s.device()->at();
              resName = getPascalString(s);
              offset += s.device()->at() - adj;
              s >> resSize;
              if(offset + resSize > size)
                     break;
              resBase = s.device()->at();
              if ( (resID >= 0x07d0) && (resID <= 0x0bb6) )
              {
                     QString db1, db2;
                     short type;
                     uint data1, data2, data3, data4, data5, data6;
                     double frac1, frac2, frac3, frac4, frac5, frac6;
                     ushort man1, man2, man3, man4, man5, man6;
                     uint offset2;
                     offset2 = 0;
                     first = false;
                     pathOpen = false;
                     clip2.resize(0);
                     while (offset2 < resSize)
                     {
                            s >> type;
                            s >> data1;
                            frac1 = (data1 & 0x00FFFFFF) / 16777215.0;
                            man1 = (data1 & 0x0F000000) >> 24;
                            frac1 = (frac1 + man1) * header.height;
                            s >> data2;
                            frac2 = (data2 & 0x00FFFFFF) / 16777215.0;
                            man2 = (data2 & 0x0F000000) >> 24;
                            frac2 = (frac2 + man2) * header.width;
                            s >> data3;
                            frac3 = (data3 & 0x00FFFFFF) / 16777215.0;
                            man3 = (data3 & 0x0F000000) >> 24;
                            frac3 = (frac3 + man3) * header.height;
                            s >> data4;
                            frac4 = (data4 & 0x00FFFFFF) / 16777215.0;
                            man4 = (data4 & 0x0F000000) >> 24;
                            frac4 = (frac4 + man4) * header.width;
                            s >> data5;
                            frac5 = (data5 & 0x00FFFFFF) / 16777215.0;
                            man5 = (data5 & 0x0F000000) >> 24;
                            frac5 = (frac5 + man5) * header.height;
                            s >> data6;
                            frac6 = (data6 & 0x00FFFFFF) / 16777215.0;
                            man6 = (data6 & 0x0F000000) >> 24;
                            frac6 = (frac6 + man6) * header.width;
                            switch (type)
                            {
                            case 0:
                            case 3:
                                   if (pathOpen)
                                   {
                                          clip2.addPoint(firstPoint);
                                          clip2.addPoint(firstControl);
                                          clip2.setMarker();
                                   }
                                   pathOpen = false;
                                   first = true;
                                   break;
                            case 1:
                            case 2:
                            case 4:
                            case 5:
                                   if (first)
                                   {
                                          firstControl = FPoint(frac2, frac1);
                                          firstPoint = FPoint(frac4, frac3);
                                          clip2.addPoint(FPoint(frac4, frac3));
                                          clip2.addPoint(FPoint(frac6, frac5));
                                   }
                                   else
                                   {
                                          clip2.addPoint(frac4, frac3);
                                          clip2.addPoint(frac2, frac1);
                                          clip2.addPoint(frac4, frac3);
                                          clip2.addPoint(frac6, frac5);
                                   }
                                   pathOpen = true;
                                   first = false;
                                   break;
                            case 6:
                                   first = true;
                                   break;
                            default:
                                   break;
                            }
                            offset2 += 26;
                     }
                     clip2.addPoint(firstPoint);
                     clip2.addPoint(firstControl);
                     m_imageInfoRecord.PDSpathData.insert(resName, clip2.copy());
                     m_imageInfoRecord.valid = true;
              }
              else
              {
                     switch (resID)
                     {
                     case 0x0bb7:
                            adj = s.device()->at();
                            m_imageInfoRecord.clipPath = getPascalString(s);
                            offset += s.device()->at() - adj;
                            break;
                     case 0x03ed:
                            s >> hRes;
                            s >> hResUnit;
                            s >> dummyW;
                            s >> vRes;
                            s >> vResUnit;
                            s >> dummyW;
                            m_imageInfoRecord.xres = qRound(hRes / 65536.0);
                            m_imageInfoRecord.yres = qRound(vRes / 65536.0);
                            break;
                     case 0x040f:
                            m_embeddedProfile.resize(resSize);
                            s.readRawBytes(m_embeddedProfile.data(), resSize);
                            break;
                     case 0x0409:
                     case 0x040C:
                            {
                                   uint thdummy, thsize;
                                   s >> thdummy;
                                   s >> thdummy;
                                   s >> thdummy;
                                   s >> thdummy;
                                   s >> thdummy;
                                   s >> thsize;
                                   s >> thdummy;
                                   char* buffer = (char*)malloc(thsize);
                                   s.readRawBytes(buffer, thsize);
                                   QImage imth;
                                   imth.loadFromData((const uchar*)buffer, thsize, "JPEG");
                                   imth.convertDepth(32);
                                   if (resID == 0x0409)
                                          m_imageInfoRecord.exifInfo.thumbnail = imth.swapRGB();
                                   else
                                          m_imageInfoRecord.exifInfo.thumbnail = imth;
                                   m_imageInfoRecord.exifInfo.width = imth.width();
                                   m_imageInfoRecord.exifInfo.height = imth.height();
                                   m_imageInfoRecord.exifDataValid = true;
                                   free(buffer);
                            }
                     default:
                            break;
                     }
              }
              if (resBase + resSize <= size) {
                     s.device()->at( resBase + resSize );
                     offset += resSize;
              }
              if (resSize & 1)
              {
                     s >> filler;
                     offset += 1;
              }
       }
       if(offset<size)
              s.device()->at( size );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ScImgDataLoader_PS::preloadAlphaChannel ( const QString &  fn,
int  res 
) [virtual]

Implements ScImgDataLoader.

Definition at line 1593 of file scimgdataloader_ps.cpp.

{
       float xres, yres;
//     short resolutionunit = 0;
       initialize();
       QFileInfo fi = QFileInfo(fn);
       if (!fi.exists())
              return;
       QString tmp, BBox, tmp2;
       QString ext = fi.extension(false).lower();
       QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
       QString picFile = QDir::convertSeparators(fn);
       double x, y, b, h;
       bool found = false;
//     int retg = -1;
       QChar tc;
       
       QFile f(fn);
       if (f.open(IO_ReadOnly))
       {
              QTextStream ts(&f);
              while (!ts.atEnd())
              {
                     tc = ' ';
                     tmp = "";
                     while ((tc != '\n') && (tc != '\r'))
                     {
                            ts >> tc;
                            if ((tc != '\n') && (tc != '\r'))
                                   tmp += tc;
                     }
                     if (tmp.startsWith("%%BoundingBox:"))
                     {
                            found = true;
                            BBox = tmp.remove("%%BoundingBox:");
                            if (BBox.contains("(atend)"))
                                   found = false;
                     }
                     if (!found)
                     {
                            if (tmp.startsWith("%%BoundingBox"))
                            {
                                   found = true;
                                   BBox = tmp.remove("%%BoundingBox");
                                   if (BBox.contains("(atend)"))
                                          found = false;
                            }
                     }
                     if ((tmp.startsWith("%%EndComments")) && (found))
                            break;
              }
       }
       f.close();
       if (found)
       {
              QTextStream ts2(&BBox, IO_ReadOnly);
              ts2 >> x >> y >> b >> h;
              h = h * gsRes / 72.0;
              QStringList args;
              xres = gsRes;
              yres = gsRes;
              if ((ext == "eps") || (ext == "epsi"))
                     args.append("-dEPSCrop");
              args.append("-r"+QString::number(gsRes));
              args.append("-sOutputFile="+tmpFile);
              args.append(picFile);
              int retg = callGS(args);
              if (retg == 0)
              {
                     m_image.load(tmpFile);
                     m_image.setAlphaBuffer(true);
                     if (ScCore->havePNGAlpha() != 0)
                     {
                            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 *s;
                            for( int yi=0; yi < hi; ++yi )
                            {
                                   s = (QRgb*)(m_image.scanLine( yi ));
                                   for(int xi=0; xi < wi; ++xi )
                                   {
                                          if((*s) == alphaFF)
                                                 (*s) &= alpha00;
                                          s++;
                                   }
                            }
                     }
                     if ((ext == "eps") || (ext == "epsi"))
                     {
                            x = x * gsRes / 72.0;
                            y = y * gsRes / 72.0;
                            b = b * gsRes / 72.0;
                            if (((b - x) < m_image.width()) || ((h - y) < m_image.height()))
                            {
                                   int yc = qRound(m_image.height() - y - (h-y));
                                   m_image = m_image.copy(qRound(x), yc, qRound(b - x), qRound(h - y));
                            }
                     }
                     m_image.setAlphaBuffer(true);
                     unlink(tmpFile);
              }
       }
}

Here is the call graph for this function:

void ScImgDataLoader_PS::scanForFonts ( QString  fn) [protected]

Definition at line 98 of file scimgdataloader_ps.cpp.

{
       QString tmp;
       QFile f(fn);
       if (f.open(IO_ReadOnly))
       {
              QTextStream ts(&f);
              while (!ts.atEnd())
              {
                     tmp = ts.readLine();
                     if (tmp.startsWith("%%BeginFont:"))
                     {
                            tmp = tmp.remove("%%BeginFont:");
                            QTextStream ts2(&tmp, IO_ReadOnly);
                            QString tmp2;
                            ts2 >> tmp2;
                            FontListe.remove(tmp2);
                     }
              }
       }
}

Here is the caller graph for this function:

void ScImgDataLoader::setRequest ( bool  valid,
QMap< int, ImageLoadRequest req 
) [inherited]

Definition at line 24 of file scimgdataloader.cpp.

const QStringList& ScImgDataLoader::supportedFormats ( void  ) const [inline, inherited]

Definition at line 48 of file scimgdataloader.h.

{ return m_supportedFormats; }
bool ScImgDataLoader::supportFormat ( const QString &  fmt) [inherited]

Definition at line 30 of file scimgdataloader.cpp.

{
       QString format = fmt.lower();
       return (m_supportedFormats.contains(format));
}
void ScImgDataLoader::swapRGBA ( void  ) [protected, inherited]

Definition at line 57 of file scimgdataloader.cpp.

{
       for (int i = 0; i < m_image.height(); ++i)
       {
              unsigned int *ptr = (unsigned int *) m_image.scanLine(i);
              unsigned char r, b;
              for (int j = 0; j < m_image.width(); ++j)
              {
                     unsigned char *p = (unsigned char *) ptr;
                     r = p[0];
                     b = p[2];
                     p[2] = r;
                     p[0] = b;
                     ptr++;
              }
       }
}
void ScImgDataLoader::swapRGBA ( QImage *  img) [protected, inherited]

Definition at line 75 of file scimgdataloader.cpp.

{
       for (int i = 0; i < img->height(); ++i)
       {
              unsigned int *ptr = (unsigned int *) img->scanLine(i);
              unsigned char r, b;
              for (int j = 0; j < img->width(); ++j)
              {
                     unsigned char *p = (unsigned char *) ptr;
                     r = p[0];
                     b = p[2];
                     p[2] = r;
                     p[0] = b;
                     ptr++;
              }
       }
}

Member Data Documentation

QString ScImgDataLoader_PS::BBox [protected]

Definition at line 36 of file scimgdataloader_ps.h.

QMap<QString, QString> ScImgDataLoader_PS::colorPlates [protected]

Definition at line 35 of file scimgdataloader_ps.h.

QMap<QString, plateOffsets> ScImgDataLoader_PS::colorPlates2 [protected]

Definition at line 34 of file scimgdataloader_ps.h.

QString ScImgDataLoader_PS::Creator [protected]

Definition at line 37 of file scimgdataloader_ps.h.

QMap<QString,ScColor> ScImgDataLoader_PS::CustColors [protected]

Definition at line 53 of file scimgdataloader_ps.h.

Definition at line 43 of file scimgdataloader_ps.h.

QStringList ScImgDataLoader_PS::FontListe [protected]

Definition at line 54 of file scimgdataloader_ps.h.

Definition at line 42 of file scimgdataloader_ps.h.

Definition at line 44 of file scimgdataloader_ps.h.

Definition at line 38 of file scimgdataloader_ps.h.

Definition at line 39 of file scimgdataloader_ps.h.

Definition at line 40 of file scimgdataloader_ps.h.

Definition at line 41 of file scimgdataloader_ps.h.

QByteArray ScImgDataLoader::m_embeddedProfile [protected, inherited]

Definition at line 28 of file scimgdataloader.h.

QImage ScImgDataLoader::m_image [protected, inherited]

Definition at line 26 of file scimgdataloader.h.

Definition at line 27 of file scimgdataloader.h.

QString ScImgDataLoader::m_message [protected, inherited]

Definition at line 37 of file scimgdataloader.h.

MsgType ScImgDataLoader::m_msgType [protected, inherited]

Definition at line 36 of file scimgdataloader.h.

int ScImgDataLoader::m_profileComponents [protected, inherited]

Definition at line 29 of file scimgdataloader.h.

QStringList ScImgDataLoader::m_supportedFormats [protected, inherited]

Definition at line 24 of file scimgdataloader.h.

Definition at line 50 of file scimgdataloader_ps.h.

Definition at line 49 of file scimgdataloader_ps.h.

QString ScImgDataLoader_PS::psCommand [protected]

Definition at line 52 of file scimgdataloader_ps.h.

Definition at line 51 of file scimgdataloader_ps.h.

Definition at line 47 of file scimgdataloader_ps.h.

Definition at line 48 of file scimgdataloader_ps.h.

Definition at line 45 of file scimgdataloader_ps.h.

Definition at line 46 of file scimgdataloader_ps.h.

RawImage ScImgDataLoader::r_image [inherited]

Definition at line 52 of file scimgdataloader.h.


The documentation for this class was generated from the following files: