|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// PatternMapParam.cpp: implementation of the CPatternMapParam class.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//////////////////////////////////////////////////////////////////////
|
|
Toshihiro Shimizu |
890ddd |
|
|
|
e280ae |
#ifdef _MSC_VER
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4996)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
#include <math.h></math.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <stdlib.h></stdlib.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <string.h></string.h>
|
|
Toshihiro Shimizu |
890ddd |
#include "PatternMapParam.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "FNSequence.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "SDef.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "SError.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "Pattern.h"
|
|
Toshihiro Shimizu |
890ddd |
//////////////////////////////////////////////////////////////////////
|
|
Toshihiro Shimizu |
890ddd |
// Construction/Destruction
|
|
Toshihiro Shimizu |
890ddd |
//////////////////////////////////////////////////////////////////////
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
CPatternMapParam::CPatternMapParam() { null(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CPatternMapParam::CPatternMapParam(const int argc, const char *argv[],
|
|
Shinya Kitaoka |
120a6e |
const int shrink) {
|
|
Shinya Kitaoka |
120a6e |
try {
|
|
Shinya Kitaoka |
120a6e |
null();
|
|
Shinya Kitaoka |
120a6e |
if (argc == 12) {
|
|
Shinya Kitaoka |
120a6e |
double scale = shrink > 0 ? 1.0 / (double)shrink : 1.0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// strcpy(m_patternFn, argv[0]);
|
|
Shinya Kitaoka |
120a6e |
// CFNSequence fns(argv[0]);
|
|
Shinya Kitaoka |
120a6e |
// fns.getFn(m_patternFn,drawingFn);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_ink.set(argv[0], 4095);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_maxScale = std::max(atof(argv[1]) * scale, atof(argv[2]) * scale);
|
|
Shinya Kitaoka |
120a6e |
m_minScale = std::min(atof(argv[1]) * scale, atof(argv[2]) * scale);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_maxDirAngle = std::max(atof(argv[3]), atof(argv[4]));
|
|
Shinya Kitaoka |
120a6e |
m_minDirAngle = std::min(atof(argv[3]), atof(argv[4]));
|
|
Shinya Kitaoka |
120a6e |
m_isRandomDir = atoi(argv[5]) > 0 ? true : false;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
double dmax = std::max(atof(argv[6]) * scale, 1.0);
|
|
Shinya Kitaoka |
120a6e |
double dmin = std::max(atof(argv[7]) * scale, 1.0);
|
|
Shinya Kitaoka |
120a6e |
m_maxDist = std::max(dmax, dmin);
|
|
Shinya Kitaoka |
120a6e |
m_minDist = std::min(dmax, dmin);
|
|
Shinya Kitaoka |
120a6e |
m_density = shrink > 0 ? atof(argv[8]) * (double)shrink : atof(argv[8]);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
m_isKeepContour = atoi(argv[9]) > 0 ? true : false;
|
|
Shinya Kitaoka |
120a6e |
m_isUseInkColor = atoi(argv[10]) > 0 ? true : false;
|
|
Shinya Kitaoka |
120a6e |
m_isIncludeAlpha = atoi(argv[11]) > 0 ? true : false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} catch (SError) {
|
|
Shinya Kitaoka |
120a6e |
throw;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
CPatternMapParam::~CPatternMapParam() {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void CPatternMapParam::null() {
|
|
Shinya Kitaoka |
120a6e |
m_patternFn[0] = '\0';
|
|
Shinya Kitaoka |
120a6e |
m_ink.m_nb = 0;
|
|
Shinya Kitaoka |
120a6e |
m_isKeepContour = false;
|
|
Shinya Kitaoka |
120a6e |
m_isRandomDir = false;
|
|
Shinya Kitaoka |
120a6e |
m_minDirAngle = 0.0;
|
|
Shinya Kitaoka |
120a6e |
m_maxDirAngle = 0.0;
|
|
Shinya Kitaoka |
120a6e |
m_minScale = 0.2;
|
|
Shinya Kitaoka |
120a6e |
m_maxScale = 0.2;
|
|
Shinya Kitaoka |
120a6e |
m_isUseInkColor = true;
|
|
Shinya Kitaoka |
120a6e |
m_isIncludeAlpha = true;
|
|
Shinya Kitaoka |
120a6e |
m_density = 0.2;
|
|
Shinya Kitaoka |
120a6e |
m_minDist = 3.0;
|
|
Shinya Kitaoka |
120a6e |
m_maxDist = 3.0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void CPatternMapParam::testValue() {
|
|
Shinya Kitaoka |
120a6e |
strcpy(m_patternFn, "d:\\toonz_fx\\test\\artcontour\\e.ttt");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_ink.m_nb = 1;
|
|
Shinya Kitaoka |
120a6e |
m_ink.m_ci[0] = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_isKeepContour = false;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_isRandomDir = false;
|
|
Shinya Kitaoka |
120a6e |
m_minDirAngle = 0.0;
|
|
Shinya Kitaoka |
120a6e |
m_maxDirAngle = 0.0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_minScale = 0.3;
|
|
Shinya Kitaoka |
120a6e |
m_maxScale = 0.4;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
m_isUseInkColor = true;
|
|
Shinya Kitaoka |
120a6e |
m_isIncludeAlpha = true;
|
|
Shinya Kitaoka |
120a6e |
m_density = 0.0;
|
|
Shinya Kitaoka |
120a6e |
m_minDist = 3.0;
|
|
Shinya Kitaoka |
120a6e |
m_maxDist = 3.0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool CPatternMapParam::isOK() { return true; }
|