Loading...
Searching...
No Matches
preview.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef PREVIEW_HPP_
#define PREVIEW_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
using PreviewId = int;
struct EXIV2API PreviewProperties {
std::string mimeType_;
std::string extension_;
size_t size_{};
size_t width_{};
size_t height_{};
PreviewId id_{};
};
using PreviewPropertiesList = std::vector<PreviewProperties>;
class EXIV2API PreviewImage {
friend class PreviewManager;
public:
PreviewImage(const PreviewImage& rhs);
~PreviewImage() = default;
PreviewImage& operator=(const PreviewImage& rhs);
[[nodiscard]] DataBuf copy() const;
[[nodiscard]] const byte* pData() const;
[[nodiscard]] uint32_t size() const;
#ifdef EXV_ENABLE_FILESYSTEM
[[nodiscard]] size_t writeFile(const std::string& path) const;
#endif
[[nodiscard]] std::string mimeType() const;
[[nodiscard]] std::string extension() const;
[[nodiscard]] size_t width() const;
[[nodiscard]] size_t height() const;
[[nodiscard]] PreviewId id() const;
private:
PreviewImage(PreviewProperties properties, DataBuf&& data);
PreviewProperties properties_;
DataBuf preview_;
}; // class PreviewImage
class EXIV2API PreviewManager {
public:
explicit PreviewManager(const Image& image);
[[nodiscard]] PreviewPropertiesList getPreviewProperties() const;
[[nodiscard]] PreviewImage getPreviewImage(const PreviewProperties& properties) const;
private:
const Image& image_;
}; // class PreviewManager
} // namespace Exiv2
#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::writeFile
size_t writeFile(const std::string &path) const
Write the thumbnail image to a file.
Exiv2::PreviewManager
Class for extracting preview images from image metadata.
Definition preview.hpp:120
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::PreviewPropertiesList
std::vector< PreviewProperties > PreviewPropertiesList
Container type to hold all preview images metadata.
Definition preview.hpp:33
Exiv2::PreviewId
int PreviewId
Type of preview image.
Definition preview.hpp:18
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::mimeType_
std::string mimeType_
Preview image mime type.
Definition preview.hpp:24
Exiv2::mimeType
List of TIFF compression to MIME type mappings.
Definition tiffimage.cpp:47