Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// YOMBInputParam.h: interface for the CYOMBInputParam class.
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//////////////////////////////////////////////////////////////////////
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if !defined(AFX_YOMBINPUTPARAM_H__41D42153_F2EE_11D5_B92D_0040F674BE6A__INCLUDED_)
Toshihiro Shimizu 890ddd
#define AFX_YOMBINPUTPARAM_H__41D42153_F2EE_11D5_B92D_0040F674BE6A__INCLUDED_
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if _MSC_VER > 1000
Toshihiro Shimizu 890ddd
#pragma once
Toshihiro Shimizu 890ddd
#endif // _MSC_VER > 1000
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "SDef.h"
Toshihiro Shimizu 890ddd
#include "InputParam.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define MAXNBCIL 4096 //512
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef struct color_index_list {
Toshihiro Shimizu 890ddd
	int nb;
Toshihiro Shimizu 890ddd
	unsigned short ci[MAXNBCIL];
Toshihiro Shimizu 890ddd
} COLOR_INDEX_LIST;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class CYOMBInputParam : public CInputParam
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	bool m_isRandomSampling;
Toshihiro Shimizu 890ddd
	bool m_isShowSelection;
Toshihiro Shimizu 890ddd
	bool m_isStopAtContour;
Toshihiro Shimizu 890ddd
	double m_dSample;
Toshihiro Shimizu 890ddd
	int m_nbSample;
Toshihiro Shimizu 890ddd
	double m_dA, m_dAB;
Toshihiro Shimizu 890ddd
	// RGB parameters. List of RGB colors.
Toshihiro Shimizu 890ddd
	int m_color[5][4];
Toshihiro Shimizu 890ddd
	int m_nbColor;
Toshihiro Shimizu 890ddd
	// CMAP Parameters. The list of ink & paint indices.
Toshihiro Shimizu 890ddd
	COLOR_INDEX_LIST m_ink, m_paint;
Toshihiro Shimizu 890ddd
	bool m_isCM;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	CYOMBInputParam() : m_isRandomSampling(false),
Toshihiro Shimizu 890ddd
						m_isShowSelection(false), m_isStopAtContour(false),
Toshihiro Shimizu 890ddd
						m_dSample(0.0), m_nbSample(0),
Toshihiro Shimizu 890ddd
						m_dA(0.0), m_dAB(0.0), m_nbColor(0), m_isCM(false)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		for (int i = 0; i < 5; i++)
Toshihiro Shimizu 890ddd
			m_color[i][0] = m_color[i][1] = m_color[i][2] = m_color[i][3] = 0;
Toshihiro Shimizu 890ddd
		m_ink.nb = m_paint.nb = 0;
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
	CYOMBInputParam(const CYOMBInputParam &p) : CInputParam(p),
Toshihiro Shimizu 890ddd
												m_isRandomSampling(p.m_isRandomSampling),
Toshihiro Shimizu 890ddd
												m_isShowSelection(p.m_isShowSelection),
Toshihiro Shimizu 890ddd
												m_isStopAtContour(p.m_isStopAtContour),
Toshihiro Shimizu 890ddd
												m_dSample(p.m_dSample), m_nbSample(p.m_nbSample),
Toshihiro Shimizu 890ddd
												m_dA(p.m_dA), m_dAB(p.m_dAB), m_nbColor(p.m_nbColor),
Toshihiro Shimizu 890ddd
												m_isCM(p.m_isCM)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (m_isCM) {
Toshihiro Shimizu 890ddd
			m_ink.nb = p.m_ink.nb;
Toshihiro Shimizu 890ddd
			int i = 0;
Toshihiro Shimizu 890ddd
			for (i = 0; i < m_ink.nb; i++)
Toshihiro Shimizu 890ddd
				m_ink.ci[i] = p.m_ink.ci[i];
Toshihiro Shimizu 890ddd
			m_paint.nb = p.m_paint.nb;
Toshihiro Shimizu 890ddd
			for (i = 0; i < m_paint.nb; i++)
Toshihiro Shimizu 890ddd
				m_paint.ci[i] = p.m_paint.ci[i];
Toshihiro Shimizu 890ddd
		} else
Toshihiro Shimizu 890ddd
			for (int i = 0; i < 5; i++)
Toshihiro Shimizu 890ddd
				for (int j = 0; j < 4; j++)
Toshihiro Shimizu 890ddd
					m_color[i][j] = p.m_color[i][j];
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	CYOMBInputParam(const int argc, const char *argv[], const int shrink);
Toshihiro Shimizu 890ddd
	CYOMBInputParam(const int argc, const char *argv[], const int shrink,
Toshihiro Shimizu 890ddd
					const bool isCM16);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual ~CYOMBInputParam(){};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void makeColorIndexList(const char *s, COLOR_INDEX_LIST &cil,
Toshihiro Shimizu 890ddd
							const int maxIndex);
Toshihiro Shimizu 890ddd
	bool isRange(const char *s) const;
Toshihiro Shimizu 890ddd
	int getRangeBegin(const char *s) const;
Toshihiro Shimizu 890ddd
	int getRangeEnd(const char *s) const;
Toshihiro Shimizu 890ddd
	void strToColorIndex(const char *s, COLOR_INDEX_LIST &cil,
Toshihiro Shimizu 890ddd
						 const int maxIndex);
Toshihiro Shimizu 890ddd
	void print(COLOR_INDEX_LIST &cil);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//	void makeBlendString(const char *ss);
Toshihiro Shimizu 890ddd
	bool isOK();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // !defined(AFX_YOMBINPUTPARAM_H__41D42153_F2EE_11D5_B92D_0040F674BE6A__INCLUDED_)