📄 pixelprocessor.h
字号:
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void OnLeaveProcess (FCObjImage * pImg) ;
public:
typedef struct tagBlockElem
{
RGBQUAD crOrigin ;
int nGray ;
} BlockElem ;
protected:
int m_nSize ;
int m_nBlockNum ;
BlockElem * m_pBlock ;
FCObjImage * m_pBakImage ;
} ;
//=============================================================================
// 马赛克/mosaic (32 bit)
class FCPixelMosaic : public FCSinglePixelProcessBase
{
public:
FCPixelMosaic (int nBlock) : m_nBlock(FMax(2,nBlock)) {}
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
private:
RGBQUAD GetBlockAverage (const FCObjImage * pImg, int x, int y) ;
private:
int m_nBlock ;
} ;
//=============================================================================
// 制作格子图/fill grid (>=24 bit)
class FCPixelFillGrid : public FCSinglePixelProcessBase
{
public:
FCPixelFillGrid (RGBQUAD cr1, RGBQUAD cr2, int nPitch) : m_cr1(cr1), m_cr2(cr2), m_nPitch(FMax(1,nPitch)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
RGBQUAD m_cr1, m_cr2 ;
int m_nPitch ;
} ;
//=============================================================================
// 油画/oil paint (>=24 bit)
class FCPixelOilPaint : public FCSinglePixelProcessBase
{
public:
FCPixelOilPaint (int nRadius) : m_nRadius(FMax(1,nRadius)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void OnLeaveProcess (FCObjImage * pImg) ;
protected:
int m_nRadius ; // >= 1
int m_nLength ; // 2*m_nRadius + 1
FCObjImage * m_pImgGray ;
} ;
//=============================================================================
// 百叶窗/blinds (>=24 bit)
class FCPixelBlinds : public FCSinglePixelProcessBase
{
public:
FCPixelBlinds (AXIS_SYS nDirect, int nWidth, int nOpacity, RGBQUAD crBlind) : m_nDirect(nDirect), m_nWidth(nWidth), m_nOpacity(nOpacity), m_crBlind(crBlind) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
protected:
AXIS_SYS m_nDirect ;
int m_nWidth ;
int m_nOpacity ;
RGBQUAD m_crBlind ;
} ;
//=============================================================================
// 移位/shift (>=24 bit)
class FCPixelShift : public FCSinglePixelProcessBase
{
public:
FCPixelShift (int nAmount) : m_nAmount (FMax(0,nAmount)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
int m_nAmount ; // 扫描线平移最大距离
} ;
//=============================================================================
// bevel边框/add bevel frame (>=24 bit)
class FCPixelInnerBevelFrame : public FCSinglePixelProcessBase
{
public:
FCPixelInnerBevelFrame (int nSize, int nSmooth) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_nSize, m_nSmooth ;
int m_nLBright, m_nTBright, m_nRBright, m_nBBright ;
} ;
//=============================================================================
// 边框/fill a 3D solid frame (>=24 bit)
class FCPixelFill3DSolidFrame : public FCSinglePixelProcessBase
{
public:
FCPixelFill3DSolidFrame (int nWidth) : m_nWidth(FMax(3,nWidth)) {}
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_nWidth ; // >=3
RECT m_rcOut, m_rcO, m_rcI, m_rcIn ;
} ;
//=============================================================================
// 加3D网格/add 3D grid (>=24 bit)
class FCPixel3DGrid : public FCSinglePixelProcessBase
{
public:
FCPixel3DGrid (int nSize, int nDepth) : m_nSize(FMax(1,nSize)), m_nDepth(nDepth) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_nSize ;
int m_nDepth ;
} ;
//=============================================================================
// 幻想/illusion (>=24 bit)
class FCPixelIllusion : public FCSinglePixelProcessBase
{
public:
FCPixelIllusion (int nAmount) : m_nAmount(nAmount) {}
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
int m_nAmount ;
double m_fScale, m_fOffset ;
} ;
//=============================================================================
// 电视画面/video (>=24 bit)
class FCPixelVideo : public FCSinglePixelProcessBase
{
public:
enum VIDEO_TYPE {VIDEO_STAGGERED=0, VIDEO_TRIPED=1, VIDEO_3X3=2, VIDEO_DOTS=3} ;
FCPixelVideo (VIDEO_TYPE nVideoType) : m_VideoType(nVideoType) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
VIDEO_TYPE m_VideoType ;
} ;
//=============================================================================
// 色彩平衡/color balance (>=24 bit)
class FCPixelColorBalance : public FCSinglePixelProcessBase
{
public:
FCPixelColorBalance (BOOL bPreLum, TONE_REGION ToneRgn, int cyan_red, int magenta_green, int yellow_blue) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
BOOL m_bPreserveLuminosity ;
BYTE m_pLookupR[256], m_pLookupG[256], m_pLookupB[256] ;
} ;
//=============================================================================
// 自动对比度调整/auto contrast (>=24 bit)
class FCPixelAutoContrast : public FCSinglePixelProcessBase
{
public:
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
BYTE m_byLut[256][3] ;
} ;
//=============================================================================
// 自动颜色增强/auto color enhance (>=24 bit)
class FCPixelAutoColorEnhance : public FCSinglePixelProcessBase
{
public:
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
double m_vhi, m_vlo ;
} ;
//=============================================================================
// 色阶/color level (>=24 bit)
class FCPixelColorLevel : public FCSinglePixelProcessBase
{
public:
FCPixelColorLevel (BOOL bAuto, int nInLow, int nInHigh, IMAGE_CHANNEL nChannel = CHANNEL_RGB) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
void AutoColorLevelChannel (const FCHistogram & histo, IMAGE_CHANNEL nChannel) ;
private:
int m_nInputLow[3], m_nInputHigh[3] ;
int m_nOutputLow, m_nOutputHigh ;
BOOL m_bAuto, m_bChannelR, m_bChannelG, m_bChannelB ;
} ;
//=============================================================================
// bilinear distord (>=24 bit)
class FCPixelBilinearDistord : public FCSinglePixelProcessBase
{
public:
// derived class must bak image in function <OnEnterProcess>
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
// returned BOOL variable to declare continue or not
virtual BOOL calc_undistorted_coord (int x, int y, double & un_x, double & un_y) const =0 ;
} ;
//=============================================================================
// 柱面/cylinder (>=24 bit)
class FCPixelCylinder : public FCPixelBilinearDistord
{
public:
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
protected:
virtual BOOL calc_undistorted_coord (int x, int y, double & un_x, double & un_y) const ;
protected:
std::deque<double> m_ColIndex ;
} ;
//=============================================================================
// 波动/wave (>=24 bit)
class FCPixelWave : public FCPixelBilinearDistord
{
public:
FCPixelWave (int nWavelength, int nAmplitude, double fPhase=0) : m_nWavelength(2*FMax(1,nWavelength)), m_nAmplitude(FMax(1,nAmplitude)), m_fPhase(fPhase) {}
protected:
virtual BOOL calc_undistorted_coord (int x, int y, double & un_x, double & un_y) const ;
private:
double m_fPhase ; // [0..2n]
int m_nAmplitude ;
int m_nWavelength ;
} ;
//=============================================================================
// 旋转挤压/whirl & pinch (>=24 bit)
class FCPixelWhirlPinch : public FCPixelBilinearDistord
{
public:
FCPixelWhirlPinch (double fWhirl, double fPinch) ;
protected:
virtual BOOL calc_undistorted_coord (int x, int y, double & un_x, double & un_y) const ;
protected:
double m_fWhirl ; // radian of whirl
double m_fPinch ; // [-1.0, 1.0]
// double m_fRadiusScale ; // [0.0, 2.0]
} ;
//=============================================================================
// 分形/fractal trace (>=24 bit)
class FCPixelFractalTrace : public FCPixelBilinearDistord
{
public:
FCPixelFractalTrace (int nDepth) : m_nDepth(FMax(1,nDepth)) {}
protected:
void mandelbrot (const double &x, const double &y, double *u, double *v) const ;
virtual BOOL calc_undistorted_coord (int x, int y, double & un_x, double & un_y) const ;
protected:
int m_nDepth ; // >=1
} ;
//=============================================================================
// 凸透镜/lens (>=24 bit)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -