From 03152a241b9463c582b56896f5f5f73717497ab4 Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 수, 25 8월 2021 11:20:43 +0900
Subject: [PATCH] Ongoing100 #3486 CF AOI Review Review History 프로그램 테스트 및 적용

---
 ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp |   70 +++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp b/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp
index 81b16e1..20870db 100644
--- a/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp
+++ b/ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp
@@ -279,7 +279,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 �겕湲곕줈 �솕硫댁뿉 異쒕젰�븳�떎.
@@ -1968,6 +1976,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 +2066,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 +2107,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 +2509,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();
 
@@ -2527,6 +2549,48 @@
 	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()
 {
 	// TODO:  RICHEDIT 而⑦듃濡ㅼ씤 寃쎌슦, �씠 而⑦듃濡ㅼ�

--
Gitblit v1.9.3