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;
71#ifdef EXV_ENABLE_FILESYSTEM
82 [[nodiscard]] size_t writeFile(const std::string& path) const;
83#endif
88 [[nodiscard]] std::string mimeType() const;
93 [[nodiscard]] std::string extension() const;
97 [[nodiscard]] size_t width() const;
101 [[nodiscard]] size_t height() const;
105 [[nodiscard]] PreviewId id() const;
107
108 private:
110 PreviewImage(PreviewProperties properties, DataBuf&& data);
111
112 PreviewProperties properties_;
113 DataBuf preview_;
114
115}; // class PreviewImage
116
120class EXIV2API PreviewManager {
121 public:
123
124
125 explicit PreviewManager(const Image& image);
127
129
130
135 [[nodiscard]] PreviewPropertiesList getPreviewProperties() const;
139 [[nodiscard]] PreviewImage getPreviewImage(const PreviewProperties& properties) const;
141
142 private:
143 const Image& image_;
144
145}; // class PreviewManager
146} // namespace Exiv2
147
148#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
size_t writeFile(const std::string &path) const
Write the thumbnail image to a file.
Class for extracting preview images from image metadata.
Definition preview.hpp:120
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
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