|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4996)
|
|
Toshihiro Shimizu |
890ddd |
#include "windows.h"
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
#include <vector></vector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <stdio.h></stdio.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <stdlib.h></stdlib.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <time.h></time.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <sys types.h=""></sys>
|
|
Toshihiro Shimizu |
890ddd |
#include <sys timeb.h=""></sys>
|
|
Toshihiro Shimizu |
890ddd |
#include <string.h></string.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <math.h></math.h>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tdoubleparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ttzpimagefx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class CalligraphicFx : public TStandardRasterFx
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_DECLARATION(CalligraphicFx)
|
|
Toshihiro Shimizu |
890ddd |
TRasterFxPort m_input;
|
|
Toshihiro Shimizu |
890ddd |
TStringParamP m_colorIndex;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_thickness;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_horizontal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_upWDiagonal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_vertical;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_doWDiagonal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_accuracy;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_noise;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicFx()
|
|
Toshihiro Shimizu |
890ddd |
: m_colorIndex(L"1,2,3"), m_thickness(5.0), m_horizontal(100.0), m_upWDiagonal(50.0), m_vertical(0.0), m_doWDiagonal(50.0), m_accuracy(50.0), m_noise(0.0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_thickness->setMeasureName("fxLength");
|
|
Toshihiro Shimizu |
890ddd |
addInputPort("Source", m_input);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Color_Index", m_colorIndex);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Thickness", m_thickness);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Accuracy", m_accuracy);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Noise", m_noise);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Horizontal", m_horizontal);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "upWDiagonal", m_upWDiagonal);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Vertical", m_vertical);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "doWDiagonal", m_doWDiagonal);
|
|
Toshihiro Shimizu |
890ddd |
m_thickness->setValueRange(0.0, 60.0);
|
|
Toshihiro Shimizu |
890ddd |
m_horizontal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_upWDiagonal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_vertical->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_doWDiagonal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_accuracy->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_noise->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~CalligraphicFx(){};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_input.isConnected()) {
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings info2(info);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(m_colorIndex->getValue()).c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame) * 0.5;
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
info2.m_data.push_back(calligraphicData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return m_input->doGetBBox(frame, bBox, info2);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
bBox = TRectD();
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool canHandle(const TRenderSettings &info, double frame) { return true; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool allowUserCacheOnPort(int port) { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void getValues(const char *argv[], int argc, double frame)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
double values[8];
|
|
Toshihiro Shimizu |
890ddd |
values[1] = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[2] = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[3] = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[4] = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[5] = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[6] = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[7] = m_thickness->getValue(frame) * 0.5;
|
|
Toshihiro Shimizu |
890ddd |
convertParam(values, argv, argc);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
char *strsave(const char *t)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
char *s;
|
|
Toshihiro Shimizu |
890ddd |
s = (char *)malloc(strlen(t) + 1);
|
|
Toshihiro Shimizu |
890ddd |
strcpy(s, t);
|
|
Toshihiro Shimizu |
890ddd |
return s;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void convertParam(double param[], const char *cParam[], int cParamLen)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
std::string app;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 1; i < cParamLen; i++) {
|
|
Toshihiro Shimizu |
890ddd |
app = toString(param[i]);
|
|
Toshihiro Shimizu |
890ddd |
cParam[i] = strsave(app.c_str());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void doCompute(TTile &tile, double frame, const TRenderSettings &ri)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_input.isConnected())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(m_colorIndex->getValue()).c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings ri2(ri);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame) * 0.5;
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
ri2.m_data.push_back(calligraphicData);
|
|
Toshihiro Shimizu |
890ddd |
ri2.m_userCachable = false;
|
|
Toshihiro Shimizu |
890ddd |
m_input->compute(tile, frame, ri2);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void transform(double frame,
|
|
Toshihiro Shimizu |
890ddd |
int port,
|
|
Toshihiro Shimizu |
890ddd |
const TRectD &rectOnOutput,
|
|
Toshihiro Shimizu |
890ddd |
const TRenderSettings &infoOnOutput,
|
|
Toshihiro Shimizu |
890ddd |
TRectD &rectOnInput,
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings &infoOnInput)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
rectOnInput = rectOnOutput;
|
|
Toshihiro Shimizu |
890ddd |
infoOnInput = infoOnOutput;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(m_colorIndex->getValue()).c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *calligraphicData = new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
infoOnInput.m_data.push_back(calligraphicData);
|
|
Toshihiro Shimizu |
890ddd |
infoOnInput.m_userCachable = false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
class OutBorderFx : public TStandardRasterFx
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_DECLARATION(OutBorderFx)
|
|
Toshihiro Shimizu |
890ddd |
TRasterFxPort m_input;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_thickness;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_horizontal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_upWDiagonal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_vertical;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_doWDiagonal;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_accuracy;
|
|
Toshihiro Shimizu |
890ddd |
TDoubleParamP m_noise;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
OutBorderFx()
|
|
Toshihiro Shimizu |
890ddd |
: m_thickness(5.0), m_horizontal(100.0), m_upWDiagonal(100.0), m_vertical(100.0), m_doWDiagonal(100.0), m_accuracy(50.0), m_noise(0.0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_thickness->setMeasureName("fxLength");
|
|
Toshihiro Shimizu |
890ddd |
addInputPort("Source", m_input);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Thickness", m_thickness);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Accuracy", m_accuracy);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Noise", m_noise);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Horizontal", m_horizontal);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "upWDiagonal", m_upWDiagonal);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "Vertical", m_vertical);
|
|
Toshihiro Shimizu |
890ddd |
bindParam(this, "doWDiagonal", m_doWDiagonal);
|
|
Toshihiro Shimizu |
890ddd |
m_thickness->setValueRange(0.0, 30.0);
|
|
Toshihiro Shimizu |
890ddd |
m_horizontal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_upWDiagonal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_vertical->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_doWDiagonal->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_accuracy->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
m_noise->setValueRange(0.0, 100.0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~OutBorderFx(){};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_input.isConnected()) {
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings info2(info);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(L"-1").c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = L"-1";
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
info2.m_data.push_back(outBorderData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return m_input->doGetBBox(frame, bBox, info2);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
bBox = TRectD();
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool canHandle(const TRenderSettings &info, double frame) { return true; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void getValues(const char *argv[], int argc, double frame)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
double values[8];
|
|
Toshihiro Shimizu |
890ddd |
values[1] = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[2] = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[3] = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[4] = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[5] = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[6] = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
values[7] = m_thickness->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
convertParam(values, argv, argc);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
char *strsave(const char *t)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
char *s;
|
|
Toshihiro Shimizu |
890ddd |
s = (char *)malloc(strlen(t) + 1);
|
|
Toshihiro Shimizu |
890ddd |
strcpy(s, t);
|
|
Toshihiro Shimizu |
890ddd |
return s;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void convertParam(double param[], const char *cParam[], int cParamLen)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
std::string app;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 1; i < cParamLen; i++) {
|
|
Toshihiro Shimizu |
890ddd |
app = toString(param[i]);
|
|
Toshihiro Shimizu |
890ddd |
cParam[i] = strsave(app.c_str());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void doCompute(TTile &tile, double frame, const TRenderSettings &ri)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_input.isConnected())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(L"-1").c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings ri2(ri);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = L"-1";
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
ri2.m_data.push_back(outBorderData);
|
|
Toshihiro Shimizu |
890ddd |
m_input->compute(tile, frame, ri2);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void transform(double frame,
|
|
Toshihiro Shimizu |
890ddd |
int port,
|
|
Toshihiro Shimizu |
890ddd |
const TRectD &rectOnOutput,
|
|
Toshihiro Shimizu |
890ddd |
const TRenderSettings &infoOnOutput,
|
|
Toshihiro Shimizu |
890ddd |
TRectD &rectOnInput,
|
|
Toshihiro Shimizu |
890ddd |
TRenderSettings &infoOnInput)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
rectOnInput = rectOnOutput;
|
|
Toshihiro Shimizu |
890ddd |
infoOnInput = infoOnOutput;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int shrink = tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0);
|
|
Toshihiro Shimizu |
890ddd |
int argc = 8;
|
|
Toshihiro Shimizu |
890ddd |
const char *argv[8];
|
|
Toshihiro Shimizu |
890ddd |
argv[0] = strsave(toString(L"-1").c_str());
|
|
Toshihiro Shimizu |
890ddd |
getValues(argv, argc, frame);
|
|
Toshihiro Shimizu |
890ddd |
SandorFxRenderData *outBorderData = new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Toshihiro Shimizu |
890ddd |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Toshihiro Shimizu |
890ddd |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_colorIndex = L"-1";
|
|
Toshihiro Shimizu |
890ddd |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_noise = m_noise->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_thickness = m_thickness->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
params.m_vertical = m_vertical->getValue(frame);
|
|
Toshihiro Shimizu |
890ddd |
infoOnInput.m_data.push_back(outBorderData);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_IDENTIFIER(CalligraphicFx, "calligraphicFx");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FX_PLUGIN_IDENTIFIER(OutBorderFx, "outBorderFx");
|