• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KImgIO

g3r.cpp

Go to the documentation of this file.
00001 // This library is distributed under the conditions of the GNU LGPL.
00002 
00003 #include "config.h"
00004 
00005 #ifdef HAVE_LIBTIFF
00006 
00007 #include <tiffio.h>
00008 
00009 #include <qimage.h>
00010 #include <qfile.h>
00011 
00012 #include "g3r.h"
00013 
00014 KDE_EXPORT void kimgio_g3_read( QImageIO *io )
00015 {
00016     // This won't work if io is not a QFile !
00017   TIFF *tiff = TIFFOpen(QFile::encodeName(io->fileName()), "r");  
00018   if (!tiff)
00019     return;
00020  
00021   uint32 width, height;
00022   tsize_t scanlength;
00023 
00024   if( TIFFGetField( tiff, TIFFTAG_IMAGEWIDTH, &width ) != 1
00025       || TIFFGetField( tiff, TIFFTAG_IMAGELENGTH, &height ) != 1 )
00026       return;
00027   scanlength = TIFFScanlineSize(tiff);
00028 
00029   QImage image(width, height, 1, 0, QImage::BigEndian);
00030   
00031   if (image.isNull() || scanlength != image.bytesPerLine())
00032     {
00033       TIFFClose(tiff);
00034       return;
00035     }
00036 
00037   for (uint32 y=0; y < height; y++)
00038     TIFFReadScanline(tiff, image.scanLine(y), y);
00039 
00040   TIFFClose(tiff);
00041   
00042   io->setImage(image);
00043   io->setStatus(0);
00044 }
00045 
00046 
00047 KDE_EXPORT void kimgio_g3_write(QImageIO *)
00048 {
00049     // TODO: stub
00050 }
00051 
00052 
00053 #endif

KImgIO

Skip menu "KImgIO"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal