|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/levelproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/stage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LevelProperties::Options implementation
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
LevelOptions::LevelOptions()
|
|
Jeremy Bullock |
8c5007 |
: m_dpi(Stage::standardDpi)
|
|
Shinya Kitaoka |
120a6e |
, m_subsampling(1)
|
|
Shinya Kitaoka |
120a6e |
, m_antialias(0)
|
|
Shinya Kitaoka |
120a6e |
, m_dpiPolicy(DP_ImageDpi)
|
|
Shinya Kitaoka |
120a6e |
, m_whiteTransp(false)
|
|
Jeremy Bullock |
f15907 |
, m_premultiply(false)
|
|
Jeremy Bullock |
f15907 |
, m_isStopMotionLevel(false) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool LevelOptions::operator==(const LevelOptions &other) const {
|
|
Shinya Kitaoka |
120a6e |
return (m_premultiply == other.m_premultiply &&
|
|
Shinya Kitaoka |
120a6e |
m_whiteTransp == other.m_whiteTransp &&
|
|
Shinya Kitaoka |
120a6e |
m_dpiPolicy == other.m_dpiPolicy &&
|
|
Shinya Kitaoka |
120a6e |
m_antialias == other.m_antialias &&
|
|
Jeremy Bullock |
f15907 |
m_isStopMotionLevel == other.m_isStopMotionLevel &&
|
|
Shinya Kitaoka |
120a6e |
(m_dpiPolicy == LevelOptions::DP_ImageDpi || m_dpi == other.m_dpi));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LevelProperties implementation
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
LevelProperties::LevelProperties()
|
|
Shinya Kitaoka |
120a6e |
: m_imageDpi()
|
|
Shinya Kitaoka |
120a6e |
, m_creator("")
|
|
Shinya Kitaoka |
120a6e |
, m_imageRes(0, 0)
|
|
Shinya Kitaoka |
120a6e |
, m_bpp(32)
|
|
Shinya Kitaoka |
120a6e |
, m_loadAtOnce(false)
|
|
Shinya Kitaoka |
120a6e |
, m_dirtyFlag(true)
|
|
Shinya Kitaoka |
120a6e |
, m_forbidden(false)
|
|
Shinya Kitaoka |
120a6e |
, m_hasAlpha(false) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setDpiPolicy(LevelProperties::DpiPolicy dpiPolicy) {
|
|
Shinya Kitaoka |
120a6e |
m_options.m_dpiPolicy = LevelOptions::DpiPolicy(dpiPolicy);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
LevelProperties::DpiPolicy LevelProperties::getDpiPolicy() const {
|
|
Shinya Kitaoka |
120a6e |
return LevelProperties::DpiPolicy(m_options.m_dpiPolicy);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setDpi(const TPointD &dpi) { m_options.m_dpi = dpi.x; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setDpi(double dpi) { m_options.m_dpi = dpi; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD LevelProperties::getDpi() const {
|
|
Shinya Kitaoka |
120a6e |
return TPointD(m_options.m_dpi, m_options.m_dpi);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setSubsampling(int s) { m_options.m_subsampling = s; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int LevelProperties::getSubsampling() const { return m_options.m_subsampling; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setDirtyFlag(bool on) { m_dirtyFlag = on; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool LevelProperties::getDirtyFlag() const { return m_dirtyFlag; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension LevelProperties::getImageRes() const { return m_imageRes; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setImageDpi(const TPointD &dpi) {
|
|
Shinya Kitaoka |
120a6e |
m_imageDpi = dpi;
|
|
Shinya Kitaoka |
120a6e |
if (dpi.x <= 0 || dpi.y <= 0)
|
|
Shinya Kitaoka |
120a6e |
m_options.m_dpiPolicy = LevelOptions::DP_CustomDpi;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD LevelProperties::getImageDpi() const { return m_imageDpi; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setImageRes(const TDimension &d) { m_imageRes = d; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void LevelProperties::setBpp(int bpp) { m_bpp = bpp; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int LevelProperties::getBpp() const { return m_bpp; }
|