1 | /****************************************************************************
|
---|
2 | ** $Id: qpngio.h 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of PNG QImage IOHandler
|
---|
5 | **
|
---|
6 | ** Created : 970521
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-1998 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #ifndef QPNGIO_H
|
---|
39 | #define QPNGIO_H
|
---|
40 |
|
---|
41 | #ifndef QT_H
|
---|
42 | #include "qimage.h"
|
---|
43 | #endif // QT_H
|
---|
44 |
|
---|
45 | #ifndef QT_NO_IMAGEIO_PNG
|
---|
46 |
|
---|
47 | void qInitPngIO();
|
---|
48 |
|
---|
49 | class QIODevice;
|
---|
50 |
|
---|
51 | #ifndef Q_PNGEXPORT
|
---|
52 | #if !defined(QT_PLUGIN)
|
---|
53 | #define Q_PNGEXPORT Q_EXPORT
|
---|
54 | #else
|
---|
55 | #define Q_PNGEXPORT
|
---|
56 | #endif
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | class Q_PNGEXPORT QPNGImageWriter {
|
---|
60 | public:
|
---|
61 | QPNGImageWriter(QIODevice*);
|
---|
62 | ~QPNGImageWriter();
|
---|
63 |
|
---|
64 | enum DisposalMethod { Unspecified, NoDisposal, RestoreBackground, RestoreImage };
|
---|
65 | void setDisposalMethod(DisposalMethod);
|
---|
66 | void setLooping(int loops=0); // 0 == infinity
|
---|
67 | void setFrameDelay(int msecs);
|
---|
68 | void setGamma(float);
|
---|
69 |
|
---|
70 | bool writeImage(const QImage& img, int x, int y);
|
---|
71 | bool writeImage(const QImage& img, int quality, int x, int y);
|
---|
72 | bool writeImage(const QImage& img)
|
---|
73 | { return writeImage(img, 0, 0); }
|
---|
74 | bool writeImage(const QImage& img, int quality)
|
---|
75 | { return writeImage(img, quality, 0, 0); }
|
---|
76 |
|
---|
77 | QIODevice* device() { return dev; }
|
---|
78 |
|
---|
79 | private:
|
---|
80 | QIODevice* dev;
|
---|
81 | int frames_written;
|
---|
82 | DisposalMethod disposal;
|
---|
83 | int looping;
|
---|
84 | int ms_delay;
|
---|
85 | float gamma;
|
---|
86 | };
|
---|
87 |
|
---|
88 | class Q_PNGEXPORT QPNGImagePacker : public QPNGImageWriter {
|
---|
89 | public:
|
---|
90 | QPNGImagePacker(QIODevice*, int depth, int convflags);
|
---|
91 |
|
---|
92 | void setPixelAlignment(int x);
|
---|
93 | bool packImage(const QImage& img);
|
---|
94 |
|
---|
95 | private:
|
---|
96 | QImage previous;
|
---|
97 | int depth;
|
---|
98 | int convflags;
|
---|
99 | int alignx;
|
---|
100 | };
|
---|
101 |
|
---|
102 | #endif // QT_NO_IMAGEIO_PNG
|
---|
103 |
|
---|
104 | #endif // QPNGIO_H
|
---|