Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ImageView.cpp
Upload User: aqingfeng
Upload Date: 2014-03-25
Package Size: 1839k
Code Size: 2k
Category:
Wavelet
Development Platform:
Visual C++
- // ImageView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "小波变换.h"
- #include "ImageView.h"
- #include "小波变换Doc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CImageView
- IMPLEMENT_DYNCREATE(CImageView, CView)
- CImageView::CImageView()
- {
- }
- CImageView::~CImageView()
- {
- }
- BEGIN_MESSAGE_MAP(CImageView, CView)
- //{{AFX_MSG_MAP(CImageView)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CImageView drawing
- void CImageView::OnDraw(CDC* pDC)
- {
- // TODO: add draw code here
- CMyDoc* pDoc = GetDocument();
- unsigned char* pBitmap = pDoc -> m_pBitmap;
- LPBITMAPINFO lpBitmapInfo = (LPBITMAPINFO)(pBitmap+14);
- unsigned char* pBitmapData = pBitmap+((LPBITMAPFILEHEADER)pBitmap)->bfOffBits;
- unsigned long biHeight = ((LPBITMAPINFOHEADER)lpBitmapInfo)->biHeight;
- unsigned long biWidth = ((LPBITMAPINFOHEADER)lpBitmapInfo)->biWidth;
- CRect rect;
- GetClientRect(&rect);
- long originx =0;
- long originy =0;
- if((unsigned long)(rect.Width()) > biWidth)
- originx = (rect.Width() - biWidth)>>1;
- if((unsigned long)(rect.Height()) > biHeight)
- originy = (rect.Height() - biHeight)>>1;
- SetDIBitsToDevice(pDC->m_hDC, originx, originy, biWidth, biHeight, 0, 0, 0, biHeight, pBitmapData,
- lpBitmapInfo, DIB_RGB_COLORS);//把DIB的部分区域或整张图画在DC中,originx和originy是目的地的左上角坐标
- //biWidth和biHeight是欲显示的矩形区域的宽度和高度,欲显示的矩形区域的左上角的起点是(0,0),第一条扫描线的起点是0,pBitmapData是DIB阵列
- //的指针,lpBitmapInfo是DIB信息的指针,DIB_RGB_COLORS是使用的颜色方式
- }
- /////////////////////////////////////////////////////////////////////////////
- // CImageView diagnostics
- #ifdef _DEBUG
- void CImageView::AssertValid() const
- {
- CView::AssertValid();
- }
- void CImageView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CMyDoc* CImageView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
- return (CMyDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CImageView message handlers
- BOOL CImageView::PreCreateWindow(CREATESTRUCT& cs)
- {
- cs.cy = cs.cx =0;
- return CView::PreCreateWindow(cs);
- }