1 /*
2    Drawpile - a collaborative drawing program.
3 
4    Copyright (C) 2009-2019 Calle Laakkonen
5 
6    Drawpile is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10 
11    Drawpile is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with Drawpile.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef ORAREADER_H
20 #define ORAREADER_H
21 
22 #include "../libshared/net/message.h"
23 
24 #include <QString>
25 
26 class QPixmap;
27 
28 namespace openraster {
29 
30 struct OraResult {
31 	enum Warning {
32 		//! No warnings (i.e. Drawpile supports all features of the file)
33 		NO_WARNINGS = 0,
34 		//! The OpenRaster file uses unsupported app. specific extensions
35 		ORA_EXTENDED = 0x01,
36 		//! Nested layers are used
37 		ORA_NESTED = 0x02,
38 		//! Unsupported background tile size or format
39 		UNSUPPORTED_BACKGROUND_TILE = 0x04
40 	};
41 	Q_DECLARE_FLAGS(Warnings, Warning)
42 
43 	//! The commands to initialize a canvas
44 	protocol::MessageList commands;
45 
46 	//! Error message (empty if file was loaded succesfully)
47 	QString error;
48 
49 	//! Warning flags
50 	Warnings warnings;
51 
52 	//! Image resolution info (presently not used internally by Drawpile)
53 	int dpiX, dpiY;
54 
OraResultOraResult55 	OraResult() : warnings(NO_WARNINGS) { }
OraResultOraResult56 	OraResult(const QString &error) : error(error) { }
57 };
58 
59 Q_DECLARE_OPERATORS_FOR_FLAGS(OraResult::Warnings)
60 
61 //! Load an OpenRaster image
62 OraResult loadOpenRaster(const QString &filename);
63 
64 //! Get the thumbnail from an ORA file
65 QImage loadOpenRasterThumbnail(const QString &filename);
66 
67 }
68 
69 #endif
70 
71