Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// EraseContour.h: interface for the CEraseContour class.
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//////////////////////////////////////////////////////////////////////
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if !defined(AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_0040F674BE6A__INCLUDED_)
Toshihiro Shimizu 890ddd
#define AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_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 "STColSelPic.h"
Toshihiro Shimizu 890ddd
#include "toonz4.6/raster.h"
Toshihiro Shimizu 890ddd
#include "SDef.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define MAXNB_NEIGHBOURS 1500
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class CEraseContour
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	UC_PIXEL *m_picUC;
Toshihiro Shimizu 890ddd
	US_PIXEL *m_picUS;
Toshihiro Shimizu 890ddd
	const RASTER *m_ras;
Toshihiro Shimizu 890ddd
	UCHAR *m_sel;
Toshihiro Shimizu 890ddd
	int m_lX, m_lY;
Toshihiro Shimizu 890ddd
	CCIL m_cil;
Toshihiro Shimizu 890ddd
	SXYDW m_neighbours[MAXNB_NEIGHBOURS];
Toshihiro Shimizu 890ddd
	int m_nbNeighbours;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void null();
Toshihiro Shimizu 890ddd
	int makeSelectionCMAP32();
Toshihiro Shimizu 890ddd
	int makeSelection();
Toshihiro Shimizu 890ddd
	void eraseInkColors();
Toshihiro Shimizu 890ddd
	void prepareNeighbours();
Toshihiro Shimizu 890ddd
	bool findClosestPaint(const int xx, const int yy, I_PIXEL &ip);
Toshihiro Shimizu 890ddd
	void sel0123To01();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	CEraseContour() : m_picUC(0), m_picUS(0), m_ras(0), m_sel(0),
Toshihiro Shimizu 890ddd
					  m_lX(0), m_lY(0), m_cil(){};
Toshihiro Shimizu 890ddd
	virtual ~CEraseContour();
Toshihiro Shimizu 890ddd
	int makeSelection(const CCIL &iil);
Toshihiro Shimizu 890ddd
	int doIt(const CCIL &iil);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <class p=""></class>
Toshihiro Shimizu 890ddd
	CEraseContour(CSTColSelPic

&p)

Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		null();
Toshihiro Shimizu 890ddd
		if (p.m_lX > 0 && p.m_lY > 0 && p.m_sel && p.m_pic && p.m_ras) {
Toshihiro Shimizu 890ddd
			m_lX = p.m_lX;
Toshihiro Shimizu 890ddd
			m_lY = p.m_lY;
Toshihiro Shimizu 890ddd
			m_sel = p.m_sel;
Toshihiro Shimizu 890ddd
			m_ras = p.m_ras;
Toshihiro Shimizu 890ddd
			if (p.getType() == ST_RGBM) {
Toshihiro Shimizu 890ddd
				m_picUC = (UC_PIXEL *)p.m_pic;
Toshihiro Shimizu 890ddd
				m_picUS = 0;
Toshihiro Shimizu 890ddd
			} else if (p.getType() == ST_RGBM64) {
Toshihiro Shimizu 890ddd
				m_picUC = 0;
Toshihiro Shimizu 890ddd
				m_picUS = (US_PIXEL *)p.m_pic;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // !defined(AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_0040F674BE6A__INCLUDED_)