Loading...
Searching...
No Matches
preview.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PREVIEW_HPP_
#define PREVIEW_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
typedef int PreviewId;
struct EXIV2API PreviewProperties {
std::string mimeType_;
std::string extension_;
#ifdef EXV_UNICODE_PATH
std::wstring wextension_;
#endif
uint32_t size_;
uint32_t width_;
uint32_t height_;
PreviewId id_;
};
typedef std::vector<PreviewProperties> PreviewPropertiesList;
class EXIV2API PreviewImage {
friend class PreviewManager;
public:
PreviewImage(const PreviewImage& rhs);
~PreviewImage();
PreviewImage& operator=(const PreviewImage& rhs);
DataBuf copy() const;
const byte* pData() const;
uint32_t size() const;
long writeFile(const std::string& path) const;
#ifdef EXV_UNICODE_PATH
long writeFile(const std::wstring& wpath) const;
#endif
std::string mimeType() const;
std::string extension() const;
#ifdef EXV_UNICODE_PATH
std::wstring wextension() const;
#endif
uint32_t width() const;
uint32_t height() const;
PreviewId id() const;
private:
PreviewImage(const PreviewProperties& properties, DataBuf data);
PreviewProperties properties_;
byte* pData_;
uint32_t size_;
}; // class PreviewImage
class EXIV2API PreviewManager {
public:
explicit PreviewManager(const Image& image);
PreviewPropertiesList getPreviewProperties() const;
PreviewImage getPreviewImage(const PreviewProperties& properties) const;
private:
const Image& image_;
}; // class PreviewManager
} // namespace Exiv2
#endif // #ifndef PREVIEW_HPP_
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:193
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:78
Exiv2::PreviewImage
Class that holds preview image properties and data buffer.
Definition preview.hpp:66
Exiv2::PreviewManager
Class for extracting preview images from image metadata.
Definition preview.hpp:161
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition asfvideo.hpp:36
Exiv2::writeFile
EXIV2API long writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition basicio.cpp:2703
Exiv2::PreviewId
int PreviewId
Type of preview image.
Definition preview.hpp:36
Exiv2::PreviewPropertiesList
std::vector< PreviewProperties > PreviewPropertiesList
Container type to hold all preview images metadata.
Definition preview.hpp:61
Exiv2::PreviewProperties
Preview image properties.
Definition preview.hpp:41
Exiv2::PreviewProperties::size_
uint32_t size_
Preview image size in bytes.
Definition preview.hpp:51
Exiv2::PreviewProperties::extension_
std::string extension_
Preview image extension.
Definition preview.hpp:45
Exiv2::PreviewProperties::height_
uint32_t height_
Preview image height in pixels or 0 for unknown height.
Definition preview.hpp:55
Exiv2::PreviewProperties::width_
uint32_t width_
Preview image width in pixels or 0 for unknown width.
Definition preview.hpp:53
Exiv2::PreviewProperties::id_
PreviewId id_
Identifies type of preview image.
Definition preview.hpp:57
Exiv2::PreviewProperties::mimeType_
std::string mimeType_
Preview image mime type.
Definition preview.hpp:43