Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

Exiv2::Thumbnail Class Reference

Exif Thumbnail image. This abstract base class provides the interface for the thumbnail image that is optionally embedded in the Exif data. More...

#include <exif.hpp>

Inheritance diagram for Exiv2::Thumbnail:

Inheritance graph
[legend]
List of all members.

Public Member Functions

Creators
virtual ~Thumbnail ()
 Virtual destructor.
Manipulators
virtual int read (const byte *buf, long len, const ExifData &exifData, ByteOrder byteOrder=littleEndian)=0
 Read the thumbnail from the data buffer buf, using Exif metadata exifData. Return 0 if successful.
virtual void setOffsets (Ifd &ifd1, ByteOrder byteOrder)=0
 Update the internal offset and the thumbnail data offsets in IFD1 assuming the thumbnail data follows immediately after IFD1.
Accessors
virtual int write (const std::string &path) const =0
 Write thumbnail to file path.
virtual const char * format () const =0
 Return a short string for the format of the thumbnail ("TIFF", "JPEG").
virtual const char * extension () const =0
 Return the file extension for the format of the thumbnail (".tif", ".jpg").
virtual long copy (byte *buf) const =0
 Copy the thumbnail image data (without the IFD, if any) to the data buffer buf. The user must ensure that the buffer has enough memory. Otherwise the call results in undefined behaviour. Return the number of characters written.
virtual void update (ExifData &exifData) const =0
 Update the Exif data according to the actual thumbnail image.
virtual long offset () const =0
 Return the position of the thumbnail image data from the start of the TIFF header in the original Exif data.
virtual long size () const =0
 Return the size of the thumbnail image (the size it would occupy when extracted from the Exif data).
virtual long dataSize () const =0
 Return the size of the thumbnail data (data only, without the IFD, in case of a TIFF thumbnail).

Protected Member Functions

Manipulators
Thumbnailoperator= (const Thumbnail &rhs)
 Assignment operator. Protected so that it can only be used by subclasses but not directly.

Detailed Description

Exif Thumbnail image. This abstract base class provides the interface for the thumbnail image that is optionally embedded in the Exif data.


Member Function Documentation

virtual int Exiv2::Thumbnail::read const byte buf,
long  len,
const ExifData exifData,
ByteOrder  byteOrder = littleEndian
[pure virtual]
 

Read the thumbnail from the data buffer buf, using Exif metadata exifData. Return 0 if successful.

Parameters:
buf Data buffer containing the thumbnail data. The buffer must start with the TIFF header.
len Number of bytes in the data buffer.
exifData Exif data corresponding to the data buffer.
byteOrder The byte order used for the encoding of TIFF thumbnails. It determines the byte order of the resulting thumbnail image, if it is in TIFF format. For JPEG thumbnails the byte order is not used.
Returns:
0 if successful
-1 if there is no thumbnail image in the Exif data
1 in case of inconsistent JPEG thumbnail Exif data
2 in case of inconsistent TIFF thumbnail Exif data

Implemented in Exiv2::TiffThumbnail, and Exiv2::JpegThumbnail.

virtual void Exiv2::Thumbnail::setOffsets Ifd ifd1,
ByteOrder  byteOrder
[pure virtual]
 

Update the internal offset and the thumbnail data offsets in IFD1 assuming the thumbnail data follows immediately after IFD1.

If the type of the thumbnail image is JPEG, JPEGInterchangeFormat is set to point directly behind the data area of IFD1. If the type is TIFF, StripOffsets from the thumbnail image are adjusted to point to the strips, which have to follow immediately after IFD1. Use copy() to write the thumbnail image data. The offset of IFD1 must be set correctly. Changing the size or data size of IFD1 invalidates the thumbnail data offsets set by this method.

Implemented in Exiv2::TiffThumbnail, and Exiv2::JpegThumbnail.

virtual void Exiv2::Thumbnail::update ExifData exifData  )  const [pure virtual]
 

Update the Exif data according to the actual thumbnail image.

If the type of the thumbnail image is JPEG, JPEGInterchangeFormat is set to 0. If the type is TIFF, StripOffsets are set to the offsets of the IFD of the thumbnail image itself.

Implemented in Exiv2::TiffThumbnail, and Exiv2::JpegThumbnail.

virtual int Exiv2::Thumbnail::write const std::string &  path  )  const [pure virtual]
 

Write thumbnail to file path.

Returns:
0 if successful;
-1 if the file couldn't be open;
4 if writing to the output stream failed.

Implemented in Exiv2::TiffThumbnail, and Exiv2::JpegThumbnail.


The documentation for this class was generated from the following file:
Generated on Mon Sep 13 22:01:42 2004 for Exiv2 by doxygen 1.3.8