📄 pixelprocessor.h
字号:
/*
* Copyright (C) =USTC= Fu Li
*
* Author : Fu Li
* Create : 2004-2-21
* Home : http://www.crazy-bit.com/
* Mail : crazybit@263.net
* History :
*/
#ifndef __FOO_SINGLE_PIXEL_PROCESSOR_H__
#define __FOO_SINGLE_PIXEL_PROCESSOR_H__
#include "PixelProcessorBase.h"
class FCHistogram ; // external class
//class FCSinglePixelProcessBase ;
class FCPixelCombineColor ; // 组合颜色/combine color (32 bit)
class FCPixelAdjustRGB ; // 调节RGB值/adjust RGB (>=24 bit)
class FCPixelThreshold ; // 阈图/threshold (>=24 bit)
class FCPixelAddRandomNoise ; // 加入噪音/add random noise (>=24 bit)
class FCPixelNoisify ; // 加入噪音/noisify (>=24 bit)
class FCPixelMirror ; // 左右镜像/mirror (>=8 bit)
class FCPixelFlip ; // 上下翻转/flip (>=8 bit)
class FCPixelEmboss ; // 浮雕/emboss (>=24 bit)
class FCPixelColorTone ; // 单色调/color tone (>=24 bit)
class FCPixelSplash ; // 飞溅效果/splash (>=24 bit)
class FCPixelHalftoneM3 ; // 半影调/halftone (>=24 bit),使用Limb Pattern M3算法
class FCPixelDeinterlace ; // 重构奇偶线/de-interlace (32 bit)
class FCPixelRotate90 ; // 顺时针旋转90度/rotate 90' (>=8 bit)
class FCPixelRotate270 ; // 顺时针旋转270度/rotate 270' (>=8 bit)
class FCPixelCreateHalo ; // 制作光晕/create halo (8 bit)
class FCPixelCreateEllipse ; // 制作椭圆区域/create ellipse mask (8 bit)
class FCPixelMedianFilter ; // 中值滤波/Median filter (>=24 bit)
class FCPixelMosaic ; // 马赛克/mosaic (32 bit)
class FCPixelFillGrid ; // 制作格子图/fill grid (>=24 bit)
class FCPixelOilPaint ; // 油画/oil paint (>=24 bit)
class FCPixelBlinds ; // 百叶窗/blinds (>=24 bit)
class FCPixelShift ; // 移位/shift (>=24 bit)
class FCPixelInnerBevelFrame ; // bevel边框/add bevel frame (>=24 bit)
class FCPixelFill3DSolidFrame ; // 边框/fill 3D solid frame (>=24 bit)
class FCPixel3DGrid ; // 加3D网格/add 3D grid (>=24 bit)
class FCPixelIllusion ; // 幻想/illusion (>=24 bit)
class FCPixelVideo ; // 电视画面/video (>=24 bit)
class FCPixelColorBalance ; // 色彩平衡/color balance (>=24 bit)
class FCPixelAutoContrast ; // 自动对比度调整/auto contrast (>=24 bit)
class FCPixelAutoColorEnhance ; // 自动颜色增强/auto color enhance (>=24 bit)
class FCPixelColorLevel ; // 色阶/color level (>=24 bit)
class FCPixelBilinearDistord ; // bilinear distord (>=24 bit)
class FCPixelCylinder ; // 柱面/cylinder (>=24 bit)
class FCPixelWave ; // 波动/wave (>=24 bit)
class FCPixelWhirlPinch ; // 旋转挤压/whirl & pinch (>=24 bit)
class FCPixelFractalTrace ; // 分形/fractal trace (>=24 bit)
class FCPixelLens ; // 凸透镜/lens (>=24 bit)
class FCPixelSkew ; // 错切变形/skew transform (>=24 bit)
class FCPixelPerspective ; // 透镜变形/perspective transform (>=24 bit)
class FCPixelRotate ; // 旋转/rotate image (>=24 bit)
class FCPixelRibbon ; // 带形/ribbon (>=24 bit)
class FCPixelRipple ; // 波纹/ripple (>=24 bit)
class FCPixelSmallTile ; // tile (>=24 bit)
class FCPixelConvolute ; // 图象卷积运算/image convolute (>= 24 bit)
class FCPixelGaussianBlur3x3 ; // 标准高斯模糊/regular gaussian blur (>=24 bit)
class FCPixelGaussianBlur5x5 ;
class FCPixelDetectEdges ; // 边缘检测/detect edges (>=24 bit)
class FCPixelSharp ; // 锐化/sharp (>=24 bit)
class FCPixelConvertTo16Bit ; // 1, 4, 8, 24, 32 ==> 16
class FCPixelConvertTo8BitGray ; // 1, 4, 8, 16, 24, 32 ==> 8bit gray
class FCPixelConvertQuantize ; // quantize
class FCPixelExportAscII ; // 导出成ASCII文件/save a ASCII text file
class FCPixelSpliteChannel_RGB ; // 分离RGB通道/splite RGB channel (>=24 bit)
class FCPixelCombineChannel_RGB ; // 合并RGB通道/combine RGB channel (>=24 bit)
class FCPixelColorsCount ; // 统计出现的颜色个数/count image's number of color (>=24 bit)
class FCPixelGetKeyColor ; // 得到一个不在图像中出现的颜色(作透明色) (>=24 bit)
//=============================================================================
// 组合颜色/combine color (32 bit)
class FCPixelCombineColor : public FCSinglePixelProcessBase
{
public:
FCPixelCombineColor (RGBQUAD crFill) : m_crFill(crFill) {}
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
RGBQUAD m_crFill ;
} ;
//=============================================================================
/** <B>adjust image's RGB value (>=24 bit).</B> */
class FCPixelAdjustRGB : public FCSinglePixelProcessBase
{
public:
/** Constructor. */
FCPixelAdjustRGB (int nDeltaR, int nDeltaG, int nDeltaB) : m_iDeltaR(nDeltaR), m_iDeltaG(nDeltaG), m_iDeltaB(nDeltaB) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_iDeltaR, m_iDeltaG, m_iDeltaB ;
} ;
//=============================================================================
/** <B>threshold image (>=24 bit).</B> */
class FCPixelThreshold : public FCSinglePixelProcessBase
{
public:
/** Constructor. */
FCPixelThreshold (int nLevel) : m_nLevel(FClamp0255(nLevel)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_nLevel ;
} ;
//=============================================================================
/** <B>add noise (>=24 bit).</B> */
class FCPixelAddRandomNoise : public FCSinglePixelProcessBase
{
public:
/** Constructor. */
FCPixelAddRandomNoise (int nLevel) : m_nLevel(nLevel) {srand((unsigned int)time(NULL));}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
private:
int m_nLevel ;
} ;
//=============================================================================
// 加入噪音/noisify (>=24 bit)
class FCPixelNoisify : public FCSinglePixelProcessBase
{
public:
FCPixelNoisify (int nLevel) : m_nLevel(FClamp(nLevel,0,100)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
double GenGauss () const ;
protected:
int m_nLevel ;
} ;
//=============================================================================
// 左右镜像/mirror (>=8 bit)
class FCPixelMirror : public FCSinglePixelProcessBase
{
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
} ;
//=============================================================================
// 上下翻转/flip (>=8 bit)
class FCPixelFlip : public FCSinglePixelProcessBase
{
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
} ;
//=============================================================================
// 浮雕/emboss (>=24 bit)
class FCPixelEmboss : public FCSinglePixelProcessBase
{
public:
FCPixelEmboss (int nLevel) : m_nLevel(nLevel) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
int m_nLevel ;
} ;
//=============================================================================
// 单色调/color tone (>=24 bit)
class FCPixelColorTone : public FCSinglePixelProcessBase
{
public:
FCPixelColorTone (RGBQUAD & crTone) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
protected:
int final_red_lookup[256], final_green_lookup[256], final_blue_lookup[256] ;
} ;
//=============================================================================
/** <B>splash image (>=24 bit).</B> */
class FCPixelSplash : public FCSinglePixelProcessBase
{
public:
/** nBlock : splash level (>=3). */
FCPixelSplash (int nBlock) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
private:
int m_nBlock ;
} ;
//=============================================================================
// 半影调/halftone (>=24 bit),使用Limb Pattern M3算法
class FCPixelHalftoneM3 : public FCSinglePixelProcessBase
{
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
} ;
//=============================================================================
// 重构奇偶线/de-interlace (32 bit)
class FCPixelDeinterlace : public FCSinglePixelProcessBase
{
public:
enum SCAN_FIELDS { SCAN_EVEN = 0, SCAN_ODD = 1 } ;
FCPixelDeinterlace (SCAN_FIELDS EliminateFields) : m_Fields(EliminateFields) {}
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
protected:
SCAN_FIELDS m_Fields ; // 消除的扫描线
} ;
//=============================================================================
// 顺时针旋转90度/rotate 90' (>=8 bit)
class FCPixelRotate90 : public FCSinglePixelProcessBase
{
virtual BOOL ValidateColorBits (const FCObjImage* pImg) ;
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
} ;
//=============================================================================
// 顺时针旋转270度/rotate 270' (>=8 bit)
class FCPixelRotate270 : public FCPixelRotate90
{
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
} ;
//=============================================================================
// 制作光晕/fill halo (8 bit)
class FCPixelCreateHalo : public FCSinglePixelProcessBase
{
public:
FCPixelCreateHalo (int nRadius, int crCenter, int crEdge) ;
virtual BOOL ValidateColorBits (const FCObjImage* pImg) {return TRUE;}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
protected:
double m_fRadius ;
int m_crCenter, m_crEdge ;
POINT m_ptCenter ;
} ;
//=============================================================================
// 制作椭圆区域/create ellipse mask (8 bit)
class FCPixelCreateEllipse : public FCSinglePixelProcessBase
{
public:
FCPixelCreateEllipse (const RECT & rcEllipse) ;
virtual BOOL ValidateColorBits (const FCObjImage* pImg) {return TRUE;}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
virtual void OnEnterProcess (FCObjImage* pImg, RECT& rcImg) ;
protected:
RECT m_rcEllipse ;
POINT_F m_ptCenter ;
} ;
//=============================================================================
// 中值滤波/Median filter (>=24 bit)
class FCPixelMedianFilter : public FCSinglePixelProcessBase
{
public:
FCPixelMedianFilter (int nSize) : m_nSize(nSize), m_pBlock(NULL), m_pBakImage(NULL), m_nBlockNum(FSquare(nSize)) {}
virtual void ProcessPixel (FCObjImage* pImg, int x, int y, BYTE* pPixel) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -