| 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
13 namespace Exiv2 {
14// *****************************************************************************
15// class definitions
16
18 using PreviewId = int;
19
23 struct 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
33 using PreviewPropertiesList = std::vector<PreviewProperties>;
34
38 class 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
120 class 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_
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
Exiv2::PreviewImage
Class that holds preview image properties and data buffer.
Definition preview.hpp:38
Exiv2::PreviewImage::size
uint32_t size() const
Return the size of the preview image in bytes.
Definition preview.cpp:987
Exiv2::PreviewImage::operator=
PreviewImage & operator=(const PreviewImage &rhs)
Assignment operator.
Definition preview.cpp:962
Exiv2::PreviewImage::width
size_t width() const
Return the width of the preview image in pixels.
Definition preview.cpp:999
Exiv2::PreviewImage::pData
const byte * pData() const
Return a pointer to the image data for read-only access.
Definition preview.cpp:983
Exiv2::PreviewImage::copy
DataBuf copy() const
Return a copy of the preview image data. The caller owns this copy and DataBuf ensures that it will b...
Definition preview.cpp:979
Exiv2::PreviewImage::mimeType
std::string mimeType() const
Return the MIME type of the preview image, usually either "image/tiff" or "image/jpeg".
Definition preview.cpp:991
Exiv2::PreviewImage::height
size_t height() const
Return the height of the preview image in pixels.
Definition preview.cpp:1003
Exiv2::PreviewImage::id
PreviewId id() const
Return the preview image type identifier.
Definition preview.cpp:1007
Exiv2::PreviewImage::extension
std::string extension() const
Return the file extension for the format of the preview image (".tif" or ".jpg").
Definition preview.cpp:995
Exiv2::PreviewImage::PreviewImage
PreviewImage(const PreviewImage &rhs)
Copy constructor.
Definition preview.cpp:959
Exiv2::PreviewImage::writeFile
size_t writeFile(const std::string &path) const
Write the thumbnail image to a file.
Exiv2::PreviewManager::PreviewManager
PreviewManager(const Image &image)
Constructor.
Definition preview.cpp:1011
Exiv2::PreviewManager::getPreviewProperties
PreviewPropertiesList getPreviewProperties() const
Return the properties of all preview images in a list sorted by preview width * height,...
Definition preview.cpp:1014
Exiv2::PreviewManager::getPreviewImage
PreviewImage getPreviewImage(const PreviewProperties &properties) const
Return the preview image for the given preview properties.
Definition preview.cpp:1030
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::PreviewId
int PreviewId
Type of preview image.
Definition preview.hpp:18
Exiv2::PreviewPropertiesList
std::vector< PreviewProperties > PreviewPropertiesList
Container type to hold all preview images metadata.
Definition preview.hpp:33
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Exiv2::PreviewProperties
Preview image properties.
Definition preview.hpp:23
Exiv2::PreviewProperties::extension_
std::string extension_
Preview image extension.
Definition preview.hpp:25
Exiv2::PreviewProperties::width_
size_t width_
Preview image width in pixels or 0 for unknown width.
Definition preview.hpp:27
Exiv2::PreviewProperties::id_
PreviewId id_
Identifies type of preview image.
Definition preview.hpp:29
Exiv2::PreviewProperties::size_
size_t size_
Preview image size in bytes.
Definition preview.hpp:26
Exiv2::PreviewProperties::height_
size_t height_
Preview image height in pixels or 0 for unknown height.
Definition preview.hpp:28
Exiv2::PreviewProperties::mimeType_
std::string mimeType_
Preview image mime type.
Definition preview.hpp:24