|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef LEVELPROPERTIES_H
|
|
Toshihiro Shimizu |
890ddd |
#define LEVELPROPERTIES_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZLIB_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 |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LevelOptions definition
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief User-editable level properties.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\details Historically, LevelProperties stores properties both accessible
|
|
Toshihiro Shimizu |
890ddd |
to Toonz end-users, and internal to the Toonz application.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
The user-accessible options have been moved to this nested class
|
|
Toshihiro Shimizu |
890ddd |
to clearly separate them from internal properties of a level.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class DVAPI LevelOptions {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
shun-iwasawa |
481b59 |
enum DpiPolicy //! Describes the dpi policy used for a level.
|
|
shun-iwasawa |
481b59 |
{
|
|
shun-iwasawa |
481b59 |
DP_ImageDpi = 0, //!< Level uses the natural dpi embedded in its images.
|
|
Shinya Kitaoka |
120a6e |
DP_CustomDpi = 2 //!< Level uses a custom dpi set by the user.
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
double m_dpi; //!< <tt>[default: Stage::inch]</tt> Dpi used with the
|
|
Shinya Kitaoka |
120a6e |
//! LevelProperties::DP_CustomDpi policy.
|
|
Shinya Kitaoka |
120a6e |
int m_subsampling, //!< <tt>[default: 1]</tt> Image subsampling value (see
|
|
Shinya Kitaoka |
120a6e |
//! LevelProperties::setSubsampling()).
|
|
Shinya Kitaoka |
120a6e |
m_antialias; //!< <tt>[default: 0]</tt> Antialias amount (\p 0 meaning
|
|
Shinya Kitaoka |
120a6e |
//! no antialias).
|
|
Shinya Kitaoka |
120a6e |
DpiPolicy m_dpiPolicy; //!< <tt>[default: DP_ImageDpi]</tt> Dpi policy to be
|
|
Shinya Kitaoka |
38fd86 |
//! adpoted.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool m_whiteTransp, //!< <tt>[default: false]</tt> Whether white should be
|
|
Jeremy Bullock |
f15907 |
//! visualized as transparent.
|
|
Jeremy Bullock |
f15907 |
m_premultiply, //!< <tt>[default: false]</tt> Whether level images should
|
|
Shinya Kitaoka |
38fd86 |
//! be
|
|
Jeremy Bullock |
f15907 |
//! premultiplied by Toonz for alpha compositing (because they
|
|
Jeremy Bullock |
f15907 |
//! are not).
|
|
Jeremy Bullock |
f15907 |
m_isStopMotionLevel;
|
|
Jeremy Bullock |
f15907 |
|
|
shun-iwasawa |
481b59 |
double m_colorSpaceGamma; // gamma value to be used for converting
|
|
shun-iwasawa |
481b59 |
// linear-based image file to nonlinear raster.
|
|
shun-iwasawa |
481b59 |
// Curretly only used in EXR image levels.
|
|
shun-iwasawa |
481b59 |
|
|
shun-iwasawa |
481b59 |
static const double DefaultColorSpaceGamma;
|
|
shun-iwasawa |
481b59 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
LevelOptions(); //!< Constructs with default values.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool operator==(const LevelOptions &opts) const;
|
|
Shinya Kitaoka |
120a6e |
bool operator!=(const LevelOptions &other) const {
|
|
Shinya Kitaoka |
120a6e |
return !operator==(other);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// LevelProperties definition
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Stores the possible properties of a Toonz level.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class DVAPI LevelProperties {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
/*!
|
|
Shinya Kitaoka |
120a6e |
\brief Alias for LevelOptions::DpiPolicy provided for backward
|
|
Shinya Kitaoka |
120a6e |
compatibility.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
\deprecated Use LevelOptions::DpiPolicy instead.
|
|
Shinya Kitaoka |
120a6e |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
enum DpiPolicy {
|
|
Shinya Kitaoka |
120a6e |
DP_ImageDpi = LevelOptions::DP_ImageDpi,
|
|
Shinya Kitaoka |
120a6e |
DP_CustomDpi = LevelOptions::DP_CustomDpi
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
LevelProperties();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
const LevelOptions &options() const //! Returns user-accessible options.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_options;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
LevelOptions &options() //! Returns user-accessible options.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_options;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details The level subsampling is the integer value (strictly
|
|
Shinya Kitaoka |
120a6e |
greater than 1) denoting the fraction of pixels to be
|
|
Shinya Kitaoka |
120a6e |
displayed for its images while in camera stand mode.
|
|
Shinya Kitaoka |
120a6e |
For example, a value of 2 will \a halve the original image
|
|
Shinya Kitaoka |
120a6e |
resolution.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
Note that only the crudest algorithm will be applied for
|
|
Shinya Kitaoka |
120a6e |
resampling, as this feature is explicitly intended to
|
|
Shinya Kitaoka |
120a6e |
improve visualization speed as much as possible. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setSubsampling(int s); //!< Sets the level subsampling.
|
|
Shinya Kitaoka |
120a6e |
int getSubsampling() const; //!< Returns the level subsampling.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details The dirty flag is the boolean value specifying whether
|
|
Shinya Kitaoka |
120a6e |
a level has been altered in any way. Saving operations on
|
|
Shinya Kitaoka |
120a6e |
levels whose dirty flag is \p false are no-op. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setDirtyFlag(bool on); //!< Sets the level's dirty flag.
|
|
Shinya Kitaoka |
120a6e |
bool getDirtyFlag() const; //!< Returns the level's dirty flag
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setDpiPolicy(DpiPolicy dpiPolicy); //!< Sets the level's DpiPolicy.
|
|
Shinya Kitaoka |
120a6e |
DpiPolicy getDpiPolicy() const; //!< Returns the level's DpiPolicy.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setImageDpi(const TPointD &dpi); //!< Sets the level's \a image dpi.
|
|
Shinya Kitaoka |
120a6e |
TPointD getImageDpi() const; //!< Returns the level's \a image dpi.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setDpi(const TPointD &dpi); //!< Sets the level's \a custom dpi.
|
|
Shinya Kitaoka |
120a6e |
void setDpi(double dpi); //!< Sets a uniform \a custom level dpi.
|
|
Shinya Kitaoka |
120a6e |
TPointD getDpi() const; //!< Returns the level's \a custom dpi.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setImageRes(
|
|
Shinya Kitaoka |
120a6e |
const TDimension &d); //!< Sets the level's known image resolution.
|
|
Shinya Kitaoka |
120a6e |
TDimension getImageRes()
|
|
Shinya Kitaoka |
120a6e |
const; //!< Returns the level's known image resolution.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setBpp(int bpp); //!< Sets the level's known bits-per-pixel.
|
|
Shinya Kitaoka |
120a6e |
int getBpp() const; //!< Returns the level's known bits-per-pixel.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setHasAlpha(
|
|
Shinya Kitaoka |
120a6e |
bool hasAlpha) //! Sets whether the level has an alpha channel.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_hasAlpha = hasAlpha;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
bool hasAlpha() const //! Returns whether the level has an alpha channel.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_hasAlpha;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setCreator(
|
|
Shinya Kitaoka |
120a6e |
const std::string &creator) //! Sets the level's creator string.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_creator = creator;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
std::string getCreator() const //! Returns the level's creator string.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_creator;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details A level is forbidden if it has been created with a
|
|
Shinya Kitaoka |
120a6e |
uncompatible application version (e.g. it was created with
|
|
Shinya Kitaoka |
120a6e |
Student and loaded with Toonz). */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setIsForbidden(
|
|
Shinya Kitaoka |
120a6e |
bool forbidden) //! Sets whether it is forbidden to edit a level.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_forbidden = forbidden;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
bool isForbidden() const {
|
|
Shinya Kitaoka |
120a6e |
return m_forbidden;
|
|
Shinya Kitaoka |
120a6e |
} //!< Returns whether the level is forbidden for editing.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \param doPremultiply Whether Toonz must perform premultiplication - ie
|
|
Shinya Kitaoka |
120a6e |
image pixels are \a not already premultiplied.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
\details Images with an alpha channel may or may not store pixels in
|
|
Shinya Kitaoka |
120a6e |
\a premultiplied form. See the Wikipedia entry on alhpa
|
|
Shinya Kitaoka |
120a6e |
compositing for further information:
|
|
Shinya Kitaoka |
120a6e |
http://en.wikipedia.org/wiki/Alpha_compositing
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
Already premultiplied images do not require Toonz to perform
|
|
Shinya Kitaoka |
120a6e |
additional premultiplication on its own to perform alpha
|
|
Shinya Kitaoka |
120a6e |
compositing. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setDoPremultiply(
|
|
Shinya Kitaoka |
120a6e |
bool doPremultiply) //! Sets whether premultiplication must be applied.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_options.m_premultiply = doPremultiply;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
bool doPremultiply()
|
|
Shinya Kitaoka |
120a6e |
const //! Returns whether premultiplication must be applied.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_options.m_premultiply;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details See
|
|
Shinya Kitaoka |
120a6e |
http://visual-computing.intel-research.net/publications/papers/2009/mlaa/mlaa.pdf
|
|
Shinya Kitaoka |
120a6e |
for an in-depth explanation of the morphological antialiasing
|
|
Shinya Kitaoka |
120a6e |
technique. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setDoAntialias(int softness) //! Sets the amount of morphological
|
|
Shinya Kitaoka |
120a6e |
//! antialiasing to be applied.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_options.m_antialias = softness;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
int antialiasSoftness() const //! Returns the amount of morphological
|
|
Shinya Kitaoka |
120a6e |
//! antialiasing to be applied.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
return m_options.m_antialias;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! \details White substitution is currently an \a exact feature in Toonz -
|
|
Shinya Kitaoka |
120a6e |
ie
|
|
Shinya Kitaoka |
120a6e |
only \a fully white pixels will be replaced with transparent.
|
|
Shinya Kitaoka |
120a6e |
This implicityl restrains its applicability to images without
|
|
luz paz |
6454c4 |
antialias. This is therefore coupled with antialiasing settings.
|
|
Shinya Kitaoka |
120a6e |
\sa The setDoAntialias() method. */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setWhiteTransp(bool whiteTransp) //! Whether full white pixels should
|
|
Shinya Kitaoka |
120a6e |
//! be intended as transparent.
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
m_options.m_whiteTransp = whiteTransp;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
bool whiteTransp() const { return m_options.m_whiteTransp; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Jeremy Bullock |
f15907 |
void setIsStopMotion(bool isStopMotion) // Is this level used for Stop Motion
|
|
Jeremy Bullock |
f15907 |
|
|
Jeremy Bullock |
f15907 |
{
|
|
Jeremy Bullock |
f15907 |
m_options.m_isStopMotionLevel = isStopMotion;
|
|
Jeremy Bullock |
f15907 |
}
|
|
Jeremy Bullock |
f15907 |
bool isStopMotionLevel() const { return m_options.m_isStopMotionLevel; }
|
|
Jeremy Bullock |
f15907 |
|
|
shun-iwasawa |
481b59 |
// gamma value to be used for converting linear-based image file (EXR) to
|
|
shun-iwasawa |
481b59 |
// nonlinear raster.
|
|
shun-iwasawa |
481b59 |
void setColorSpaceGamma(double gamma) { m_options.m_colorSpaceGamma = gamma; }
|
|
shun-iwasawa |
481b59 |
double colorSpaceGamma() const { return m_options.m_colorSpaceGamma; }
|
|
shun-iwasawa |
481b59 |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TPointD m_imageDpi;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::string m_creator;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension m_imageRes;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_bpp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_loadAtOnce, m_dirtyFlag, m_forbidden, m_hasAlpha;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
LevelOptions m_options;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // LEVELPROPERTIES_H
|