Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TEXTERNFX_H
Toshihiro Shimizu 890ddd
#define TEXTERNFX_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tbasefx.h"
Toshihiro Shimizu 890ddd
#include "trasterfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TFX_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
Toshihiro Shimizu 890ddd
class DVAPI TExternFx : public TBaseRasterFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TExternFx()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		setName(L"ExternFx");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	static TExternFx *create(std::string name);
Shinya Kitaoka 3bfa54
	void getNames(std::vector<std::string> &names);</std::string>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TExternalProgramFx : public TExternFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	FX_DECLARATION(TExternalProgramFx)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	class Port
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	public:
Shinya Kitaoka 3bfa54
		std::string m_name;
Toshihiro Shimizu 890ddd
		TRasterFxPort *m_port; // n.b. la porta di output ha m_port=0
Shinya Kitaoka 3bfa54
		std::string m_ext;		   // estensione del file in cui si legge/scrive l'immagine
Toshihiro Shimizu 890ddd
		Port()
Toshihiro Shimizu 890ddd
			: m_name(), m_port(0), m_ext() {}
Shinya Kitaoka 3bfa54
		Port(std::string name, std::string ext, TRasterFxPort *port)
Toshihiro Shimizu 890ddd
			: m_name(name), m_port(port), m_ext(ext) {}
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	std::map<std::string, port=""> m_ports;</std::string,>
Shinya Kitaoka 3bfa54
	// std::map<std::string, tparamp=""> m_params;</std::string,>
Toshihiro Shimizu 890ddd
	std::vector<tparamp> m_params;</tparamp>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFilePath m_executablePath;
Shinya Kitaoka 3bfa54
	std::string m_args;
Shinya Kitaoka 3bfa54
	std::string m_externFxName;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 3bfa54
	TExternalProgramFx(std::string name);
Toshihiro Shimizu 890ddd
	TExternalProgramFx();
Toshihiro Shimizu 890ddd
	~TExternalProgramFx();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void initialize(std::string name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TFx *clone(bool recursive = true) const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info);
Toshihiro Shimizu 890ddd
	void doCompute(TTile &tile, double frame, const TRenderSettings &ri);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool canHandle(const TRenderSettings &info, double frame) { return false; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void setExecutable(TFilePath fp, std::string args)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_executablePath = fp;
Toshihiro Shimizu 890ddd
		m_args = args;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void addPort(std::string portName, std::string ext, bool isInput);
Toshihiro Shimizu 890ddd
	// void addParam(string paramName, const TParamP ¶m);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void loadData(TIStream &is);
Toshihiro Shimizu 890ddd
	void saveData(TOStream &os);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void setExternFxName(std::string name) { m_externFxName = name; }
Shinya Kitaoka 3bfa54
	std::string getExternFxName() const { return m_externFxName; };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	// not implemented
Toshihiro Shimizu 890ddd
	TExternalProgramFx(const TExternalProgramFx &);
Toshihiro Shimizu 890ddd
	TExternalProgramFx &operator=(const TExternalProgramFx &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif