From b9b6752e83c701cc67241923d2b74dc3a963d243 Mon Sep 17 00:00:00 2001 From: LYW <leeyeanwoo@diteam.co.kr> Date: 월, 27 9월 2021 13:13:23 +0900 Subject: [PATCH] Ongoing100 #3486 CF AOI Review Review History 프로그램 테스트 및 적용 --- ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp | 83 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 78 insertions(+), 5 deletions(-) diff --git a/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp b/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp index 81b16e1..b607bc7 100644 --- a/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp +++ b/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp @@ -121,6 +121,7 @@ ON_BN_CLICKED(IDC_CHK_REVIEW_DEFECT, &CReveiwHistoryDlg::OnClickedChkReviewDefect) ON_BN_CLICKED(IDC_CHK_SINGLE, &CReveiwHistoryDlg::OnClickedChkSingle) ON_EN_CHANGE(IDC_EDIT_FILE_COUNT, &CReveiwHistoryDlg::OnChangeEditFileCount) + ON_WM_KEYDOWN() END_MESSAGE_MAP() // CReveiwHistoryDlg 硫붿떆吏� 泥섎━湲� @@ -279,7 +280,15 @@ // // 洹몃┝�쓣 Picture Control �겕湲곕줈 �솕硫댁뿉 異쒕젰�븳�떎. // m_ReviewImage.Draw(dc, m_picture_rect); // } - if (!m_DefectImage.IsNull()) + //LYW 20210825 #3486 ADD START + if (!m_DefectRotateImage.IsNull()) + { + dc.SetStretchBltMode(COLORONCOLOR); + // 洹몃┝�쓣 Picture Control �겕湲곕줈 �솕硫댁뿉 異쒕젰�븳�떎. + m_DefectRotateImage.Draw(dc, m_picture_rect2); + } + //LYW 20210825 #3486 ADD END + else if (!m_DefectImage.IsNull()) { dc.SetStretchBltMode(COLORONCOLOR); // 洹몃┝�쓣 Picture Control �겕湲곕줈 �솕硫댁뿉 異쒕젰�븳�떎. @@ -730,7 +739,7 @@ return TRUE; } - else if (NM_CLICK == pDispInfo->hdr.code) + else if (NM_CLICK == pDispInfo->hdr.code || LVN_ITEMCHANGING == pDispInfo->hdr.code) { if (pDispInfo->item.row == 0) { @@ -856,7 +865,7 @@ return TRUE; } - else if (NM_CLICK == pDispInfo->hdr.code) + else if (NM_CLICK == pDispInfo->hdr.code || LVN_ITEMCHANGING == pDispInfo->hdr.code) { if (pDispInfo->item.row == 0) { @@ -1968,6 +1977,9 @@ m_DefectImage.Destroy(); m_ReviewImage.Destroy(); + //LYW 20210825 #3486 ADD START + m_DefectRotateImage.Destroy(); + //LYW 20210825 #3486 ADD END m_AlignFirst.Destroy(); m_AlignSecend.Destroy(); @@ -2055,7 +2067,7 @@ DeftectPath.Format(_T("%s\\%s\\%s"), strReviewPath, strReviewImagePath, strReviewImageName); //DeftectPath2.Format(_T("%s\\%s"), strInspectorPath, strInspectorName); if (strInspectorName == "*" || strInspectorName == "**" || strInspectorName == "***") strInspectorName = ""; - DeftectPath2.Format(_T("%s\\%s\\%s"), strInspectorPath, pImageInfo->m_strGlassID, strReviewImageName); + DeftectPath2.Format(_T("%s\\%s\\%s"), strInspectorPath, pImageInfo->m_strGlassID, strInspectorName); AlignPath.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName); AlignPath2.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName2); @@ -2096,13 +2108,21 @@ if (CFile::GetStatus(DeftectPath2, FileOn) && strInspectorName != "") //�뙆�씪�씠 �엳�쓣 �븣 { m_DefectImage.Load(DeftectPath2); + //LYW 20210825 #3486 ADD START + m_DefectRotateImage.Create(m_DefectImage.GetWidth(), m_DefectImage.GetHeight(), m_DefectImage.GetBPP(), 0); + ImageRotate(m_DefectImage, m_DefectRotateImage); + //LYW 20210825 #3486 ADD END HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), DeftectPath2, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); InvalidateRect(m_picture_rect2, FALSE); dc.SetStretchBltMode(COLORONCOLOR); - m_DefectImage.Draw(dc, m_picture_rect2); + //LYW 20210825 #3486 MOD START + m_DefectRotateImage.Draw(dc, m_picture_rect2); + //LYW 20210825 #3486 MOD END + //original + //m_DefectImage.Draw(dc, m_picture_rect2); } else { @@ -2490,6 +2510,9 @@ // m_ReviewImage.Destroy(); m_DefectImage.Destroy(); + //LYW 20210825 #3486 ADD START + m_DefectRotateImage.Destroy(); + //LYW 20210825 #3486 ADD END m_AlignFirst.Destroy(); m_AlignSecend.Destroy(); @@ -2526,6 +2549,48 @@ m_AlignFirst.Draw(dc, m_Align_rect); m_AlignSecend.Draw(dc, m_Align_rect2); } + +//LYW 20210825 #3486 ADD START +void CReveiwHistoryDlg::ImageRotate(CImage & SrcImage, CImage & DstImage, double degree/* = 180.0 */) +{ + int Height = SrcImage.GetHeight(); // �꽭濡� 湲몄씠 ���옣 + int Width = SrcImage.GetWidth(); // 媛�濡� 湲몄씠 ���옣 + int new_x, new_y; + int R, G, B; + int center_x = (SrcImage.GetWidth() / 2); // �쉶�쟾 以묒떖�젏 + int center_y = (SrcImage.GetHeight() / 2); // �쉶�쟾 以묒떖�젏 + + double seta = 3.14 / (180.0 / degree); // �씪�뵒�븞 + double CosSeta = cos(seta); + double SinSeta = sin(seta); + + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + new_x = (int)((x - center_x) * CosSeta - (y - center_y) * SinSeta + center_x); + new_y = (int)((x - center_x) * SinSeta + (y - center_y) * CosSeta + center_y); + + if ((new_x < 0) || (new_x > Width) || (new_y < 0) || (new_y > Height)) + //�씠誘몄� 踰붿쐞瑜� 踰쀬뼱�굹硫� 0 媛� + { + R = 0; + G = 0; + B = 0; + } + else + { + R = GetRValue(SrcImage.GetPixel(new_x, new_y)); + G = GetGValue(SrcImage.GetPixel(new_x, new_y)); + B = GetBValue(SrcImage.GetPixel(new_x, new_y)); + } + DstImage.SetPixel((int)x, (int)y, RGB(R, G, B)); + new_x = 0; new_y = 0; + } + } + +} +//LYW 20210825 #3486 ADD END void CReveiwHistoryDlg::OnChangeEditFileCount() { @@ -3764,3 +3829,11 @@ } m_Formation.m_vecHeaderTemp.clear(); } + + +void CReveiwHistoryDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + // TODO: �뿬湲곗뿉 硫붿떆吏� 泥섎━湲� 肄붾뱶瑜� 異붽� 諛�/�삉�뒗 湲곕낯媛믪쓣 �샇異쒗빀�땲�떎. + + CDialogEx::OnKeyDown(nChar, nRepCnt, nFlags); +} -- Gitblit v1.9.3