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