www.pudn.com > isee_code01231.zip > flt_mass.cpp
/********************************************************************
flt_mass.cpp - ISee图像浏览器—图像处理模块类flt_mass实现代码
文件
版权所有(C) VCHelp-coPathway-ISee workgroup 2000 all member's
这一程序是自由软件,你可以遵照自由软件基金会出版的GNU 通用许可证
条款来修改和重新发布这一程序。或者用许可证的第二版,或者(根据你
的选择)用任何更新的版本。
发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特定
目地的隐含的担保。更详细的情况请参阅GNU通用许可证。
你应该已经和程序一起收到一份GNU通用许可证(GPL)的副本。如果还没有,
写信给:
The Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
MA02139, USA
如果你在使用本软件时有什么问题或建议,用以下地址可以与我们取得联
系:
http://isee.126.com
http://www.vchelp.net
或:
iseesoft@china.com
作者:马翔
e-mail:hugesoft@yeah.net
功能实现:对外接口函数
文件版本:
Build 000123
Date 2000-12-3
********************************************************************/
// flt_mass.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "..\public\gol_proc.h"
#include "System.h"
#include "flt_mass.h"
#include "AdjustContrast.h"
#include "ContrastDlg.h"
#include "filter.h"
#include "BogusMulticolor.h"
#include "Reverse.h"
#include "EdgeEnhanceDlg.h"
#include "FilterDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CFlt_massApp
BEGIN_MESSAGE_MAP(CFlt_massApp, CWinApp)
//{{AFX_MSG_MAP(CFlt_massApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFlt_massApp construction
CFlt_massApp::CFlt_massApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFlt_massApp object
CFlt_massApp theApp;
LPIMAGEPROCSTR lpProcInfo;
// 接口函数声明 — 第一层,唯一与外界联系的接口
DLLExport int PASCAL AccessMassFilter(LPIMAGEPROCSTR lpInfo);
//DLLExport int PASCAL AccessPropFilter(LPIMAGEPROCSTR lpInfo);
// 调用处理函数 — 第二层函数
int _fnCMD_CONTRAST(LPIMAGEPROCSTR lpInfo);
int _fnCMD_FILTER(LPIMAGEPROCSTR lpInfo);
int _fnCMD_BOGUS(LPIMAGEPROCSTR lpInfo);
int _fnCMD_REVERSE(LPIMAGEPROCSTR lpInfo);
int _fnCMD_DETECTEDGE(LPIMAGEPROCSTR lpInfo);
// 接口函数 — 第一层,唯一与外界联系的接口
DLLExport int PASCAL AccessMassFilter(LPIMAGEPROCSTR lpInfo)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if(lpInfo==NULL)
return PROCERR_NULLPARAM;
lpProcInfo=lpInfo;
switch(lpInfo->comm)
{
case PCM_NULL: //未操作
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
case PCM_FILTER: // 杂色处理(滤波)
return _fnCMD_FILTER(lpInfo);
case PCM_CONTRAST: // 明暗,对比度处理
return _fnCMD_CONTRAST(lpInfo);
case PCM_DETECTEDGE: // 边缘探测
return _fnCMD_DETECTEDGE(lpInfo);
case PCM_BOGUS: // 伪彩色处理
return _fnCMD_BOGUS(lpInfo);
case PCM_REVERSE: //反色(色彩颠倒)
return _fnCMD_REVERSE(lpInfo);
}
lpInfo->result=PR_ILLCOMM;
return PROCERR_FALSE;
// normal function body here
}
// 调用处理函数 — 第二层函数
int _fnCMD_CONTRAST(LPIMAGEPROCSTR lpInfo)
{
// 检验入口参数是否符合接口定义
ASSERT(lpInfo->_psbdata != NULL);
ASSERT(lpInfo->sImageInfo.bitperpix == 32);
ASSERT(lpInfo->sImageInfo.height > 0);
ASSERT(lpInfo->sImageInfo.width > 0);
ASSERT(lpInfo->annexdata.siAnnData[0]<2); // full image or region
// Initialize the destine image infomation
lpInfo->dImageInfo.height=lpInfo->sImageInfo.height;
lpInfo->dImageInfo.width=lpInfo->sImageInfo.width;
lpInfo->dImageInfo.bitperpix=lpInfo->sImageInfo.bitperpix;
lpInfo->dImageInfo.byteperline=lpInfo->sImageInfo.byteperline;
lpInfo->dImageInfo.bAlpha=lpInfo->sImageInfo.bAlpha;
// Set Modify flag
lpInfo->modify=1;
CContrastDlg m_dContrastDlg;
int nRetCode=m_dContrastDlg.DoModal ();
if(nRetCode==IDOK)
{
lpInfo->result=PR_SUCCESS;
return PROCERR_SUCCESS;
}
else
{
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
}
}
int _fnCMD_FILTER(LPIMAGEPROCSTR lpInfo)
{
// 检验入口参数是否符合接口定义
ASSERT(lpInfo->_psbdata != NULL);
ASSERT(lpInfo->sImageInfo.bitperpix == 32);
ASSERT(lpInfo->sImageInfo.height > 0);
ASSERT(lpInfo->sImageInfo.width > 0);
ASSERT(lpInfo->annexdata.siAnnData[0]<2); // full image or region
// Initialize the destine image infomation
lpInfo->dImageInfo.height=lpInfo->sImageInfo.height;
lpInfo->dImageInfo.width=lpInfo->sImageInfo.width;
lpInfo->dImageInfo.bitperpix=lpInfo->sImageInfo.bitperpix;
lpInfo->dImageInfo.byteperline=lpInfo->sImageInfo.byteperline;
lpInfo->dImageInfo.bAlpha=lpInfo->sImageInfo.bAlpha;
// Set Modify flag
lpInfo->modify=1;
CFilterDlg m_dFilterDlg;
int nRetCode=m_dFilterDlg.DoModal ();
// static int nRetCode=_fnCOM_Filter(lpInfo);
if(nRetCode==PROCERR_SUCCESS)
{
lpInfo->result=PR_SUCCESS;
return PROCERR_SUCCESS;
}
else
{
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
}
}
int _fnCMD_BOGUS(LPIMAGEPROCSTR lpInfo)
{
// 检验入口参数是否符合接口定义
ASSERT(lpInfo->_psbdata != NULL);
ASSERT(lpInfo->sImageInfo.bitperpix == 32);
ASSERT(lpInfo->sImageInfo.height > 0);
ASSERT(lpInfo->sImageInfo.width > 0);
ASSERT(lpInfo->annexdata.siAnnData[0]<2); // full image or region
// Initialize the destine image infomation
lpInfo->dImageInfo.height=lpInfo->sImageInfo.height;
lpInfo->dImageInfo.width=lpInfo->sImageInfo.width;
lpInfo->dImageInfo.bitperpix=lpInfo->sImageInfo.bitperpix;
lpInfo->dImageInfo.byteperline=lpInfo->sImageInfo.byteperline;
lpInfo->dImageInfo.bAlpha=lpInfo->sImageInfo.bAlpha;
// Set Modify flag
lpInfo->modify=1;
static int nRetCode=_fnCOM_BogusMulticolor(lpInfo);
if(nRetCode==PROCERR_SUCCESS)
{
lpInfo->result=PR_SUCCESS;
return PROCERR_SUCCESS;
}
else
{
Del(lpInfo->_pdbdata );
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
}
}
int _fnCMD_REVERSE(LPIMAGEPROCSTR lpInfo)
{
// 检验入口参数是否符合接口定义
ASSERT(lpInfo->_psbdata != NULL);
ASSERT(lpInfo->sImageInfo.bitperpix == 32);
ASSERT(lpInfo->sImageInfo.height > 0);
ASSERT(lpInfo->sImageInfo.width > 0);
ASSERT(lpInfo->annexdata.siAnnData[0]<2); // full image or region
// Initialize the destine image infomation
lpInfo->dImageInfo.height=lpInfo->sImageInfo.height;
lpInfo->dImageInfo.width=lpInfo->sImageInfo.width;
lpInfo->dImageInfo.bitperpix=lpInfo->sImageInfo.bitperpix;
lpInfo->dImageInfo.byteperline=lpInfo->sImageInfo.byteperline;
lpInfo->dImageInfo.bAlpha=lpInfo->sImageInfo.bAlpha;
// Set Modify flag
lpInfo->modify=1;
static int nRetCode=_fnCOM_Reverse(lpInfo);
if(nRetCode==PROCERR_SUCCESS)
{
lpInfo->result=PR_SUCCESS;
return PROCERR_SUCCESS;
}
else
{
Del(lpInfo->_pdbdata );
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
}
}
// 调用处理函数 — 第二层函数
int _fnCMD_DETECTEDGE(LPIMAGEPROCSTR lpInfo)
{
// 检验入口参数是否符合接口定义
ASSERT(lpInfo->_psbdata != NULL);
ASSERT(lpInfo->sImageInfo.bitperpix == 32);
ASSERT(lpInfo->sImageInfo.height > 0);
ASSERT(lpInfo->sImageInfo.width > 0);
ASSERT(lpInfo->annexdata.siAnnData[0]<2); // full image or region
// Initialize the destine image infomation
lpInfo->dImageInfo.height=lpInfo->sImageInfo.height;
lpInfo->dImageInfo.width=lpInfo->sImageInfo.width;
lpInfo->dImageInfo.bitperpix=lpInfo->sImageInfo.bitperpix;
lpInfo->dImageInfo.byteperline=lpInfo->sImageInfo.byteperline;
lpInfo->dImageInfo.bAlpha=lpInfo->sImageInfo.bAlpha;
// Set Modify flag
lpInfo->modify=1;
CEdgeEnhanceDlg m_dEdgeEnhanceDlg;
int nRetCode=m_dEdgeEnhanceDlg.DoModal ();
if(nRetCode==IDOK)
{
lpInfo->result=PR_SUCCESS;
return PROCERR_SUCCESS;
}
else
{
lpInfo->result=PR_NULL;
return PROCERR_FALSE;
}
}