Scribus
Open source desktop publishing at your fingertips
scimgdataloader.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef SCIMGDATALOADER_H
8 #define SCIMGDATALOADER_H
9 
10 #include "scribusapi.h"
11 #include <QByteArray>
12 #include <QImage>
13 #include <QStringList>
14 
15 #include "colormgmt/sccolormgmtstructs.h"
16 #include "scimagestructs.h"
17 #include "rawimage.h"
18 
20 {
21 protected:
22  ScImgDataLoader(void);
23 
24  QStringList m_supportedFormats;
25 
26  QImage m_image;
27  ImageInfoRecord m_imageInfoRecord;
28  QByteArray m_embeddedProfile;
29  int m_profileComponents;
30  eColorFormat m_pixelFormat;
31 
32  typedef enum {
33  noMsg = 0,
34  warningMsg = 1,
35  errorMsg = 2
36  } MsgType;
37  MsgType m_msgType;
38  QString m_message;
39 
40  void swapRGBA(void);
41  void swapRGBA(QImage *img);
42 
43  QString getPascalString(QDataStream & s);
44  double decodePSDfloat(uint data);
45  void parseRessourceData( QDataStream & s, const PSDHeader & header, uint size );
46 
47 public:
48  virtual ~ScImgDataLoader(void) {};
49 
50  const QStringList& supportedFormats(void) const { return m_supportedFormats; }
51  bool supportFormat(const QString& fmt);
52 
53  RawImage r_image;
54 
55  QImage& image(void) { return m_image; }
56  QByteArray& embeddedProfile(void) { return m_embeddedProfile; }
57  ImageInfoRecord& imageInfoRecord(void) { return m_imageInfoRecord; }
58  eColorFormat pixelFormat(void) { return m_pixelFormat; }
59  void setRequest(bool valid, QMap<int, ImageLoadRequest> req);
60 
61  bool issuedErrorMsg(void) const { return (m_msgType == errorMsg); }
62  bool issuedWarningMsg(void) const { return (m_msgType == warningMsg); }
63  const QString& getMessage(void) const { return m_message; }
64 
65  virtual void initialize(void);
66 
67 // virtual void preloadAlphaChannel(const QString& fn, int res) = 0;
68  virtual bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) = 0;
69  virtual void loadEmbeddedProfile(const QString& fn, int page = 0) = 0;
70  virtual bool loadPicture(const QString& fn, int page, int res, bool thumbnail) = 0;
71  virtual bool useRawImage() { return false; }
72 };
73 
74 #endif
Definition: scimgdataloader.h:19
Definition: rawimage.h:15
Definition: scimagestructs.h:39
Definition: scimagestructs.h:126