|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef STROKE_DEFORMATION_H
|
|
Toshihiro Shimizu |
890ddd |
#define STROKE_DEFORMATION_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @author Fabrizio Morciano <fabrizio.morciano@gmail.com></fabrizio.morciano@gmail.com>
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TNZEXT_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 |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "ext/TriParam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/Types.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/ContextStatus.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <vector></vector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TStroke;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#if defined(_WIN32) && (_MSC_VER <= 1200)
|
|
Toshihiro Shimizu |
890ddd |
// to avoid annoying warning
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(push)
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4251)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace ToonzExt
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
class Designer;
|
|
Toshihiro Shimizu |
890ddd |
class Potential;
|
|
Toshihiro Shimizu |
890ddd |
class StrokeParametricDeformer;
|
|
Toshihiro Shimizu |
890ddd |
class StrokeDeformationImpl;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief This class is the interface for manipulation
|
|
Toshihiro Shimizu |
890ddd |
* algorihms.
|
|
Toshihiro Shimizu |
890ddd |
*
|
|
Toshihiro Shimizu |
890ddd |
* StrokeDeformation is a wrapper for for StrokeDeformationImpl,
|
|
Toshihiro Shimizu |
890ddd |
* its function is to verify state and parameteres before
|
|
Toshihiro Shimizu |
890ddd |
* to call the implementation methods of deformation.
|
|
Toshihiro Shimizu |
890ddd |
*
|
|
Toshihiro Shimizu |
890ddd |
* There is an internal status to verify that actions:
|
|
Toshihiro Shimizu |
890ddd |
* @arg @c CREATED on constructor
|
|
Toshihiro Shimizu |
890ddd |
* @arg @c ACTIVE on active
|
|
Toshihiro Shimizu |
890ddd |
* @arg @c UPDATING on updating
|
|
Toshihiro Shimizu |
890ddd |
* @arg @c DEACTIVE on deactive
|
|
Toshihiro Shimizu |
890ddd |
*
|
|
Toshihiro Shimizu |
890ddd |
* If some error of state occurs @c reset method is called.
|
|
Toshihiro Shimizu |
890ddd |
* ContextStatus contains information about deformation parameter,
|
|
Toshihiro Shimizu |
890ddd |
* and it occurs to reduce the number of parameters required.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI
|
|
Toshihiro Shimizu |
890ddd |
StrokeDeformation
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
StrokeDeformationImpl *
|
|
Toshihiro Shimizu |
890ddd |
deformationImpl_;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Internal status.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
enum StrokeDeformationState {
|
|
Toshihiro Shimizu |
890ddd |
CREATED,
|
|
Toshihiro Shimizu |
890ddd |
ACTIVE,
|
|
Toshihiro Shimizu |
890ddd |
UPDATING,
|
|
Toshihiro Shimizu |
890ddd |
DEACTIVE,
|
|
Toshihiro Shimizu |
890ddd |
RESETTED
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
StrokeDeformationState
|
|
Toshihiro Shimizu |
890ddd |
state_;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Recover from an invalid state
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
recover();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Retrieve the current deformator.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
StrokeDeformationImpl *
|
|
Toshihiro Shimizu |
890ddd |
retrieveDeformator(const ContextStatus *status);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
StrokeDeformation();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~StrokeDeformation();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Init deformation and add control points.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
activate(const ContextStatus *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Modify stroke.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
update(const TPointD &delta);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return a stroke deformed.
|
|
Toshihiro Shimizu |
890ddd |
* @return A stroke deformed.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
TStroke *
|
|
Toshihiro Shimizu |
890ddd |
deactivate();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Clear inner status of Deformation.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
reset();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Just select correct Deformation.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
check(const ContextStatus *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Apply a designer on current deformation.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
draw(Designer *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Retrieve valid extremes for current manipulator/deformator.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
ToonzExt::Interval
|
|
Toshihiro Shimizu |
890ddd |
getExtremes() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return the stroke selected from user.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const TStroke *
|
|
Toshihiro Shimizu |
890ddd |
getStroke() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return the stroke selected from user.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const TStroke *
|
|
Toshihiro Shimizu |
890ddd |
getCopiedStroke() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return a reference to the stroke created to be manipulated.
|
|
Toshihiro Shimizu |
890ddd |
* @note This stroke is different from stroke selected by user.
|
|
Toshihiro Shimizu |
890ddd |
* @sa getStroke
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const TStroke *
|
|
Toshihiro Shimizu |
890ddd |
getTransformedStroke() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return the internal status of current deformation.
|
|
Toshihiro Shimizu |
890ddd |
* @sa ContextStatus
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const ContextStatus *
|
|
Toshihiro Shimizu |
890ddd |
getStatus() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Retrieve cursor associated to current deformator.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
int
|
|
Toshihiro Shimizu |
890ddd |
getCursorId() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef _DEBUG
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return the potential used in implementation.
|
|
Toshihiro Shimizu |
890ddd |
* @note This is useful just for debug, please do not use directly.
|
|
Toshihiro Shimizu |
890ddd |
* @sa Potential
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const Potential *
|
|
Toshihiro Shimizu |
890ddd |
getPotential() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/**
|
|
Toshihiro Shimizu |
890ddd |
* @brief Return the potential used in implementation.
|
|
Toshihiro Shimizu |
890ddd |
* @note This is useful just for debug, please do not use directly.
|
|
Toshihiro Shimizu |
890ddd |
* @sa Potential
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
const StrokeDeformationImpl *
|
|
Toshihiro Shimizu |
890ddd |
getDeformationImpl() const;
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#if defined(_WIN32) && (_MSC_VER <= 1200)
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(pop)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif /* STROKE_DEFORMATION_H */
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
// End Of File
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|