1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2013 Andreas Huggel <ahuggel@gmx.net>
4 *
5 * This program is part of the Exiv2 distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
20 */
21/*!
22 @file gifimage.hpp
23 @brief GIF image, implemented using the following references:
24 <a href="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">GIF89 specification</a> by W3C<br>
25 @version $Rev: 3091 $
26 @author Marco Piovanelli, Ovolab (marco)
27 <a href="mailto:marco.piovanelli@pobox.com">marco.piovanelli@pobox.com</a>
28 @date 26-Feb-2007, marco: created
29 */
30#ifndef GIFIMAGE_HPP_
31#define GIFIMAGE_HPP_
32
33// *****************************************************************************
34// included header files
35#include "exif.hpp"
36#include "iptc.hpp"
37#include "image.hpp"
38#include "types.hpp"
39
40// + standard includes
41#include <string>
42
43// *****************************************************************************
44// namespace extensions
45namespace Exiv2 {
46
47// *****************************************************************************
48// class definitions
49
50 // Add GIF to the supported image formats
51 namespace ImageType {
52 const int gif = 11; //!< GIF image type (see class GifImage)
53 }
54
55 /*!
56 @brief Class to access raw GIF images. Exif/IPTC metadata are supported
57 directly.
58 */
59 class EXIV2API GifImage : public Image {
60 //! @name NOT Implemented
61 //@{
62 //! Copy constructor
63 GifImage(const GifImage& rhs);
64 //! Assignment operator
65 GifImage& operator=(const GifImage& rhs);
66 //@}
67
68 public:
69 //! @name Creators
70 //@{
71 /*!
72 @brief Constructor to open a GIF image. Since the
73 constructor can not return a result, callers should check the
74 good() method after object construction to determine success
75 or failure.
76 @param io An auto-pointer that owns a BasicIo instance used for
77 reading and writing image metadata. \b Important: The constructor
78 takes ownership of the passed in BasicIo instance through the
79 auto-pointer. Callers should not continue to use the BasicIo
80 instance after it is passed to this method. Use the Image::io()
81 method to get a temporary reference.
82 */
83 GifImage(BasicIo::AutoPtr io);
84 //@}
85
86 //! @name Manipulators
87 //@{
88 void readMetadata();
89 /*!
90 @brief Todo: Write metadata back to the image. This method is not
91 yet(?) implemented. Calling it will throw an Error(31).
92 */
93 void writeMetadata();
94 /*!
95 @brief Todo: Not supported yet(?). Calling this function will throw
96 an instance of Error(32).
97 */
98 void setExifData(const ExifData& exifData);
99 /*!
100 @brief Todo: Not supported yet(?). Calling this function will throw
101 an instance of Error(32).
102 */
103 void setIptcData(const IptcData& iptcData);
104 /*!
105 @brief Not supported. Calling this function will throw an instance
106 of Error(32).
107 */
108 void setComment(const std::string& comment);
109 //@}
110
111 //! @name Accessors
112 //@{
113 std::string mimeType() const;
114 //@}
115
116 }; // class GifImage
117
118// *****************************************************************************
119// template, inline and free functions
120
121 // These could be static private functions on Image subclasses but then
122 // ImageFactory needs to be made a friend.
123 /*!
124 @brief Create a new GifImage instance and return an auto-pointer to it.
125 Caller owns the returned object and the auto-pointer ensures that
126 it will be deleted.
127 */
128 EXIV2API Image::AutoPtr newGifInstance(BasicIo::AutoPtr io, bool create);
129
130 //! Check if the file iIo is a GIF image.
131 EXIV2API bool isGifType(BasicIo& iIo, bool advance);
132
133} // namespace Exiv2
134
135#endif // #ifndef GIFIMAGE_HPP_
136