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
		
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
class DVAPI TImage : public TSmartObject
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	DECLARE_CLASS_CODE
Toshihiro Shimizu 890ddd
	TPalette *m_palette;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		This class represents an interface to a generic image object.
Toshihiro Shimizu 890ddd
		An image can be:
Toshihiro Shimizu 890ddd
	\li raster, i.e. a data structure representing a generally rectangular grid of pixels,
Toshihiro Shimizu 890ddd
		or points of color or a vector image,
Toshihiro Shimizu 890ddd
    \li vector, i.e. an image represented by geometrical primitives such as points, lines, curves, and shapes or polygon(s), 
Toshihiro Shimizu 890ddd
	    which are all based upon mathematical equations 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	TImage();
Toshihiro Shimizu 890ddd
	virtual ~TImage();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
	This enum 
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	enum Type {
Toshihiro Shimizu 890ddd
		NONE = 0,		  //!< Not a recognized image (should never happen).
Toshihiro Shimizu 890ddd
		RASTER = 1,		  //!< A fullcolor raster image.
Toshihiro Shimizu 890ddd
		VECTOR = 2,		  //!< A vector image.
Toshihiro Shimizu 890ddd
		TOONZ_RASTER = 3, //!< A colormap raster image.
Toshihiro Shimizu 890ddd
		MESH = 4		  //!< A textured mesh image.
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		This method must return the type of the image. \sa Type.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual Type getType() const = 0;
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		This method must return the bounding box of the image.
Toshihiro Shimizu 890ddd
		The bounding box is the minimum rectangle containing the image.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual TRectD getBBox() const = 0;
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		This method must return a pointer to a newly created image that is a clone of \e this. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	virtual TImage *cloneImage() const = 0;
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Returns a pointer to the palette associated to this image. A palette is a 
Toshihiro Shimizu 890ddd
		limited set of colors, identified by indexes and composed by a combination of
Toshihiro Shimizu 890ddd
		primitive colors, i.e. RGB color. 
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TRasterP raster() const { return TRasterP(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPalette *getPalette() const { return m_palette; }
Toshihiro Shimizu 890ddd
	/*!
Toshihiro Shimizu 890ddd
		Sets the \e palette for this image.
Toshihiro Shimizu 890ddd
	*/
Toshihiro Shimizu 890ddd
	virtual void setPalette(TPalette *palette);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	// not implemented
Toshihiro Shimizu 890ddd
	TImage(const TImage &);
Toshihiro Shimizu 890ddd
	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