Subversion Repositories Scribus

Rev

Rev 24643 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5977 jghali 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
*/
5937 jghali 7
#ifndef SCIMGDATALOADER_TIFF_H
8
#define SCIMGDATALOADER_TIFF_H
9
 
24643 jghali 10
#include <cstdint>
6589 fschmid 11
#include <tiffio.h>
24643 jghali 12
 
9803 fschmid 13
#include <QList>
5937 jghali 14
 
24647 jghali 15
#include "scimgdataloader.h"
16
 
5937 jghali 17
class ScImgDataLoader_TIFF : public ScImgDataLoader
18
{
24643 jghali 19
public:
20
        ScImgDataLoader_TIFF();
21
 
22
//      virtual void preloadAlphaChannel(const QString& fn, int res);
23
        bool preloadAlphaChannel(const QString& fn, int page, int res, bool& hasAlpha) override;
24
        void loadEmbeddedProfile(const QString& fn, int page = 0) override;
25
        bool loadPicture(const QString& fn, int page, int res, bool thumbnail) override;
26
 
27
        bool useRawImage() const override { return true; }
28
 
5937 jghali 29
protected:
30
 
6766 fschmid 31
        enum PSDColorMode
32
        {
33
                CM_BITMAP = 0,
34
                CM_GRAYSCALE = 1,
35
                CM_INDEXED = 2,
36
                CM_RGB = 3,
37
                CM_CMYK = 4,
38
                CM_MULTICHANNEL = 7,
39
                CM_DUOTONE = 8,
40
                CM_LABCOLOR = 9
41
        };
24647 jghali 42
 
43
        struct SampleFormatInfo
44
        {
45
                uint16_t photometric;
46
                uint16_t bitsPerSample;
47
                uint16_t samplesPerPixel;
48
                uint16_t samplesFormat;
49
                uint16_t fillOrder;
50
        };
51
 
5937 jghali 52
        void initSupportedFormatList();
12141 avox 53
        int  getLayers(const QString& fn, int page);
24647 jghali 54
        bool getImageData(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, const SampleFormatInfo& sampleInfo, bool &bilevel, bool &isCMYK);
55
        bool getImageData_RGBA(TIFF* tif, RawImage *image, uint widtht, uint heightt, uint size, const SampleFormatInfo& sampleInfo);
22635 craig 56
        void blendOntoTarget(RawImage *tmp, int layOpa, const QString& layBlend, bool cmyk, bool useMask);
6736 fschmid 57
        QString getLayerString(QDataStream & s);
9803 fschmid 58
        bool loadChannel( QDataStream & s, const PSDHeader & header, QList<PSDLayer> &layerInfo, uint layer, int channel, int component, RawImage &tmpImg);
18925 jghali 59
        bool loadLayerInfo(QDataStream & s, QList<PSDLayer> &layerInfo);
9803 fschmid 60
        bool loadLayerChannels( QDataStream & s, const PSDHeader & header, QList<PSDLayer> &layerInfo, uint layer, bool* firstLayer);
11543 jghali 61
 
12141 avox 62
        bool testAlphaChannelAvailability(const QString& fn, int page, bool& hasAlpha);
11543 jghali 63
        void unmultiplyRGBA(RawImage *image);
64
 
24643 jghali 65
        int      m_random_table[4096];
24647 jghali 66
        uint16_t m_photometric;
67
        uint16_t m_samplesPerPixel;
5937 jghali 68
};
69
 
70
#endif