Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /** |
---|---|
2 | * QImageIO Routines to read/write g3 (fax) images. |
3 | * copyright (c) 2000, Matthias Hölzer-Klüpfel <hoelzer@kde.org> |
4 | * |
5 | * This library is distributed under the conditions of the GNU LGPL. |
6 | */ |
7 | |
8 | #include "g3r.h" |
9 | |
10 | #include <config.h> |
11 | |
12 | #include <tiffio.h> |
13 | |
14 | #include <qimage.h> |
15 | #include <qfile.h> |
16 | |
17 | KDE_EXPORT void kimgio_g3_read( QImageIO *io ) |
18 | { |
19 | // This won't work if io is not a QFile ! |
20 | TIFF *tiff = TIFFOpen(QFile::encodeName(io->fileName()), "r"); |
21 | if (!tiff) |
22 | return; |
23 | |
24 | uint32 width, height; |
25 | tsize_t scanlength; |
26 | |
27 | if( TIFFGetField( tiff, TIFFTAG_IMAGEWIDTH, &width ) != 1 |
28 | || TIFFGetField( tiff, TIFFTAG_IMAGELENGTH, &height ) != 1 ) |
29 | return; |
30 | scanlength = TIFFScanlineSize(tiff); |
31 | |
32 | QImage image(width, height, 1, 0, QImage::BigEndian); |
33 | |
34 | if (image.isNull() || scanlength != image.bytesPerLine()) |
35 | { |
36 | TIFFClose(tiff); |
37 | return; |
38 | } |
39 | |
40 | for (uint32 y=0; y < height; y++) |
41 | TIFFReadScanline(tiff, image.scanLine(y), y); |
42 | |
43 | TIFFClose(tiff); |
44 | |
45 | io->setImage(image); |
46 | io->setStatus(0); |
47 | } |
48 | |
49 | |
50 | KDE_EXPORT void kimgio_g3_write(QImageIO *) |
51 | { |
52 | // TODO: stub |
53 | } |
54 | |
55 |
Warning: That file was not part of the compilation database. It may have many parsing errors.