Exiv2
Loading...
Searching...
No Matches
crwimage.hpp
Go to the documentation of this file.
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 */
29#ifndef CRWIMAGE_HPP_
30#define CRWIMAGE_HPP_
31
32// *****************************************************************************
33#include "exiv2lib_export.h"
34
35// included header files
36#include "image.hpp"
37
38// *****************************************************************************
39// namespace extensions
40namespace Exiv2 {
41
42// *****************************************************************************
43// class declarations
44 class ExifData;
45 class IptcData;
46
47// *****************************************************************************
48// class definitions
49
50 // Add CRW to the supported image formats
51 namespace ImageType {
52 const int crw = 3;
53 }
54
59 class EXIV2API CrwImage : public Image {
60 public:
62
63
78 CrwImage(BasicIo::AutoPtr io, bool create);
80
82
83 void readMetadata();
84 void writeMetadata();
89 void setIptcData(const IptcData& iptcData);
91
93
94 std::string mimeType() const;
95 int pixelWidth() const;
96 int pixelHeight() const;
98
99 private:
101
102
103 CrwImage(const CrwImage& rhs);
105 CrwImage& operator=(const CrwImage& rhs);
107
108 }; // class CrwImage
109
113 class EXIV2API CrwParser {
114 public:
130 static void decode(CrwImage* pCrwImage, const byte* pData, uint32_t size);
145 static void encode(
146 Blob& blob,
147 const byte* pData,
148 uint32_t size,
149 const CrwImage* pCrwImage
150 );
151
152 }; // class CrwParser
153
154// *****************************************************************************
155// template, inline and free functions
156
157 // These could be static private functions on Image subclasses but then
158 // ImageFactory needs to be made a friend.
164 EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create);
165
167 EXIV2API bool isCrwType(BasicIo& iIo, bool advance);
168
169} // namespace Exiv2
170
171#endif // #ifndef CRWIMAGE_HPP_
An interface for simple binary IO.
Definition basicio.hpp:55
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition basicio.hpp:58
Class to access raw Canon CRW images. Only Exif metadata and a comment are supported....
Definition crwimage.hpp:59
void writeMetadata()
Write metadata back to the image.
Definition crwimage.cpp:111
int pixelHeight() const
Return the pixel height of the image.
Definition crwimage.cpp:74
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
Definition crwimage.cpp:89
void setIptcData(const IptcData &iptcData)
Not supported. CRW format does not contain IPTC metadata. Calling this function will throw an Error(k...
Definition crwimage.cpp:83
std::string mimeType() const
Return the MIME type of the image.
Definition crwimage.cpp:60
int pixelWidth() const
Return the pixel width of the image.
Definition crwimage.cpp:65
CrwImage(BasicIo::AutoPtr io, bool create)
Constructor that can either open an existing CRW image or create a new image from scratch....
Definition crwimage.cpp:55
Definition crwimage.hpp:113
static void encode(Blob &blob, const byte *pData, uint32_t size, const CrwImage *pCrwImage)
Encode metadata from the CRW image into a data buffer (the binary CRW image).
Definition crwimage.cpp:164
static void decode(CrwImage *pCrwImage, const byte *pData, uint32_t size)
Decode metadata from a Canon CRW image in data buffer pData of length size into crwImage.
Definition crwimage.cpp:143
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition exif.hpp:434
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition image.hpp:81
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition image.cpp:752
virtual IptcData & iptcData()
Returns an IptcData instance containing currently buffered IPTC data.
Definition image.cpp:585
Image(int imageType, uint16_t supportedMetadata, BasicIo::AutoPtr io)
Constructor taking the image type, a bitmap of the supported metadata types and an auto-pointer that ...
Definition image.cpp:167
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:170
Supported image formats.
Definition asfvideo.hpp:42
const int crw
CRW image type (see class CrwImage).
Definition crwimage.hpp:52
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition asfvideo.hpp:36
EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create)
Create a new CrwImage instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition crwimage.cpp:186
std::vector< byte > Blob
Container for binary data.
Definition types.hpp:151
EXIV2API bool isCrwType(BasicIo &iIo, bool advance)
Check if the file iIo is a CRW image.
Definition crwimage.cpp:195