fix static positioning of positioned inline replaced elements.
[kdelibs.git] / kimgio / g3r.cpp
blobabc539099fae92c8d420a25b6e21156c2593e65f
1 /**
2 * QImageIO Routines to read/write g3 (fax) images.
3 * copyright (c) 2000, Matthias Hölzer-Klüpfel <hoelzer@kde.org>
5 * This library is distributed under the conditions of the GNU LGPL.
6 */
8 #include "g3r.h"
10 #include <config.h>
12 #include <tiffio.h>
14 #include <qimage.h>
15 #include <qfile.h>
17 KDE_EXPORT void kimgio_g3_read( QImageIO *io )
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;
24 uint32 width, height;
25 tsize_t scanlength;
27 if( TIFFGetField( tiff, TIFFTAG_IMAGEWIDTH, &width ) != 1
28 || TIFFGetField( tiff, TIFFTAG_IMAGELENGTH, &height ) != 1 )
29 return;
30 scanlength = TIFFScanlineSize(tiff);
32 QImage image(width, height, 1, 0, QImage::BigEndian);
34 if (image.isNull() || scanlength != image.bytesPerLine())
36 TIFFClose(tiff);
37 return;
40 for (uint32 y=0; y < height; y++)
41 TIFFReadScanline(tiff, image.scanLine(y), y);
43 TIFFClose(tiff);
45 io->setImage(image);
46 io->setStatus(0);
50 KDE_EXPORT void kimgio_g3_write(QImageIO *)
52 // TODO: stub