• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KImgIO

  • sources
  • kde-4.14
  • kdelibs
  • kimgio
g3r.cpp
Go to the documentation of this file.
1 
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 
QImage::scanLine
uchar * scanLine(int i)
QImage::isNull
bool isNull() const
g3r.h
QImage
QImage::bytesPerLine
int bytesPerLine() const
kimgio_g3_write
void kimgio_g3_write(QImageIO *)
Definition: g3r.cpp:50
QFile::encodeName
QByteArray encodeName(const QString &fileName)
kimgio_g3_read
void kimgio_g3_read(QImageIO *io)
QImageIO Routines to read/write g3 (fax) images.
Definition: g3r.cpp:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KImgIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal