|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
![](https://seccdn.libravatar.org/avatar/2e5dd0bee1e7e619066117de357c8458fc7e847f4345b0cb8a7a5413aa2a45a0?d=retro&s=16) |
e280ae |
#ifdef _MSC_VER
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4996)
|
|
![](https://seccdn.libravatar.org/avatar/2e5dd0bee1e7e619066117de357c8458fc7e847f4345b0cb8a7a5413aa2a45a0?d=retro&s=16) |
e280ae |
#endif
|
|
![](https://seccdn.libravatar.org/avatar/2e5dd0bee1e7e619066117de357c8458fc7e847f4345b0cb8a7a5413aa2a45a0?d=retro&s=16) |
e280ae |
|
|
![](https://seccdn.libravatar.org/avatar/2e5dd0bee1e7e619066117de357c8458fc7e847f4345b0cb8a7a5413aa2a45a0?d=retro&s=16) |
e280ae |
#ifdef _WIN32
|
|
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 <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 |
|
|
Shinya Kitaoka |
d1f6c4 |
class CalligraphicFx final : public TStandardRasterFx {
|
|
Shinya Kitaoka |
120a6e |
FX_PLUGIN_DECLARATION(CalligraphicFx)
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_input;
|
|
Shinya Kitaoka |
120a6e |
TStringParamP m_colorIndex;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_thickness;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_horizontal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_upWDiagonal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_vertical;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_doWDiagonal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_accuracy;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_noise;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
CalligraphicFx()
|
|
Shinya Kitaoka |
120a6e |
: m_colorIndex(L"1,2,3")
|
|
Shinya Kitaoka |
120a6e |
, m_thickness(5.0)
|
|
Shinya Kitaoka |
120a6e |
, m_horizontal(100.0)
|
|
Shinya Kitaoka |
120a6e |
, m_upWDiagonal(50.0)
|
|
Shinya Kitaoka |
120a6e |
, m_vertical(0.0)
|
|
Shinya Kitaoka |
120a6e |
, m_doWDiagonal(50.0)
|
|
Shinya Kitaoka |
120a6e |
, m_accuracy(50.0)
|
|
Shinya Kitaoka |
120a6e |
, m_noise(0.0) {
|
|
Shinya Kitaoka |
120a6e |
m_thickness->setMeasureName("fxLength");
|
|
Shinya Kitaoka |
120a6e |
addInputPort("Source", m_input);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Color_Index", m_colorIndex);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Thickness", m_thickness);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Accuracy", m_accuracy);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Noise", m_noise);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Horizontal", m_horizontal);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "upWDiagonal", m_upWDiagonal);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Vertical", m_vertical);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "doWDiagonal", m_doWDiagonal);
|
|
Shinya Kitaoka |
120a6e |
m_thickness->setValueRange(0.0, 60.0);
|
|
Shinya Kitaoka |
120a6e |
m_horizontal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_upWDiagonal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_vertical->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_doWDiagonal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_accuracy->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_noise->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
~CalligraphicFx(){};
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
bool doGetBBox(double frame, TRectD &bBox,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &info) override {
|
|
Shinya Kitaoka |
120a6e |
if (m_input.isConnected()) {
|
|
Shinya Kitaoka |
120a6e |
TRenderSettings info2(info);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str());
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *calligraphicData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame) * 0.5;
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
info2.m_data.push_back(calligraphicData);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return m_input->doGetBBox(frame, bBox, info2);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
bBox = TRectD();
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
bool canHandle(const TRenderSettings &info, double frame) override {
|
|
Shinya Kitaoka |
38fd86 |
return true;
|
|
Shinya Kitaoka |
38fd86 |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
bool allowUserCacheOnPort(int port) override { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void getValues(const char *argv[], int argc, double frame) {
|
|
Shinya Kitaoka |
120a6e |
double values[8];
|
|
Shinya Kitaoka |
120a6e |
values[1] = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[2] = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[3] = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[4] = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[5] = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[6] = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[7] = m_thickness->getValue(frame) * 0.5;
|
|
Shinya Kitaoka |
120a6e |
convertParam(values, argv, argc);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
//----------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
char *strsave(const char *t) {
|
|
Shinya Kitaoka |
120a6e |
char *s;
|
|
Shinya Kitaoka |
120a6e |
s = (char *)malloc(strlen(t) + 1);
|
|
Shinya Kitaoka |
120a6e |
strcpy(s, t);
|
|
Shinya Kitaoka |
120a6e |
return s;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//-----------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void convertParam(double param[], const char *cParam[], int cParamLen) {
|
|
Shinya Kitaoka |
120a6e |
std::string app;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 1; i < cParamLen; i++) {
|
|
Shinya Kitaoka |
120a6e |
app = std::to_string(param[i]);
|
|
Shinya Kitaoka |
120a6e |
cParam[i] = strsave(app.c_str());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
void doCompute(TTile &tile, double frame,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &ri) override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_input.isConnected()) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str());
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
TRenderSettings ri2(ri);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *calligraphicData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame) * 0.5;
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
ri2.m_data.push_back(calligraphicData);
|
|
Shinya Kitaoka |
120a6e |
ri2.m_userCachable = false;
|
|
Shinya Kitaoka |
120a6e |
m_input->compute(tile, frame, ri2);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void transform(double frame, int port, const TRectD &rectOnOutput,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &infoOnOutput, TRectD &rectOnInput,
|
|
Shinya Kitaoka |
473e70 |
TRenderSettings &infoOnInput) override {
|
|
Shinya Kitaoka |
120a6e |
rectOnInput = rectOnOutput;
|
|
Shinya Kitaoka |
120a6e |
infoOnInput = infoOnOutput;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink =
|
|
Shinya Kitaoka |
120a6e |
tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = strsave(::to_string(m_colorIndex->getValue()).c_str());
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *calligraphicData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(Calligraphic, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = calligraphicData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = m_colorIndex->getValue();
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
infoOnInput.m_data.push_back(calligraphicData);
|
|
Shinya Kitaoka |
120a6e |
infoOnInput.m_userCachable = false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Shinya Kitaoka |
d1f6c4 |
class OutBorderFx final : public TStandardRasterFx {
|
|
Shinya Kitaoka |
120a6e |
FX_PLUGIN_DECLARATION(OutBorderFx)
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_input;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_thickness;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_horizontal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_upWDiagonal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_vertical;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_doWDiagonal;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_accuracy;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_noise;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
OutBorderFx()
|
|
Shinya Kitaoka |
120a6e |
: m_thickness(5.0)
|
|
Shinya Kitaoka |
120a6e |
, m_horizontal(100.0)
|
|
Shinya Kitaoka |
120a6e |
, m_upWDiagonal(100.0)
|
|
Shinya Kitaoka |
120a6e |
, m_vertical(100.0)
|
|
Shinya Kitaoka |
120a6e |
, m_doWDiagonal(100.0)
|
|
Shinya Kitaoka |
120a6e |
, m_accuracy(50.0)
|
|
Shinya Kitaoka |
120a6e |
, m_noise(0.0) {
|
|
Shinya Kitaoka |
120a6e |
m_thickness->setMeasureName("fxLength");
|
|
Shinya Kitaoka |
120a6e |
addInputPort("Source", m_input);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Thickness", m_thickness);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Accuracy", m_accuracy);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Noise", m_noise);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Horizontal", m_horizontal);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "upWDiagonal", m_upWDiagonal);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "Vertical", m_vertical);
|
|
Shinya Kitaoka |
120a6e |
bindParam(this, "doWDiagonal", m_doWDiagonal);
|
|
Shinya Kitaoka |
120a6e |
m_thickness->setValueRange(0.0, 30.0);
|
|
Shinya Kitaoka |
120a6e |
m_horizontal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_upWDiagonal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_vertical->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_doWDiagonal->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_accuracy->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
m_noise->setValueRange(0.0, 100.0);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
~OutBorderFx(){};
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
bool doGetBBox(double frame, TRectD &bBox,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &info) override {
|
|
Shinya Kitaoka |
120a6e |
if (m_input.isConnected()) {
|
|
Shinya Kitaoka |
120a6e |
TRenderSettings info2(info);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink = tround((info.m_shrinkX + info.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = "-1";
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *outBorderData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = L"-1";
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
info2.m_data.push_back(outBorderData);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return m_input->doGetBBox(frame, bBox, info2);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
bBox = TRectD();
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
bool canHandle(const TRenderSettings &info, double frame) override {
|
|
Shinya Kitaoka |
38fd86 |
return true;
|
|
Shinya Kitaoka |
38fd86 |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void getValues(const char *argv[], int argc, double frame) {
|
|
Shinya Kitaoka |
120a6e |
double values[8];
|
|
Shinya Kitaoka |
120a6e |
values[1] = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[2] = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[3] = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[4] = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[5] = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[6] = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
values[7] = m_thickness->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
convertParam(values, argv, argc);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
//----------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
char *strsave(const char *t) {
|
|
Shinya Kitaoka |
120a6e |
char *s;
|
|
Shinya Kitaoka |
120a6e |
s = (char *)malloc(strlen(t) + 1);
|
|
Shinya Kitaoka |
120a6e |
strcpy(s, t);
|
|
Shinya Kitaoka |
120a6e |
return s;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
//-----------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void convertParam(double param[], const char *cParam[], int cParamLen) {
|
|
Shinya Kitaoka |
120a6e |
std::string app;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 1; i < cParamLen; i++) {
|
|
Shinya Kitaoka |
120a6e |
app = std::to_string(param[i]);
|
|
Shinya Kitaoka |
120a6e |
cParam[i] = strsave(app.c_str());
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
38fd86 |
void doCompute(TTile &tile, double frame,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &ri) override {
|
|
Shinya Kitaoka |
120a6e |
if (!m_input.isConnected()) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink = tround((ri.m_shrinkX + ri.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = "-1";
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
TRenderSettings ri2(ri);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *outBorderData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = L"-1";
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
ri2.m_data.push_back(outBorderData);
|
|
Shinya Kitaoka |
120a6e |
m_input->compute(tile, frame, ri2);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void transform(double frame, int port, const TRectD &rectOnOutput,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &infoOnOutput, TRectD &rectOnInput,
|
|
Shinya Kitaoka |
473e70 |
TRenderSettings &infoOnInput) override {
|
|
Shinya Kitaoka |
120a6e |
rectOnInput = rectOnOutput;
|
|
Shinya Kitaoka |
120a6e |
infoOnInput = infoOnOutput;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int shrink =
|
|
Shinya Kitaoka |
120a6e |
tround((infoOnOutput.m_shrinkX + infoOnOutput.m_shrinkY) / 2.0);
|
|
Shinya Kitaoka |
120a6e |
int argc = 8;
|
|
Shinya Kitaoka |
120a6e |
const char *argv[8];
|
|
Shinya Kitaoka |
120a6e |
argv[0] = "-1";
|
|
Shinya Kitaoka |
120a6e |
getValues(argv, argc, frame);
|
|
Shinya Kitaoka |
120a6e |
SandorFxRenderData *outBorderData =
|
|
Shinya Kitaoka |
120a6e |
new SandorFxRenderData(OutBorder, argc, argv, 0, shrink);
|
|
Shinya Kitaoka |
120a6e |
CalligraphicParams ¶ms = outBorderData->m_callParams;
|
|
Shinya Kitaoka |
120a6e |
params.m_accuracy = m_accuracy->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_horizontal = m_horizontal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_colorIndex = L"-1";
|
|
Shinya Kitaoka |
120a6e |
params.m_upWDiagonal = m_upWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_noise = m_noise->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_doWDiagonal = m_doWDiagonal->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_thickness = m_thickness->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
params.m_vertical = m_vertical->getValue(frame);
|
|
Shinya Kitaoka |
120a6e |
infoOnInput.m_data.push_back(outBorderData);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
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");
|