tahoma2d/toonz/sources/include/timage.h

100 lines
2.5 KiB
C
Raw Normal View History

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