⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ippsdemo.cpp

📁 Intel开发的IPP库的应用例程
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*
//
//               INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright(c) 1999-2007 Intel Corporation. All Rights Reserved.
//
*/

// ippsDemo.cpp : Defines the class behaviors for the ippsDemo application.
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ippsDemo.h"

#include "MainFrm.h"
#include "ippsDemoDoc.h"
#include "ippsDemoDocMgr.h"
#include "ChildFrm.h"
#include "TextFrm.h"
#include "CharFrm.h"
#include "ippsDemoView.h"
#include "ippsTextView.h"
#include "ippsCharView.h"

#include "ippsDirector.h"

#include "NewSignal.h"
#include "NewTaps.h"
#include "NewChar.h"

#include "ColorDlg.h"
#include "DragDrop.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
//
// CippsDemoApp: application class for IPP Signal Processing Demo
//
/////////////////////////////////////////////////////////////////////////////



BEGIN_MESSAGE_MAP(CippsDemoApp, CDemoApp)
   //{{AFX_MSG_MAP(CippsDemoApp)
   ON_COMMAND(ID_FILE_NEW, OnFileNew)
   ON_COMMAND(ID_FILE_NEW_SIGNAL, OnFileNewSignal)
   ON_COMMAND(ID_FILE_NEW_TAPS, OnFileNewTaps)
   ON_COMMAND(ID_FILE_NEW_CHAR, OnFileNewChar)
   ON_UPDATE_COMMAND_UI(ID_VIEW_XAXIS, OnUpdateViewXaxis)
   ON_UPDATE_COMMAND_UI(ID_VIEW_YAXIS, OnUpdateViewYaxis)
   ON_COMMAND(ID_VIEW_XAXIS, OnViewXaxis)
   ON_COMMAND(ID_VIEW_YAXIS, OnViewYaxis)
   ON_UPDATE_COMMAND_UI(ID_ZOOM_ALL, OnUpdateZoomAll)
   ON_COMMAND(ID_ZOOM_ALL, OnZoomAll)
   ON_UPDATE_COMMAND_UI(ID_VIEW_GRID, OnUpdateViewGrid)
   ON_COMMAND(ID_VIEW_GRID, OnViewGrid)
   ON_COMMAND(ID_OPT_COLOR, OnOptColor)
   //}}AFX_MSG_MAP
   // Standard file based document commands
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CippsDemoApp construction

CippsDemoApp::CippsDemoApp() : CDemoApp()
{
   m_pNewSignal = new CNewSignal;
   m_pNewTaps = new CNewTaps;
   m_pNewChar = new CNewChar;
   m_NewIsEmpty = FALSE;
   m_NewView = VIEW_DEMO;
   m_NewType = ppNONE;
   m_NewLength = 0;
   m_XAxis = TRUE;
   m_YAxis = TRUE;
   m_Grid = FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CippsDemoApp object

CippsDemoApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CDemoApp virtual function overrides

//----------------------------------------------------------------------------
// GetDemoTitle returns the name of the Demo that will be set to the title
// of application and application message boxes
//----------------------------------------------------------------------------
CString CippsDemoApp::GetDemoTitle() const { return "ippSP";}

//----------------------------------------------------------------------------
// GetLibTitle returns the name of IPP Library with the specified index
//----------------------------------------------------------------------------
CString CippsDemoApp::GetLibTitle(int idx) const
{
   switch (idx) {
   case LIB_SP: return "ippSP";
   case LIB_CH: return "ippCH";
   default: return "";
   }
}

//----------------------------------------------------------------------------
// GetLibPrefix returns the prefix in function names of IPP Library 
// with the specified index
//----------------------------------------------------------------------------
CString CippsDemoApp::GetLibPrefix(int idx) const
{
   switch (idx) {
   case LIB_SP: return "ipps";
   case LIB_CH: return "ippch";
   default: return "";
   }
}

//----------------------------------------------------------------------------
// GetLibVersion returns the version of IPP library with the specified index 
//----------------------------------------------------------------------------
const IppLibraryVersion* CippsDemoApp::GetLibVersion(int idx) const
{ 
   switch (idx) {
   case LIB_SP:
#if LIB_SP < LIB_NUM
      return CALL(ippsGetLibVersion,());
#endif
      break;
   case LIB_CH:
#if LIB_CH < LIB_NUM
      return CH_CALL(ippchGetLibVersion,());
#endif
      break;
   }
   return NULL;
}

static CString CustomName(int i)
{
   CString name;
   name.Format("CustomColor%d", i);
   return name;
}

//----------------------------------------------------------------------------
// LoadProfileSettings is called by CDemoApp::InitInstance.
// It loads application settings
//----------------------------------------------------------------------------
void CippsDemoApp::LoadProfileSettings()
{
   CDemoApp::LoadProfileSettings();
   /*
   CippsDemoView::SetColorSignal    (
      GetProfileInt("View","ClrGraph",  
      CippsDemoView::GetColorSignal()));
   CippsDemoView::SetColorSignalBack(
      GetProfileInt("View","ClrGraphBk",
      CippsDemoView::GetColorSignalBack()));
   CippsDemoView::SetColorAxis      (
      GetProfileInt("View","ClrAxis",   
      CippsDemoView::GetColorAxis()));
   CippsDemoView::SetColorAxisBack  (
      GetProfileInt("View","ClrAxisBk", 
      CippsDemoView::GetColorAxisBack()));

   for (int i=0; i<16; i++)
      CColorDlg::SetCustomColor(i, 
         GetProfileInt("View", CustomName(i), 
         CColorDlg::GetCustomColor(i)));
         */
} 

//----------------------------------------------------------------------------
// SaveProfileSettings is called by CDemoApp::InitInstance.
// It saves application settings
//----------------------------------------------------------------------------
void CippsDemoApp::SaveProfileSettings()
{
   CDemoApp::SaveProfileSettings();

   WriteProfileInt("View","ClrGraph",  CippsDemoView::GetColorSignal    ());
   WriteProfileInt("View","ClrGraphBk",CippsDemoView::GetColorSignalBack());
   WriteProfileInt("View","ClrAxis",   CippsDemoView::GetColorAxis      ());
   WriteProfileInt("View","ClrAxisBk", CippsDemoView::GetColorAxisBack  ());

   for (int i=0; i<16; i++)
      WriteProfileInt("View", CustomName(i),
         CColorDlg::GetCustomColor(i));
}

//----------------------------------------------------------------------------
// CreateDirector creates new CDirector class that can process any document 
// by any proper IPP function
//----------------------------------------------------------------------------
CDirector* CippsDemoApp::CreateDirector() const
{
   return new CippsDirector;
}

//----------------------------------------------------------------------------
// CreateDocTemplates creates document templates
//----------------------------------------------------------------------------
void CippsDemoApp::CreateDocTemplates()
{
   m_pDocManager = new CippsDemoDocMgr;
   CMultiDocTemplate* pDocTemplate;
   pDocTemplate = new CMultiDocTemplate(
      IDR_IPPSTYPE,
      RUNTIME_CLASS(CippsDemoDoc),
      RUNTIME_CLASS(CChildFrame),
      RUNTIME_CLASS(CippsDemoView));
   AddDocTemplate(pDocTemplate);

   pDocTemplate = new CMultiDocTemplate(
      IDR_IPPSTEXT,
      RUNTIME_CLASS(CippsDemoDoc),
      RUNTIME_CLASS(CTextFrame), 
      RUNTIME_CLASS(CippsTextView));
   AddDocTemplate(pDocTemplate);

   pDocTemplate = new CMultiDocTemplate(
      IDR_IPPSCHAR,
      RUNTIME_CLASS(CippsDemoDoc),
      RUNTIME_CLASS(CCharFrame), 
      RUNTIME_CLASS(CippsCharView));
   AddDocTemplate(pDocTemplate);

}

/////////////////////////////////////////////////////////////////////////////
// Doc Managing & Creation 

//----------------------------------------------------------------------------
// GetDemoTemplate returns template for document that will be shown in 
// graphic view at its first appearance
//----------------------------------------------------------------------------
CDocTemplate* CippsDemoApp::GetDemoTemplate()
{
   POSITION pos = GetFirstDocTemplatePosition( );
   return GetNextDocTemplate(pos);
}

//----------------------------------------------------------------------------
// GetTextTemplate returns template for document that will be shown in 
// digital view at its first appearance
//----------------------------------------------------------------------------
CDocTemplate* CippsDemoApp::GetTextTemplate()
{
   POSITION pos = GetFirstDocTemplatePosition( );
   GetNextDocTemplate(pos);
   return GetNextDocTemplate(pos);
}

//----------------------------------------------------------------------------
// GetCharTemplate returns template for document that will be shown in 
// character view at its first appearance
//----------------------------------------------------------------------------
CDocTemplate* CippsDemoApp::GetCharTemplate()
{
   POSITION pos = GetFirstDocTemplatePosition( );
   GetNextDocTemplate(pos);
   GetNextDocTemplate(pos);
   return GetNextDocTemplate(pos);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -