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 bmpimage.hpp |
23 | @brief Windows Bitmap (BMP) image |
24 | @version $Rev: 3091 $ |
25 | @author Marco Piovanelli, Ovolab (marco) |
26 | <a href="mailto:marco.piovanelli@pobox.com">marco.piovanelli@pobox.com</a> |
27 | @date 05-Mar-2007, marco: created |
28 | */ |
29 | #ifndef BMPIMAGE_HPP_ |
30 | #define BMPIMAGE_HPP_ |
31 | |
32 | // ***************************************************************************** |
33 | // included header files |
34 | #include "exif.hpp" |
35 | #include "iptc.hpp" |
36 | #include "image.hpp" |
37 | #include "types.hpp" |
38 | |
39 | // + standard includes |
40 | #include <string> |
41 | |
42 | // ***************************************************************************** |
43 | // namespace extensions |
44 | namespace Exiv2 { |
45 | |
46 | // ***************************************************************************** |
47 | // class definitions |
48 | |
49 | // Add Windows Bitmap (BMP) to the supported image formats |
50 | namespace ImageType { |
51 | const int bmp = 14; //!< Windows bitmap (bmp) image type (see class BmpImage) |
52 | } |
53 | |
54 | /*! |
55 | @brief Class to access Windows bitmaps. This is just a stub - we only |
56 | read width and height. |
57 | */ |
58 | class EXIV2API BmpImage : public Image { |
59 | //! @name NOT Implemented |
60 | //@{ |
61 | //! Copy constructor |
62 | BmpImage(const BmpImage& rhs); |
63 | //! Assignment operator |
64 | BmpImage& operator=(const BmpImage& rhs); |
65 | //@} |
66 | |
67 | public: |
68 | //! @name Creators |
69 | //@{ |
70 | /*! |
71 | @brief Constructor to open a Windows bitmap image. Since the |
72 | constructor can not return a result, callers should check the |
73 | good() method after object construction to determine success |
74 | or failure. |
75 | @param io An auto-pointer that owns a BasicIo instance used for |
76 | reading and writing image metadata. \b Important: The constructor |
77 | takes ownership of the passed in BasicIo instance through the |
78 | auto-pointer. Callers should not continue to use the BasicIo |
79 | instance after it is passed to this method. Use the Image::io() |
80 | method to get a temporary reference. |
81 | */ |
82 | BmpImage(BasicIo::AutoPtr io); |
83 | //@} |
84 | |
85 | //! @name Manipulators |
86 | //@{ |
87 | void readMetadata(); |
88 | /*! |
89 | @brief Todo: Write metadata back to the image. This method is not |
90 | yet(?) implemented. Calling it will throw an Error(31). |
91 | */ |
92 | void writeMetadata(); |
93 | /*! |
94 | @brief Todo: Not supported yet(?). Calling this function will throw |
95 | an instance of Error(32). |
96 | */ |
97 | void setExifData(const ExifData& exifData); |
98 | /*! |
99 | @brief Todo: Not supported yet(?). Calling this function will throw |
100 | an instance of Error(32). |
101 | */ |
102 | void setIptcData(const IptcData& iptcData); |
103 | /*! |
104 | @brief Not supported. Calling this function will throw an instance |
105 | of Error(32). |
106 | */ |
107 | void (const std::string& ); |
108 | //@} |
109 | |
110 | //! @name Accessors |
111 | //@{ |
112 | std::string mimeType() const; |
113 | //@} |
114 | |
115 | }; // class BmpImage |
116 | |
117 | // ***************************************************************************** |
118 | // template, inline and free functions |
119 | |
120 | // These could be static private functions on Image subclasses but then |
121 | // ImageFactory needs to be made a friend. |
122 | /*! |
123 | @brief Create a new BmpImage instance and return an auto-pointer to it. |
124 | Caller owns the returned object and the auto-pointer ensures that |
125 | it will be deleted. |
126 | */ |
127 | EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create); |
128 | |
129 | //! Check if the file iIo is a Windows Bitmap image. |
130 | EXIV2API bool isBmpType(BasicIo& iIo, bool advance); |
131 | |
132 | } // namespace Exiv2 |
133 | |
134 | #endif // #ifndef BMPIMAGE_HPP_ |
135 | |