Exiv2
jp2image.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 /*
22  File: jp2image.cpp
23 */
24 
25 #ifndef JP2IMAGE_HPP_
26 #define JP2IMAGE_HPP_
27 
28 // *****************************************************************************
29 #include "exiv2lib_export.h"
30 
31 // included header files
32 #include "image.hpp"
33 
34 // *****************************************************************************
35 // namespace extensions
36 namespace Exiv2
37 {
38 
39 // *****************************************************************************
40 // class definitions
41 
42  // Add JPEG-2000 to the supported image formats
43  namespace ImageType
44  {
45  const int jp2 = 15;
46  }
47 
51  class EXIV2API Jp2Image : public Image {
52  public:
54 
55 
69  Jp2Image(BasicIo::AutoPtr io, bool create);
71 
73 
74  void readMetadata();
75  void writeMetadata();
76 
83  void printStructure(std::ostream& out, PrintStructureOption option,int depth);
84 
89  void setComment(const std::string& comment);
91 
93 
94  std::string mimeType() const;
96 
97  private:
99 
100  Jp2Image(const Jp2Image& rhs);
103  Jp2Image& operator=(const Jp2Image& rhs);
111  void doWriteMetadata(BasicIo& oIo);
112 
118  void encodeJp2Header(const DataBuf& oldData,DataBuf& newData);
120 
121  }; // class Jp2Image
122 
123 // *****************************************************************************
124 // template, inline and free functions
125 
126  // These could be static private functions on Image subclasses but then
127  // ImageFactory needs to be made a friend.
133  EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create);
134 
136  EXIV2API bool isJp2Type(BasicIo& iIo, bool advance);
137 
138 } // namespace Exiv2
139 
140 #endif // #ifndef JP2IMAGE_HPP_
Class to access JPEG-2000 images.
Definition: jp2image.hpp:51
An interface for simple binary IO.
Definition: basicio.hpp:55
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:84
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
PrintStructureOption
Options for printStructure.
Definition: image.hpp:67
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
EXIV2API bool isJp2Type(BasicIo &iIo, bool advance)
Check if the file iIo is a JPEG-2000 image.
Definition: jp2image.cpp:943
IPTC string type.
Definition: types.hpp:147
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2 type for the Exif user comment.
Definition: types.hpp:150
EXIV2API Image::AutoPtr newJp2Instance(BasicIo::AutoPtr io, bool create)
Create a new Jp2Image instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition: jp2image.cpp:933
const int jp2
JPEG-2000 image type.
Definition: jp2image.hpp:45