Exiv2
jp2image.hpp
1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2021 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
36namespace 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::UniquePtr io, bool create);
71
73
74 void readMetadata() override;
75 void writeMetadata() override;
76
83 void printStructure(std::ostream& out, PrintStructureOption option, int depth) override;
84
89 void setComment(const std::string& comment) override;
91
93
94 std::string mimeType() const override;
96
98
99
100 Jp2Image(const Jp2Image& rhs) = delete;
102 Jp2Image& operator=(const Jp2Image& rhs) = delete;
103
104 private:
112 void doWriteMetadata(BasicIo& outIo);
113
119 void encodeJp2Header(const DataBuf& boxBuf, DataBuf& outBuf);
121
122 }; // class Jp2Image
123
124// *****************************************************************************
125// template, inline and free functions
126
127 // These could be static private functions on Image subclasses but then
128 // ImageFactory needs to be made a friend.
134 EXIV2API Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create);
135
137 EXIV2API bool isJp2Type(BasicIo& iIo, bool advance);
138
139} // namespace Exiv2
140
141#endif // #ifndef JP2IMAGE_HPP_
An interface for simple binary IO.
Definition: basicio.hpp:55
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition: image.hpp:81
Class to access JPEG-2000 images.
Definition: jp2image.hpp:51
Jp2Image & operator=(const Jp2Image &rhs)=delete
Assignment operator.
Jp2Image(const Jp2Image &rhs)=delete
Copy constructor.
const int jp2
JPEG-2000 image type.
Definition: jp2image.hpp:45
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: basicio.hpp:43
EXIV2API bool isJp2Type(BasicIo &iIo, bool advance)
Check if the file iIo is a JPEG-2000 image.
Definition: jp2image.cpp:978
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:120
EXIV2API Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, bool create)
Create a new Jp2Image instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition: jp2image.cpp:968
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:162