Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TTOONZIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
#define TTOONZIMAGE_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "trastercm.h"
Toshihiro Shimizu 890ddd
#include "tthreadmessage.h"
Toshihiro Shimizu 890ddd
#include "timage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZCORE_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
class TToonzImageP;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! An image containing a Toonz raster.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TToonzImage : public TImage
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! dpi value for x axis
Toshihiro Shimizu 890ddd
	double m_dpix,
Toshihiro Shimizu 890ddd
		//! dpi value for y axis
Toshihiro Shimizu 890ddd
		m_dpiy;
Toshihiro Shimizu 890ddd
	int m_subsampling;
Toshihiro Shimizu 890ddd
	//! The name of the image
Shinya Kitaoka 3bfa54
	std::string m_name;
Toshihiro Shimizu 890ddd
	//! The savebox of the image
Toshihiro Shimizu 890ddd
	TRect m_savebox;
Toshihiro Shimizu 890ddd
	//double m_hPos;
Toshihiro Shimizu 890ddd
	//! The offset of the image
Toshihiro Shimizu 890ddd
	TPoint m_offset;
Toshihiro Shimizu 890ddd
	//! ColorMapped raster of the image.
Toshihiro Shimizu 890ddd
	TRasterCM32P m_ras;
Toshihiro Shimizu 890ddd
	TThread::Mutex m_mutex;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TToonzImage();
Toshihiro Shimizu 890ddd
	TToonzImage(const TRasterCM32P &raster, const TRect &saveBox);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	~TToonzImage();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	//! Is used to clone an existing ToonzImage.
Toshihiro Shimizu 890ddd
	TToonzImage(const TToonzImage &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Not implemented
Toshihiro Shimizu 890ddd
	TToonzImage &operator=(const TToonzImage &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	//! Return the type of the image.
Toshihiro Shimizu 890ddd
	TImage::Type getType() const { return TImage::TOONZ_RASTER; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the size of the Image.
Toshihiro Shimizu 890ddd
	TDimension getSize() const { return m_size; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Get the dpi values of the image for x and y axes.
Toshihiro Shimizu 890ddd
	void getDpi(double &dpix, double &dpiy) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		dpix = m_dpix;
Toshihiro Shimizu 890ddd
		dpiy = m_dpiy;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	//! Set the dpi values of the image for x and y axes.
Toshihiro Shimizu 890ddd
	void setDpi(double dpix, double dpiy)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_dpix = dpix;
Toshihiro Shimizu 890ddd
		m_dpiy = dpiy;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getSubsampling() const { return m_subsampling; }
Toshihiro Shimizu 890ddd
	void setSubsampling(int s);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the savebox of the image
Toshihiro Shimizu 890ddd
	TRect getSavebox() const { return m_savebox; }
Toshihiro Shimizu 890ddd
	//! Set the savebox of the image.
Toshihiro Shimizu 890ddd
	/*! The savebox setted is the intersection between \b rect and the image box.*/
Toshihiro Shimizu 890ddd
	void setSavebox(const TRect &rect);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the boundin box of the image.
Toshihiro Shimizu 890ddd
	TRectD getBBox() const { return convert(m_savebox); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the offset point of the image.
Toshihiro Shimizu 890ddd
	TPoint getOffset() const { return m_offset; }
Toshihiro Shimizu 890ddd
	//! Set the offset point of the image.
Toshihiro Shimizu 890ddd
	void setOffset(const TPoint &offset) { m_offset = offset; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return raster hPos \b m_hPos
Toshihiro Shimizu 890ddd
	//double gethPos() const {return m_hPos;}
Toshihiro Shimizu 890ddd
	//! Return a clone of image
Toshihiro Shimizu 890ddd
	//void sethPos(double hPos) {m_hPos= hPos;}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return a clone of the current image
Toshihiro Shimizu 890ddd
	TImage *cloneImage() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the image's raster
Toshihiro Shimizu 890ddd
	TRasterCM32P getCMapped() const;
Toshihiro Shimizu 890ddd
	//! Return a copy of the image's raster.
Toshihiro Shimizu 890ddd
	void getCMapped(const TRasterCM32P &ras);
Toshihiro Shimizu 890ddd
	//! Set the image's raster
Toshihiro Shimizu 890ddd
	void setCMapped(const TRasterCM32P &ras);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return the image's raster.
Toshihiro Shimizu 890ddd
	/*! Call the getCMapped() method.*/
Toshihiro Shimizu 890ddd
	TRasterCM32P getRaster() const { return getCMapped(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP raster() const { return (TRasterP)getCMapped(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Return a clone of the current image.
Toshihiro Shimizu 890ddd
	TToonzImageP clone() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	//! Image dimension
Toshihiro Shimizu 890ddd
	TDimension m_size;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<ttoonzimage>;</ttoonzimage>
Toshihiro Shimizu 890ddd
template class DVAPI TDerivedSmartPointerT<ttoonzimage, timage="">;</ttoonzimage,>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TToonzImageP : public TDerivedSmartPointerT<ttoonzimage, timage=""></ttoonzimage,>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TToonzImageP() {}
Toshihiro Shimizu 890ddd
	TToonzImageP(TToonzImage *image) : DerivedSmartPointer(image) {}
Toshihiro Shimizu 890ddd
	TToonzImageP(TImageP image) : DerivedSmartPointer(image) {}
Toshihiro Shimizu 890ddd
	TToonzImageP(const TRasterCM32P &ras, const TRect &saveBox) : DerivedSmartPointer(new TToonzImage(ras, saveBox)) {}
Toshihiro Shimizu 890ddd
	operator TImageP() { return TImageP(m_pointer); }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif