Exiv2
tiffimage.hpp
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
20 /*
21  File: tiffimage.hpp
22  */
23 
24 #ifndef TIFFIMAGE_HPP_
25 #define TIFFIMAGE_HPP_
26 
27 // *****************************************************************************
28 #include "exiv2lib_export.h"
29 
30 // included header files
31 #include "image.hpp"
32 
33 // *****************************************************************************
34 // namespace extensions
35 namespace Exiv2 {
36 
37 // *****************************************************************************
38 // class definitions
39 
40  // Add TIFF to the supported image formats
41  namespace ImageType {
42  const int tiff = 4;
43  const int dng = 4;
44  const int nef = 4;
45  const int pef = 4;
46  const int arw = 4;
47  const int sr2 = 4;
48  const int srw = 4;
49  }
50 
55  class EXIV2API TiffImage : public Image {
56  public:
58 
59 
74  TiffImage(BasicIo::AutoPtr io, bool create);
76 
78 
79  void readMetadata();
80  void writeMetadata();
81 
88  virtual void printStructure(std::ostream& out, PrintStructureOption option,int depth=0);
89 
94  void setComment(const std::string& comment);
96 
98 
99  std::string mimeType() const;
100  int pixelWidth() const;
101  int pixelHeight() const;
103 
104  private:
106 
107  TiffImage(const TiffImage& rhs);
110  TiffImage& operator=(const TiffImage& rhs);
112 
114 
115  std::string primaryGroup() const;
118 
119  private:
120  // DATA
121  mutable std::string primaryGroup_;
122  mutable std::string mimeType_;
123  mutable int pixelWidth_;
124  mutable int pixelHeight_;
125 
126  }; // class TiffImage
127 
133  class EXIV2API TiffParser {
134  public:
148  static ByteOrder decode(
149  ExifData& exifData,
150  IptcData& iptcData,
151  XmpData& xmpData,
152  const byte* pData,
153  uint32_t size
154  );
188  static WriteMethod encode(
189  BasicIo& io,
190  const byte* pData,
191  uint32_t size,
192  ByteOrder byteOrder,
193  const ExifData& exifData,
194  const IptcData& iptcData,
195  const XmpData& xmpData
196  );
197 
198  }; // class TiffParser
199 
200 // *****************************************************************************
201 // template, inline and free functions
202 
203  // These could be static private functions on Image subclasses but then
204  // ImageFactory needs to be made a friend.
210  EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create);
211 
213  EXIV2API bool isTiffType(BasicIo& iIo, bool advance);
214 
215 } // namespace Exiv2
216 
217 #endif // #ifndef TIFFIMAGE_HPP_
An interface for simple binary IO.
Definition: basicio.hpp:55
const int dng
DNG image type (see class TiffImage)
Definition: tiffimage.hpp:43
EXIV2API bool isTiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a TIFF image.
Definition: tiffimage.cpp:319
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition: xmp_exiv2.hpp:173
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:84
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:113
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:105
const int pef
PEF image type (see class TiffImage)
Definition: tiffimage.hpp:45
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
const int arw
ARW image type (see class TiffImage)
Definition: tiffimage.hpp:46
PrintStructureOption
Options for printStructure.
Definition: image.hpp:67
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:173
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition: types.hpp:116
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
const int srw
SRW image type (see class TiffImage)
Definition: tiffimage.hpp:48
EXIV2API Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create)
Create a new TiffImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition: tiffimage.cpp:310
IPTC string type.
Definition: types.hpp:147
Class to access TIFF images. Exif metadata is supported directly, IPTC is read from the Exif data...
Definition: tiffimage.hpp:55
const int nef
NEF image type (see class TiffImage)
Definition: tiffimage.hpp:44
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
const int tiff
TIFF image type (see class TiffImage)
Definition: tiffimage.hpp:42
Exiv2 type for the Exif user comment.
Definition: types.hpp:150
const int sr2
SR2 image type (see class TiffImage)
Definition: tiffimage.hpp:47
Stateless parser class for data in TIFF format. Images use this class to decode and encode TIFF data...
Definition: tiffimage.hpp:133