Loading...
Searching...
No Matches
pngchunk_int.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef PNGCHUNK_INT_HPP_
#define PNGCHUNK_INT_HPP_
// *****************************************************************************
// included header files
#include "pngimage.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2::Internal {
// *****************************************************************************
// class definitions
class PngChunk {
public:
enum TxtChunkType { tEXt_Chunk = 0, zTXt_Chunk = 1, iTXt_Chunk = 2 };
static void decodeIHDRChunk(const DataBuf& data, uint32_t* outWidth, uint32_t* outHeight);
static void decodeTXTChunk(Image* pImage, const DataBuf& data, TxtChunkType type);
static DataBuf decodeTXTChunk(const DataBuf& data, TxtChunkType type);
static DataBuf keyTXTChunk(const DataBuf& data, bool stripHeader = false);
static std::string makeMetadataChunk(const std::string& metadata, MetadataId type);
private:
static DataBuf parseTXTChunk(const DataBuf& data, size_t keysize, TxtChunkType type);
static void parseChunkContent(Image* pImage, const byte* key, size_t keySize, const DataBuf& arr);
static std::string makeAsciiTxtChunk(const std::string& keyword, const std::string& text, bool compress);
static std::string makeUtf8TxtChunk(const std::string& keyword, const std::string& text, bool compress);
static void zlibUncompress(const byte* compressedText, unsigned int compressedTextSize, DataBuf& arr);
static std::string zlibCompress(const std::string& text);
static DataBuf readRawProfile(const DataBuf& text, bool iTXt);
static std::string writeRawProfile(const std::string& profileData, const char* profileType);
friend class Exiv2::PngImage;
}; // class PngChunk
} // namespace Exiv2::Internal
#endif // #ifndef PNGCHUNK_INT_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::Internal::PngChunk
Stateless parser class for data in PNG chunk format. Images use this class to decode and encode PNG-b...
Definition pngchunk_int.hpp:21
Exiv2::Internal::PngChunk::decodeIHDRChunk
static void decodeIHDRChunk(const DataBuf &data, uint32_t *outWidth, uint32_t *outHeight)
Decode PNG IHDR chunk data from a data buffer data and return image size to outWidth and outHeight.
Exiv2::Internal::PngChunk::decodeTXTChunk
static DataBuf decodeTXTChunk(const DataBuf &data, TxtChunkType type)
Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment,...
Exiv2::Internal::PngChunk::keyTXTChunk
static DataBuf keyTXTChunk(const DataBuf &data, bool stripHeader=false)
Return PNG TXT chunk key as data buffer.
Exiv2::Internal::PngChunk::TxtChunkType
TxtChunkType
Text Chunk types.
Definition pngchunk_int.hpp:26
Exiv2::Internal::PngChunk::decodeTXTChunk
static void decodeTXTChunk(Image *pImage, const DataBuf &data, TxtChunkType type)
Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment,...
Exiv2::Internal::PngChunk::makeMetadataChunk
static std::string makeMetadataChunk(const std::string &metadata, MetadataId type)
Return a complete PNG chunk data compressed or not as buffer. Data returned is formatted accordingly ...
Exiv2::PngImage
Class to access PNG images. Exif and IPTC metadata are supported directly.
Definition pngimage.hpp:22
Exiv2::Internal
Helper structure for the Matroska tags lookup table.
Definition matroskavideo.hpp:39
Exiv2::MetadataId
MetadataId
An identifier for each type of metadata.
Definition types.hpp:47
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124