Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scimgdataloader.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef SCIMGDATALOADER_H
00008 #define SCIMGDATALOADER_H
00009 
00010 #include "scribusapi.h"
00011 #include <qcstring.h>
00012 #include <qimage.h>
00013 #include <qstringlist.h>
00014 #include <cstdlib>
00015 
00016 #include "scimagestructs.h"
00017 #include "rawimage.h"
00018 
00019 class ScImgDataLoader
00020 {
00021 protected:
00022        ScImgDataLoader(void);
00023 
00024        QStringList m_supportedFormats;
00025 
00026        QImage m_image;
00027        ImageInfoRecord m_imageInfoRecord;
00028        QByteArray m_embeddedProfile;
00029        int m_profileComponents;
00030 
00031        typedef enum {
00032               noMsg = 0,
00033               warningMsg = 1,
00034               errorMsg = 2
00035        } MsgType;
00036        MsgType m_msgType;
00037        QString m_message;
00038 
00039        void swapRGBA(void);
00040        void swapRGBA(QImage *img);
00041 
00042        QString getPascalString(QDataStream & s);
00043        void parseRessourceData( QDataStream & s, const PSDHeader & header, uint size );
00044 
00045 public:
00046        virtual ~ScImgDataLoader(void) {};
00047 
00048        const QStringList& supportedFormats(void) const { return m_supportedFormats; }
00049        bool  supportFormat(const QString& fmt);
00050 
00051        QImage& image(void) { return m_image; }
00052        RawImage r_image;
00053        QByteArray& embeddedProfile(void) { return m_embeddedProfile; }
00054        ImageInfoRecord& imageInfoRecord(void) { return m_imageInfoRecord; }
00055        void setRequest(bool valid, QMap<int, ImageLoadRequest> req);
00056 
00057        bool  issuedErrorMsg(void) const { return (m_msgType == errorMsg); }
00058        bool  issuedWarningMsg(void) const { return (m_msgType == warningMsg); }
00059        const QString& getMessage(void) const { return m_message; }
00060 
00061        virtual void initialize(void);
00062 
00063        virtual void preloadAlphaChannel(const QString& fn, int res) = 0;
00064        virtual void loadEmbeddedProfile(const QString& fn) = 0;
00065        virtual bool loadPicture(const QString& fn, int res, bool thumbnail) = 0;
00066 };
00067 
00068 #endif