~ubuntu-branches/ubuntu/wily/exiv2/wily-proposed

« back to all changes in this revision

Viewing changes to src/rw2image.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-04-29 21:53:40 UTC
  • mfrom: (1.1.9 upstream) (11.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090429215340-07gk8utx2w8rh0bo
* New upstream release
  - (Closes: #525535): "[libexiv2-5] New upstream version 0.18.1"
  - write-support for Adobe Photoshop PSD images
  - read-support for Panasonic RW2 images
  - Panasonic and Nikon makernote update
* Upload to unstable - discussed on debian-release
  - libexiv2-5 library transition
* Fix: package-lacks-versioned-build-depends-on-debhelper
* Add ${misc:Depends}

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ***************************************************************** -*- C++ -*-
 
2
/*
 
3
 * Copyright (C) 2004-2009 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    rw2image.hpp
 
23
  @brief   Class Rw2Image
 
24
  @version $Rev: 1750 $
 
25
  @author  Andreas Huggel (ahu)
 
26
           <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
 
27
  @date    06-Jan-09, ahu: created
 
28
 */
 
29
#ifndef RW2IMAGE_HPP_
 
30
#define RW2IMAGE_HPP_
 
31
 
 
32
// *****************************************************************************
 
33
// included header files
 
34
#include "image.hpp"
 
35
#include "basicio.hpp"
 
36
#include "types.hpp"
 
37
 
 
38
// + standard includes
 
39
#include <string>
 
40
 
 
41
// *****************************************************************************
 
42
// namespace extensions
 
43
namespace Exiv2 {
 
44
 
 
45
// *****************************************************************************
 
46
// class definitions
 
47
 
 
48
    // Add RW2 to the supported image formats
 
49
    namespace ImageType {
 
50
        const int rw2 = 16;             //!< RW2 image type (see class Rw2Image)
 
51
    }
 
52
 
 
53
    /*!
 
54
      @brief Class to access raw Panasonic RW2 images.  Exif metadata is
 
55
          supported directly, IPTC and XMP are read from the Exif data, if
 
56
          present.
 
57
     */
 
58
    class EXIV2API Rw2Image : public Image {
 
59
    public:
 
60
        //! @name Creators
 
61
        //@{
 
62
        /*!
 
63
          @brief Constructor to open an existing RW2 image. Since the
 
64
              constructor can not return a result, callers should check the
 
65
              good() method after object construction to determine success or
 
66
              failure.
 
67
          @param io An auto-pointer that owns a BasicIo instance used for
 
68
              reading and writing image metadata. \b Important: The constructor
 
69
              takes ownership of the passed in BasicIo instance through the
 
70
              auto-pointer. Callers should not continue to use the BasicIo
 
71
              instance after it is passed to this method.  Use the Image::io()
 
72
              method to get a temporary reference.
 
73
         */
 
74
        Rw2Image(BasicIo::AutoPtr io);
 
75
        //@}
 
76
 
 
77
        //! @name Manipulators
 
78
        //@{
 
79
        void readMetadata();
 
80
        /*!
 
81
          @brief Todo: Write metadata back to the image. This method is not
 
82
              yet implemented. Calling it will throw an Error(31).
 
83
         */
 
84
        void writeMetadata();
 
85
        /*!
 
86
          @brief Todo: Not supported yet, requires writeMetadata(). Calling
 
87
              this function will throw an Error(32).
 
88
         */
 
89
        void setExifData(const ExifData& exifData);
 
90
        /*!
 
91
          @brief Todo: Not supported yet, requires writeMetadata(). Calling
 
92
              this function will throw an Error(32).
 
93
         */
 
94
        void setIptcData(const IptcData& iptcData);
 
95
        /*!
 
96
          @brief Not supported. RW2 format does not contain a comment.
 
97
              Calling this function will throw an Error(32).
 
98
         */
 
99
        void setComment(const std::string& comment);
 
100
        //@}
 
101
 
 
102
        //! @name Accessors
 
103
        //@{
 
104
        std::string mimeType() const { return "image/x-raw"; }
 
105
        int pixelWidth() const;
 
106
        int pixelHeight() const;
 
107
        //@}
 
108
 
 
109
    private:
 
110
        //! @name NOT implemented
 
111
        //@{
 
112
        //! Copy constructor
 
113
        Rw2Image(const Rw2Image& rhs);
 
114
        //! Assignment operator
 
115
        Rw2Image& operator=(const Rw2Image& rhs);
 
116
        //@}
 
117
 
 
118
    }; // class Rw2Image
 
119
 
 
120
    /*!
 
121
      @brief Stateless parser class for data in RW2 format. Images use this
 
122
             class to decode and encode RW2 data. Only decoding is currently
 
123
             implemented. See class TiffParser for details.
 
124
     */
 
125
    class EXIV2API Rw2Parser {
 
126
    public:
 
127
        /*!
 
128
          @brief Decode metadata from a buffer \em pData of length \em size
 
129
                 with data in RW2 format to the provided metadata containers.
 
130
                 See TiffParser::decode().
 
131
        */
 
132
        static ByteOrder decode(
 
133
                  ExifData& exifData,
 
134
                  IptcData& iptcData,
 
135
                  XmpData&  xmpData,
 
136
            const byte*     pData,
 
137
                  uint32_t  size
 
138
        );
 
139
 
 
140
    }; // class Rw2Parser
 
141
 
 
142
// *****************************************************************************
 
143
// template, inline and free functions
 
144
 
 
145
    // These could be static private functions on Image subclasses but then
 
146
    // ImageFactory needs to be made a friend.
 
147
    /*!
 
148
      @brief Create a new Rw2Image instance and return an auto-pointer to it.
 
149
             Caller owns the returned object and the auto-pointer ensures that
 
150
             it will be deleted.
 
151
     */
 
152
    EXIV2API Image::AutoPtr newRw2Instance(BasicIo::AutoPtr io, bool create);
 
153
 
 
154
    //! Check if the file iIo is a RW2 image.
 
155
    EXIV2API bool isRw2Type(BasicIo& iIo, bool advance);
 
156
 
 
157
}                                       // namespace Exiv2
 
158
 
 
159
#endif                                  // #ifndef RW2IMAGE_HPP_