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

📄 childview.h

📁 BCAM 1394 Driver
💻 H
字号:
//-----------------------------------------------------------------------------
//  (c) 2002 by Basler Vision Technologies
//  Section:  Vision Components
//  Project:  BCAM
//  $Header: ChildView.h, 3, 19.09.2002 15:32:51, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
  \file     ChildView.h
  \brief    interface of the CChildView class
*/

#pragma once

#include <BvcDib.h>
#include <BvcColorConverter.h>
using namespace Bvc;

const CColorConverter::PatternOrigin_t BAYER_HOME = CColorConverter::poGB;

//! Displays the bitmap 
class CChildView : public CWnd
{
  // Construction
public:
  //! Default constructor
  CChildView();
  
  // Attributes
public:
  //! The bitmap to be shown
  CDibPtr m_ptrBitmap;
  
  // Operations
public:
  
  // Overrides
  //{{AFX_VIRTUAL(CChildView)
protected:
  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  //}}AFX_VIRTUAL
  
  // Implementation
public:
  //! Destructor
  virtual ~CChildView();
  
  //! Sets this bitmap to be displayed and refreshes the display
  void SetBitmap(CDibPtr &ptrNewBitmap, bool isColor = false)
  {
    // If old and new bitmap anre NULL
    if(!m_ptrBitmap && !ptrNewBitmap)
      return;
    
    // If new bitmap is NULL
    if((bool)m_ptrBitmap && !ptrNewBitmap)
    {
      //SetScrollOffset(0, 0, FALSE);
      //SetScrollSize(CSize(1,1));
    }
    // If new bitmap has another size than the old one...
    else if( !m_ptrBitmap && (bool)ptrNewBitmap 
      || m_ptrBitmap->GetSize() != ptrNewBitmap->GetSize() )
    {
      //SetScrollOffset(0, 0, FALSE);
      //SetScrollSize(ptrNewBitmap->GetSize());
    }
    
    if(isColor)
    {
      // Convert the image from Bayer to RGB
      CColorConverter::ConvertMono8ToRGB(m_ptrBitmap,ptrNewBitmap,BAYER_HOME);
    }
    else
    {
      // Stores the bitmap directly 
      m_ptrBitmap = ptrNewBitmap;
    }
    
    // Invalidates the view causing a WM_PAINT message 
    Invalidate();
  }
  
  //! Releases any bitmap which is hold by the view
  void ReleaseBitmap()
  {
    m_ptrBitmap.Release();
    //SetScrollOffset(0, 0, FALSE);
    //SetScrollSize(CSize(1,1));
    
    // Invalidates the view causing a WM_PAINT message 
    Invalidate();
  }
  
  // Generated message map functions
protected:
  //{{AFX_MSG(CChildView)
  
  //! Paints the bitmap
  afx_msg void OnPaint();
  
  //! Erases the background aroung the bitmap
  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  
  //! Called if the window is activated
  afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
  
  //}}AFX_MSG
  DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}

⌨️ 快捷键说明

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