Blame include/exiv2/psdimage.hpp

Packit Service 21b5d1
// ***************************************************************** -*- C++ -*-
Packit Service 21b5d1
/*
Packit Service 21b5d1
 * Copyright (C) 2004-2018 Exiv2 authors
Packit Service 21b5d1
 * This program is part of the Exiv2 distribution.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is free software; you can redistribute it and/or
Packit Service 21b5d1
 * modify it under the terms of the GNU General Public License
Packit Service 21b5d1
 * as published by the Free Software Foundation; either version 2
Packit Service 21b5d1
 * of the License, or (at your option) any later version.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is distributed in the hope that it will be useful,
Packit Service 21b5d1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 21b5d1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 21b5d1
 * GNU General Public License for more details.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * You should have received a copy of the GNU General Public License
Packit Service 21b5d1
 * along with this program; if not, write to the Free Software
Packit Service 21b5d1
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit Service 21b5d1
 */
Packit Service 21b5d1
/*!
Packit Service 21b5d1
  @file    psdimage.hpp
Packit Service 21b5d1
  @brief   Photoshop image, implemented using the following references:
Packit Service 21b5d1
           Adobe Photoshop 6.0 File Format Specification by Adobe
Packit Service 21b5d1
  @author  Marco Piovanelli, Ovolab (marco)
Packit Service 21b5d1
           marco.piovanelli@pobox.com
Packit Service 21b5d1
  @author  Michael Ulbrich
Packit Service 21b5d1
           mul@rentapacs.de
Packit Service 21b5d1
  @date    05-Mar-2007, marco: created
Packit Service 21b5d1
 */
Packit Service 21b5d1
#ifndef PSDIMAGE_HPP_
Packit Service 21b5d1
#define PSDIMAGE_HPP_
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
#include "exiv2lib_export.h"
Packit Service 21b5d1
Packit Service 21b5d1
// included header files
Packit Service 21b5d1
#include "image.hpp"
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// namespace extensions
Packit Service 21b5d1
namespace Exiv2 {
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// class definitions
Packit Service 21b5d1
Packit Service 21b5d1
    // Add PSD to the supported image formats
Packit Service 21b5d1
    namespace ImageType {
Packit Service 21b5d1
        const int psd = 12; //!< Photoshop (PSD) image type (see class PsdImage)
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Class to access raw Photoshop images.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class EXIV2API PsdImage : public Image {
Packit Service 21b5d1
        //! @name NOT Implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor
Packit Service 21b5d1
        PsdImage(const PsdImage& rhs);
Packit Service 21b5d1
        //! Assignment operator
Packit Service 21b5d1
        PsdImage& operator=(const PsdImage& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Constructor to open a Photoshop image. Since the
Packit Service 21b5d1
              constructor can not return a result, callers should check the
Packit Service 21b5d1
              good() method after object construction to determine success
Packit Service 21b5d1
              or failure.
Packit Service 21b5d1
          @param io An auto-pointer that owns a BasicIo instance used for
Packit Service 21b5d1
              reading and writing image metadata. \b Important: The constructor
Packit Service 21b5d1
              takes ownership of the passed in BasicIo instance through the
Packit Service 21b5d1
              auto-pointer. Callers should not continue to use the BasicIo
Packit Service 21b5d1
              instance after it is passed to this method.  Use the Image::io()
Packit Service 21b5d1
              method to get a temporary reference.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        explicit PsdImage(BasicIo::AutoPtr io);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        void readMetadata();
Packit Service 21b5d1
        void writeMetadata();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Not supported. Calling this function will throw an Error(kerInvalidSettingForImage).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setComment(const std::string& comment);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the MIME type of the image.
Packit Service 21b5d1
Packit Service 21b5d1
          The MIME type returned for Photoshop images is "image/x-photoshop".
Packit Service 21b5d1
Packit Service 21b5d1
          @note This should really be "image/vnd.adobe.photoshop"
Packit Service 21b5d1
              (officially registered with IANA in December 2005 -- see
Packit Service 21b5d1
              http://www.iana.org/assignments/media-types/image/vnd.adobe.photoshop)
Packit Service 21b5d1
              but Apple, as of Tiger (10.4.8), maps this official MIME type to a
Packit Service 21b5d1
              dynamic UTI, rather than "com.adobe.photoshop-image" as it should.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        std::string mimeType() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        void readResourceBlock(uint16_t resourceId, uint32_t resourceSize);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Provides the main implementation of writeMetadata() by
Packit Service 21b5d1
                writing all buffered metadata to the provided BasicIo.
Packit Service 21b5d1
          @param oIo BasicIo instance to write to (a temporary location).
Packit Service 21b5d1
Packit Service 21b5d1
          @return 4 if opening or writing to the associated BasicIo fails
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void doWriteMetadata(BasicIo& oIo);
Packit Service 21b5d1
        uint32_t writeExifData(const ExifData& exifData, BasicIo& out);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        uint32_t writeIptcData(const IptcData& iptcData, BasicIo& out) const;
Packit Service 21b5d1
        uint32_t writeXmpData(const XmpData& xmpData, BasicIo& out) const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class PsdImage
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// template, inline and free functions
Packit Service 21b5d1
Packit Service 21b5d1
    // These could be static private functions on Image subclasses but then
Packit Service 21b5d1
    // ImageFactory needs to be made a friend.
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Create a new PsdImage instance and return an auto-pointer to it.
Packit Service 21b5d1
             Caller owns the returned object and the auto-pointer ensures that
Packit Service 21b5d1
             it will be deleted.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    EXIV2API Image::AutoPtr newPsdInstance(BasicIo::AutoPtr io, bool create);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Check if the file iIo is a Photoshop image.
Packit Service 21b5d1
    EXIV2API bool isPsdType(BasicIo& iIo, bool advance);
Packit Service 21b5d1
Packit Service 21b5d1
}                                       // namespace Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
#endif                                  // #ifndef PSDIMAGE_HPP_