Exiv2
Loading...
Searching...
No Matches
preview.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#ifndef PREVIEW_HPP_
4#define PREVIEW_HPP_
5
6// *****************************************************************************
7#include "exiv2lib_export.h"
8
9#include "image.hpp"
10
11// *****************************************************************************
12// namespace extensions
13namespace Exiv2 {
14// *****************************************************************************
15// class definitions
16
18using PreviewId = int;
19
23struct EXIV2API PreviewProperties {
24 std::string mimeType_;
25 std::string extension_;
26 size_t size_{};
27 size_t width_{};
28 size_t height_{};
29 PreviewId id_{};
30};
31
33using PreviewPropertiesList = std::vector<PreviewProperties>;
34
38class EXIV2API PreviewImage {
39 friend class PreviewManager;
40
41 public:
43
44
45 PreviewImage(const PreviewImage& rhs);
47
48 ~PreviewImage() = default;
49
51
52
53 PreviewImage& operator=(const PreviewImage& rhs);
55
57
58
62 [[nodiscard]] DataBuf copy() const;
66 [[nodiscard]] const byte* pData() const;
70 [[nodiscard]] uint32_t size() const;
81 [[nodiscard]] size_t writeFile(const std::string& path) const;
86 [[nodiscard]] std::string mimeType() const;
91 [[nodiscard]] std::string extension() const;
95 [[nodiscard]] size_t width() const;
99 [[nodiscard]] size_t height() const;
103 [[nodiscard]] PreviewId id() const;
105
106 private:
108 PreviewImage(PreviewProperties properties, DataBuf&& data);
109
110 PreviewProperties properties_;
111 DataBuf preview_;
112
113}; // class PreviewImage
114
118class EXIV2API PreviewManager {
119 public:
121
122
123 explicit PreviewManager(const Image& image);
125
127
128
133 [[nodiscard]] PreviewPropertiesList getPreviewProperties() const;
137 [[nodiscard]] PreviewImage getPreviewImage(const PreviewProperties& properties) const;
139
140 private:
141 const Image& image_;
142
143}; // class PreviewManager
144} // namespace Exiv2
145
146#endif // #ifndef PREVIEW_HPP_
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
Class that holds preview image properties and data buffer.
Definition preview.hpp:38
Class for extracting preview images from image metadata.
Definition preview.hpp:118
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
EXIV2API size_t writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition basicio.cpp:1746
std::vector< PreviewProperties > PreviewPropertiesList
Container type to hold all preview images metadata.
Definition preview.hpp:33
int PreviewId
Type of preview image.
Definition preview.hpp:18
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Preview image properties.
Definition preview.hpp:23
std::string extension_
Preview image extension.
Definition preview.hpp:25
std::string mimeType_
Preview image mime type.
Definition preview.hpp:24
List of TIFF compression to MIME type mappings.
Definition tiffimage.cpp:47