Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef STROKEDEFORMATION_IMPL_H
Toshihiro Shimizu 890ddd
#define STROKEDEFORMATION_IMPL_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 "ext/StrokeDeformation.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 "ExtUtil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#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 DVAPI
Toshihiro Shimizu 890ddd
	StrokeDeformationImpl
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	bool
Toshihiro Shimizu 890ddd
	init(const ContextStatus *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool
Toshihiro Shimizu 890ddd
	computeStroke2Transform(const ContextStatus *s,
Toshihiro Shimizu 890ddd
							TStroke *&stroke2transform,
Toshihiro Shimizu 890ddd
							double &w,
Toshihiro Shimizu 890ddd
							ToonzExt::Interval &extremes);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ToonzExt::Potential
Toshihiro Shimizu 890ddd
		*potential_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TStroke *
Toshihiro Shimizu 890ddd
		copyOfLastSelectedStroke_; // deep copy stroke selected previously
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int
Toshihiro Shimizu 890ddd
		cursorId_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TStroke
Toshihiro Shimizu 890ddd
		*stroke2manipulate_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TStroke *&
Toshihiro Shimizu 890ddd
	getLastSelectedStroke();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static void
Toshihiro Shimizu 890ddd
	setLastSelectedStroke(TStroke *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static int &
Toshihiro Shimizu 890ddd
	getLastSelectedDegree();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static void
Toshihiro Shimizu 890ddd
	setLastSelectedDegree(int degree);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static ToonzExt::Intervals &
Toshihiro Shimizu 890ddd
	getSpiresList();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static ToonzExt::Intervals &
Toshihiro Shimizu 890ddd
	getStraightsList();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ToonzExt::StrokeParametricDeformer
Toshihiro Shimizu 890ddd
		*deformer_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int
Toshihiro Shimizu 890ddd
		shortcutKey_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	double
Toshihiro Shimizu 890ddd
		old_w0_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPointD
Toshihiro Shimizu 890ddd
		old_w0_pos_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// ref to simplify access
Toshihiro Shimizu 890ddd
	std::vector<tstroke *=""></tstroke>
Toshihiro Shimizu 890ddd
		strokes_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	StrokeDeformationImpl();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
    * Is this the correct deformation?
Toshihiro Shimizu 890ddd
    */
Toshihiro Shimizu 890ddd
	virtual bool
Toshihiro Shimizu 890ddd
	check_(const ContextStatus *) = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
    * Retrieve the nearest extremes to point selected.
Toshihiro Shimizu 890ddd
    */
Toshihiro Shimizu 890ddd
	virtual bool
Toshihiro Shimizu 890ddd
	findExtremes_(const ContextStatus *,
Toshihiro Shimizu 890ddd
				  Interval &) = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual double
Toshihiro Shimizu 890ddd
	findActionLength() = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	virtual ~StrokeDeformationImpl();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ToonzExt::Interval
Toshihiro Shimizu 890ddd
	getExtremes();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static const ContextStatus *&
Toshihiro Shimizu 890ddd
	getImplStatus();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const TStroke *
Toshihiro Shimizu 890ddd
	getStrokeSelected() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (getImplStatus())
Toshihiro Shimizu 890ddd
			return this->getImplStatus()->stroke2change_;
Toshihiro Shimizu 890ddd
		return 0;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const TStroke *
Toshihiro Shimizu 890ddd
	getCopiedStroke() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return this->getStrokeSelected();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
     * Wrapper for activate.
Toshihiro Shimizu 890ddd
     */
Toshihiro Shimizu 890ddd
	virtual bool
Toshihiro Shimizu 890ddd
	activate_impl(const ContextStatus *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
    * Modify stroke.
Toshihiro Shimizu 890ddd
    */
Toshihiro Shimizu 890ddd
	virtual void
Toshihiro Shimizu 890ddd
	update_impl(const TPointD &delta);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
    * Reduce control points and change stroke.
Toshihiro Shimizu 890ddd
    */
Toshihiro Shimizu 890ddd
	virtual TStroke *
Toshihiro Shimizu 890ddd
	deactivate_impl();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool
Toshihiro Shimizu 890ddd
	check(const ContextStatus *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
    * Restore last good status.
Toshihiro Shimizu 890ddd
    */
Toshihiro Shimizu 890ddd
	virtual void
Toshihiro Shimizu 890ddd
	reset();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void
Toshihiro Shimizu 890ddd
	setPotential(Potential *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/**
Toshihiro Shimizu 890ddd
     * Apply a designer on current deformation.
Toshihiro Shimizu 890ddd
     */
Toshihiro Shimizu 890ddd
	virtual void
Toshihiro Shimizu 890ddd
	draw(Designer *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TStroke *
Toshihiro Shimizu 890ddd
	getTransformedStroke();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	ToonzExt::Potential *
Toshihiro Shimizu 890ddd
	getPotential();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPointD &
Toshihiro Shimizu 890ddd
	oldW0();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int
Toshihiro Shimizu 890ddd
	getShortcutKey() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return shortcutKey_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int
Toshihiro Shimizu 890ddd
	getCursorId() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return cursorId_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void
Toshihiro Shimizu 890ddd
	setCursorId(int id)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		cursorId_ = id;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if defined(WIN32) && (_MSC_VER <= 1200)
Toshihiro Shimizu 890ddd
#pragma warning(pop)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif /* STROKEDEFORMATION_IMPL_H */
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
//  End Of File
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------