Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
#define TIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tsmartpointer.h"
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TIMAGE_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPalette;
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! This is an abstract class representing an image.
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
        */
Shinya Kitaoka 120a6e
class DVAPI TImage : public TSmartObject {
Shinya Kitaoka 120a6e
  DECLARE_CLASS_CODE
Shinya Kitaoka 120a6e
  TPalette *m_palette;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
public:
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          This class represents an interface to a generic image object.
Shinya Kitaoka 120a6e
          An image can be:
Shinya Kitaoka 120a6e
  \li raster, i.e. a data structure representing a generally rectangular grid of
Shinya Kitaoka 120a6e
pixels,
Shinya Kitaoka 120a6e
          or points of color or a vector image,
Shinya Kitaoka 120a6e
\li vector, i.e. an image represented by geometrical primitives such as points,
Shinya Kitaoka 120a6e
lines, curves, and shapes or polygon(s),
Shinya Kitaoka 120a6e
      which are all based upon mathematical equations
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
  TImage();
Shinya Kitaoka 120a6e
  virtual ~TImage();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
  This enum
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  enum Type {
Shinya Kitaoka 120a6e
    NONE         = 0,  //!< Not a recognized image (should never happen).
Shinya Kitaoka 120a6e
    RASTER       = 1,  //!< A fullcolor raster image.
Shinya Kitaoka 120a6e
    VECTOR       = 2,  //!< A vector image.
Shinya Kitaoka 120a6e
    TOONZ_RASTER = 3,  //!< A colormap raster image.
Shinya Kitaoka 120a6e
    MESH         = 4   //!< A textured mesh image.
Shinya Kitaoka 120a6e
  };
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          This method must return the type of the image. \sa Type.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual Type getType() const = 0;
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          This method must return the bounding box of the image.
Shinya Kitaoka 120a6e
          The bounding box is the minimum rectangle containing the image.
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  virtual TRectD getBBox() const = 0;
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          This method must return a pointer to a newly created image that is a
Shinya Kitaoka 120a6e
     clone of \e this.
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
  virtual TImage *cloneImage() const = 0;
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          Returns a pointer to the palette associated to this image. A palette
Shinya Kitaoka 120a6e
     is a
Shinya Kitaoka 120a6e
          limited set of colors, identified by indexes and composed by a
Shinya Kitaoka 120a6e
     combination of
Shinya Kitaoka 120a6e
          primitive colors, i.e. RGB color.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual TRasterP raster() const { return TRasterP(); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPalette *getPalette() const { return m_palette; }
Shinya Kitaoka 120a6e
  /*!
Shinya Kitaoka 120a6e
          Sets the \e palette for this image.
Shinya Kitaoka 120a6e
  */
Shinya Kitaoka 120a6e
  virtual void setPalette(TPalette *palette);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  // not implemented
Shinya Kitaoka 120a6e
  TImage(const TImage &);
Shinya Kitaoka 120a6e
  TImage &operator=(const TImage &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<timage>;</timage>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TSmartPointerT<timage> TImageP;</timage>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif