scantools
1.0.7
Graphics manipulation with a view towards scanned documents
src
libscantools
TIFFReader.h
1
/*
2
* Copyright © 2017-2018 Stefan Kebekus <stefan.kebekus@math.uni-freiburg.de>
3
*
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU General Public License as published by the Free Software
6
* Foundation, either version 3 of the License, or (at your option) any later
7
* version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
* details.
13
*
14
* You should have received a copy of the GNU General Public License along with
15
* this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
19
#ifndef TIFFREADER
20
#define TIFFREADER 1
21
22
#include <QImage>
23
#include <QMutex>
24
#include <QTemporaryFile>
25
26
48
class
TIFFReader
49
{
50
public
:
62
explicit
TIFFReader
(
const
QString& fileName);
63
65
~TIFFReader
();
66
71
bool
hasError
();
72
80
QString
error
();
81
88
quint32
size
();
89
102
QImage
operator[]
(quint16 pageNumber);
103
104
private
:
105
// Prevents simultaneous write access to the tmpFile and the error message by
106
// multiple threads
107
QMutex mutex;
108
109
// This is a temporary file where a copy of the TIFF is kept. The copy is
110
// modified by operator[]
111
QTemporaryFile tmpFile;
112
113
// This data stream is used to read from tmpFile. Its endian-ness is set in
114
// the constructor to match the endian-ness of the TIFF
115
QDataStream ioStream;
116
117
// List of offsets that specify where in the TIFF file the image directories
118
// start.
119
QList<quint32> IFDOffsets;
120
121
// Error message
122
QString _error;
123
};
124
125
#endif
TIFFReader::operator[]
QImage operator[](quint16 pageNumber)
Read image.
TIFFReader
Reads TIFF files and converts them to QImages.
Definition:
TIFFReader.h:49
TIFFReader::~TIFFReader
~TIFFReader()
Standard destructor.
TIFFReader::size
quint32 size()
Number of images in the TIFF document.
TIFFReader::hasError
bool hasError()
Error status.
TIFFReader::error
QString error()
Error message.
TIFFReader::TIFFReader
TIFFReader(const QString &fileName)
Constructs a TIFF document from a file.
Generated by
1.8.18