TestRawViewer_8Bit/TestRawViewGraph.cpp
2021-05-21 20:12:29 +09:00

215 lines
4.7 KiB
C++

// TestRawViewGraph.cpp : implementation file
//
#include "stdafx.h"
#include "TestRawViewer.h"
#include "TestRawViewGraph.h"
#include "TestRawViewerDlg.h"
// CTestRawViewGraph dialog
IMPLEMENT_DYNAMIC(CTestRawViewGraph, CDialog)
CTestRawViewGraph::CTestRawViewGraph(CWnd* pParent /*=NULL*/)
: CDialog(CTestRawViewGraph::IDD, pParent)
{
// CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd();
mistandardWidth = 65535;
mistandardWidth = 3072;
// mistandardWidth = 255;
// mistandardWidth = ((CTestRawViewerDlg * )pParent)->miMAX;
mistandardHeight = 94371;
}
CTestRawViewGraph::~CTestRawViewGraph()
{
}
void CTestRawViewGraph::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CTestRawViewGraph, CDialog)
ON_WM_PAINT()
ON_BN_CLICKED(IDC_BUTTON1, &CTestRawViewGraph::OnBnClickedButton1)
END_MESSAGE_MAP()
// CTestRawViewGraph message handlers
BOOL CTestRawViewGraph::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
::SetWindowPos(GetSafeHwnd(),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
// Hide Application in TaskBar ------------------------
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
ufDrawGraph();
return 0;
}
BOOL CTestRawViewGraph::ufDrawGraph()
{
COLORREF bColor;
bColor = RGB(0, 0, 0);
CRect r;
CRect rect1;
int wIx, wiXPoint,wiYPoint, X;
this->GetClientRect(&r);
CClientDC dc(this);
CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd();
mdScreenMappingRateWidth = (double)r.right / (double)mistandardWidth;
mdScreenMappingRateHeight = (double)r.bottom / (double)mistandardHeight;
// for(wIx = 100; wIx <= 65535; wIx++)
for(wIx = 100; wIx <= 110; wIx++)
{
wiXPoint = (int)((double)wIx * mdScreenMappingRateWidth);
wiYPoint = (int)((double)pBaseWnd->mpImageValue[wIx] * mdScreenMappingRateHeight);
// if(wiYPoint > 0) dc.SetPixel(wiXPoint, wiYPoint,bColor);
// dc.SetPixel(wiXPoint, wiYPoint,bColor);
dc.SetPixel(wiXPoint, 100,bColor);
}
// dc.SetPixel(100, 100,bColor);
// dc.SetPixel(101, 100,bColor);
// dc.SetPixel(102, 100,bColor);
return TRUE; // return TRUE unless you set the focus to a control
}
void CTestRawViewGraph::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
ufDrawGraph();
}
void CTestRawViewGraph::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd();
this->Invalidate();
int wiCNTArea1 = 0;
int wiCNTArea2 = 0;
int wiCNTArea3 = 0;
int wIx;
CString wsSTR;
for(wIx = 0; wIx <= 65535; wIx++)
{
/*
if(pBaseWnd->miImageValue[wIx] > 40000)
{
wiCNTArea1 = wiCNTArea1 + pBaseWnd->miImageValue[wIx];
}
else
{
wiCNTArea2 = wiCNTArea2 + pBaseWnd->miImageValue[wIx];
}
*/
if(wIx > 40000)
{
wiCNTArea1 = wiCNTArea1 + pBaseWnd->mpImageValue[wIx];
}
else
{
wiCNTArea2 = wiCNTArea2 + pBaseWnd->mpImageValue[wIx];
}
}
/*
wsSTR.Format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
,pBaseWnd->miImageValue[0]
,pBaseWnd->miImageValue[1]
,pBaseWnd->miImageValue[2]
,pBaseWnd->miImageValue[3]
,pBaseWnd->miImageValue[4]
,pBaseWnd->miImageValue[5]
,pBaseWnd->miImageValue[6]
,pBaseWnd->miImageValue[7]
,pBaseWnd->miImageValue[8]
,pBaseWnd->miImageValue[9]
,pBaseWnd->miImageValue[10]
,pBaseWnd->miImageValue[11]
,pBaseWnd->miImageValue[12]
,pBaseWnd->miImageValue[13]
,pBaseWnd->miImageValue[14]
);
AfxMessageBox(wsSTR);
wsSTR.Format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
,pBaseWnd->miSumValue[0]
,pBaseWnd->miSumValue[1]
,pBaseWnd->miSumValue[2]
,pBaseWnd->miSumValue[3]
,pBaseWnd->miSumValue[4]
,pBaseWnd->miSumValue[5]
,pBaseWnd->miSumValue[6]
,pBaseWnd->miSumValue[7]
,pBaseWnd->miSumValue[8]
,pBaseWnd->miSumValue[9]
,pBaseWnd->miSumValue[10]
,pBaseWnd->miSumValue[11]
,pBaseWnd->miSumValue[12]
,pBaseWnd->miSumValue[13]
,pBaseWnd->miSumValue[14]
);
*/
// wsSTR.Format("wiCNTArea1 = %d, wiCNTArea2 = %d", wiCNTArea1, wiCNTArea2);
AfxMessageBox(wsSTR);
}