tahoma2d/toonz/sources/toonzlib/sandor_fxs/EraseContour.h

77 lines
1.6 KiB
C
Raw Normal View History

2016-03-19 06:57:51 +13:00
// EraseContour.h: interface for the CEraseContour class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_0040F674BE6A__INCLUDED_)
#define AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_0040F674BE6A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
2016-04-15 20:34:36 +12:00
#include <memory>
#include <array>
2016-03-19 06:57:51 +13:00
#include "STColSelPic.h"
#include "toonz4.6/raster.h"
#include "SDef.h"
#define MAXNB_NEIGHBOURS 1500
class CEraseContour
{
UC_PIXEL *m_picUC;
US_PIXEL *m_picUS;
const RASTER *m_ras;
2016-04-15 20:34:36 +12:00
std::shared_ptr<UCHAR> m_sel;
2016-03-19 06:57:51 +13:00
int m_lX, m_lY;
CCIL m_cil;
2016-04-15 20:34:36 +12:00
std::array<SXYDW, MAXNB_NEIGHBOURS> m_neighbours;
2016-03-19 06:57:51 +13:00
int m_nbNeighbours;
void null();
int makeSelectionCMAP32();
int makeSelection();
void eraseInkColors();
void prepareNeighbours();
bool findClosestPaint(const int xx, const int yy, I_PIXEL &ip);
void sel0123To01();
public:
2016-04-15 20:34:36 +12:00
CEraseContour()
: m_picUC(0)
, m_picUS(0)
, m_ras(0)
, m_lX(0)
, m_lY(0)
, m_cil()
{
}
2016-03-19 06:57:51 +13:00
virtual ~CEraseContour();
int makeSelection(const CCIL &iil);
int doIt(const CCIL &iil);
template <class P>
CEraseContour(CSTColSelPic<P> &p)
{
null();
if (p.m_lX > 0 && p.m_lY > 0 && p.m_sel && p.m_pic && p.m_ras) {
m_lX = p.m_lX;
m_lY = p.m_lY;
m_sel = p.m_sel;
m_ras = p.m_ras;
if (p.getType() == ST_RGBM) {
m_picUC = (UC_PIXEL *)p.m_pic;
m_picUS = 0;
} else if (p.getType() == ST_RGBM64) {
m_picUC = 0;
m_picUS = (US_PIXEL *)p.m_pic;
}
}
}
};
#endif // !defined(AFX_ERASECONTOUR_H__53513372_34D4_11D6_B9E7_0040F674BE6A__INCLUDED_)