MFC制作简易PhotoShop(亮度、饱和度、马赛克调节、两款滤镜、涂鸦、不规则选区以及操作的撤回与重做)

不科学的狼RARMyPhotoShop.rar  56.64MB

资源文件列表:

RAR MyPhotoShop.rar 大约有64个文件
  1. MyPhotoShop\.vs\MyPhotoShop\v15\.suo 7.52KB
  2. MyPhotoShop\.vs\MyPhotoShop\v15\Browse.VC.db 18.2MB
  3. MyPhotoShop\.vs\MyPhotoShop\v15\ipch\AutoPCH\2d91bce048969fc5\TESTVIEW.ipch 3.17MB
  4. MyPhotoShop\.vs\MyPhotoShop\v15\ipch\e896b25802922c2e.ipch 19.44MB
  5. MyPhotoShop\Debug\MyPhotoShop.exe 100.27KB
  6. MyPhotoShop\Debug\MyPhotoShop.ilk 329.42KB
  7. MyPhotoShop\Debug\MyPhotoShop.pdb 448.63KB
  8. MyPhotoShop\icon\15A亮度+.ico 907B
  9. MyPhotoShop\icon\B0548AC28586D69C69D00A067134D73E.ico 32.2KB
  10. MyPhotoShop\icon\masaike.ico 667B
  11. MyPhotoShop\icon\saturation-饱和度 [128x128].ico 1.94KB
  12. MyPhotoShop\icon\撤销.ico 945B
  13. MyPhotoShop\icon\重做 .ico 1.16KB
  14. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.log 478B
  15. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.obj 46.95KB
  16. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.pch 12.8MB
  17. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.res 38.85KB
  18. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\CL.command.1.tlog 446B
  19. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\CL.read.1.tlog 4.35KB
  20. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\CL.write.1.tlog 250B
  21. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\link.command.1.tlog 563B
  22. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\link.read.1.tlog 716B
  23. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\link.write.1.tlog 208B
  24. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\MyPhotoShop.lastbuildstate 281B
  25. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\rc.command.1.tlog 232B
  26. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\rc.read.1.tlog 624B
  27. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog\rc.write.1.tlog 165B
  28. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShopDlg.obj 163.2KB
  29. MyPhotoShop\MyPhotoShop\Debug\myphotoshopdlg.obj.enc 162.78KB
  30. MyPhotoShop\MyPhotoShop\Debug\pch.obj 280.66KB
  31. MyPhotoShop\MyPhotoShop\Debug\vc141.idb 31.06KB
  32. MyPhotoShop\MyPhotoShop\Debug\vc141.pdb 1.28MB
  33. MyPhotoShop\MyPhotoShop\framework.h 746B
  34. MyPhotoShop\MyPhotoShop\MyPhotoShop.aps 48.85KB
  35. MyPhotoShop\MyPhotoShop\MyPhotoShop.cpp 1.56KB
  36. MyPhotoShop\MyPhotoShop\MyPhotoShop.h 386B
  37. MyPhotoShop\MyPhotoShop\MyPhotoShop.rc 3.02KB
  38. MyPhotoShop\MyPhotoShop\MyPhotoShop.vcxproj 1.55KB
  39. MyPhotoShop\MyPhotoShop\MyPhotoShop.vcxproj.filters 809B
  40. MyPhotoShop\MyPhotoShop\MyPhotoShop.vcxproj.user 195B
  41. MyPhotoShop\MyPhotoShop\MyPhotoShopDlg.cpp 8.55KB
  42. MyPhotoShop\MyPhotoShop\MyPhotoShopDlg.h 2.55KB
  43. MyPhotoShop\MyPhotoShop\pch.cpp 158B
  44. MyPhotoShop\MyPhotoShop\pch.h 402B
  45. MyPhotoShop\MyPhotoShop\res\icon1.ico 7.13KB
  46. MyPhotoShop\MyPhotoShop\res\icon2.ico 7.15KB
  47. MyPhotoShop\MyPhotoShop\res\MyPhotoShop.ico 52.95KB
  48. MyPhotoShop\MyPhotoShop\res\MyPhotoShop.rc2 229B
  49. MyPhotoShop\MyPhotoShop\resource.h 731B
  50. MyPhotoShop\MyPhotoShop\targetver.h 252B
  51. MyPhotoShop\MyPhotoShop.sln 500B
  52. MyPhotoShop\.vs\MyPhotoShop\v15\ipch\AutoPCH\2d91bce048969fc5
  53. MyPhotoShop\.vs\MyPhotoShop\v15\ipch\AutoPCH
  54. MyPhotoShop\.vs\MyPhotoShop\v15\ipch
  55. MyPhotoShop\.vs\MyPhotoShop\v15
  56. MyPhotoShop\MyPhotoShop\Debug\MyPhotoShop.tlog
  57. MyPhotoShop\.vs\MyPhotoShop
  58. MyPhotoShop\MyPhotoShop\Debug
  59. MyPhotoShop\MyPhotoShop\res
  60. MyPhotoShop\.vs
  61. MyPhotoShop\Debug
  62. MyPhotoShop\icon
  63. MyPhotoShop\MyPhotoShop
  64. MyPhotoShop

资源介绍:

电信专业大一生程序设计实践大作业,无需进行OpenCV的环境配置,直接使用MFC基于对话框的编程制作简易PhotoShop。内涵亮度、饱和度、马赛克调节、两款滤镜、涂鸦、不规则选区以及操作的撤回与重做等功能。 上传仅供有同样需求的朋友交流学习,本人能力有限,希望多多包涵!

 // MyPhotoShopDlg.cpp: 实现文件 // #include "pch.h" #include "framework.h" #include "MyPhotoShop.h" #include "MyPhotoShopDlg.h" #include "afxdialogex.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // 用于应用程序“关于”菜单项的 CAboutDlg 对话框 CPoint CMyPhotoShopDlg::mainPic2Pic(CPoint point) { CRect mainPicRect; GetDlgItem(MainPic)->GetWindowRect(&mainPicRect); ScreenToClient(&mainPicRect); CRect picRect; picRect = presentOverlay._rect; CPoint newpoint; newpoint.x = point.x - mainPicRect.left + picRect.left; newpoint.y = point.y - mainPicRect.top + picRect.top; return newpoint; } double maxOf(double a, double b) { return a > b ? a : b; } float maxOf(float r, float g, float b) { if (r > g) { return r > b ? r : b; } else { return g > b ? g : b; } } float minOf(float r, float g, float b) { if (r < g xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> CasualDistrict) { CPoint i[2] = {100,100}; char flag = 0; for (const CPoint CPoint : CasualDistrict) { if (y == CPoint.y) { i[flag] = CPoint; flag++; } if (flag == 2)break; } int startX; int endX; if (i[0].x < i xss=removed xss=removed xss=removed xss=removed xss=removed>= 0) { for (int x = startX; x < endX xss=removed xss=removed xss=removed> 255) return 255; else return (BYTE)a; } CPoint CMyPhotoShopDlg::ConvertMousePosToControl(CPoint mousePos) { CRect controlRect; GetDlgItem(MainPic)->GetWindowRect(&controlRect); // 获取MainPic控件的矩形区域 // 将控件矩形区域转换为相对于屏幕的坐标 ScreenToClient(&controlRect); // 计算鼠标位置相对于控件左上角的偏移量 CPoint offset = mousePos - controlRect.TopLeft(); return offset; } //保存picture control控件的图片,参数ID是picture control控件ID号 void CMyPhotoShopDlg::OnPictureSave(UINT ID) { CWnd* bmpShow = GetDlgItem(ID); CDC *pdc = bmpShow->GetDC(); CImage imag; CRect rect; GetClientRect(▭); //获取画布大小 bmpShow->GetWindowRect(▭); imag.Create(rect.Width(), rect.Height(), 32); ::BitBlt(imag.GetDC(), 0, 0, rect.Width(), rect.Height(), pdc->m_hDC, 0, 0, SRCCOPY); TCHAR szFilter[] = _T("jpg file&#40;*.jpg&#41;|*.jpg|bmp file&#40;*.bmp&#41;|*.bmp|所有文件(*.*)|*.*||"); //文件格式过滤 // 构造保存文件对话框 CFileDialog fileDlg(FALSE, _T("jpg"), _T("*.jpg"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this); fileDlg.m_ofn.lpstrTitle = _T(""); //保存图片对话窗口标题名 CString picturePath; if (IDOK == fileDlg.DoModal()) //按下确认键 { picturePath = fileDlg.GetPathName(); //文件路径 } HRESULT hResult = imag.Save(picturePath); //保存图片 ReleaseDC(pdc); imag.ReleaseDC(); } //RGB与HSV互转 HSV RGBtoHSV(RGB rgb) { float R = (float)rgb.R / 255; float G = (float)rgb.G / 255; float B = (float)rgb.B / 255; float Cmax = maxOf(R, G, B); float Cmin = minOf(R, G, B); float delta = Cmax - Cmin; float H = 0, S = 0, V = 0; if (delta != 0) { if (Cmax == R) H = 60 * ((G - B) / delta); else if (Cmax == G) H = 60 * ((B - R) / delta + 2); else if (Cmax == B) H = 60 * ((R - G) / delta + 4); if (H < 0 xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> 1)S = 1; float V = hsv.V; float C = V * S; float X = C * (1 - std::abs(fmod(H / 60, 2) - 1)); float m = V - C; float R, G, B; if (H >= 0 && H < 60 xss=removed xss=removed xss=removed>= 60 && H < 120 xss=removed xss=removed xss=removed>= 120 && H < 180 xss=removed xss=removed xss=removed>= 180 && H < 240 xss=removed xss=removed xss=removed>= 240 && H < 300 xss=removed xss=removed xss=removed>= 300 && H < 360 xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed>LoadIcon(IDR_MAINFRAME); strFileName = _T(""); strFilePath = _T(""); value_brightness = 0; value_intensity = 0; value_mosaic = 0; districtTop = 0; districtBottom = 0; } void CMyPhotoShopDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, MainPic, m_picture); DDX_Control(pDX, Brightness_slider, BrightnessCtrl); DDX_Control(pDX, Intensity_slider, IntensityCtrl); DDX_Control(pDX, Mosaic_slider, MosaicCtrl); DDX_Control(pDX, repealBtn, repealBtnIco); DDX_Control(pDX, reworkBtn, reworkBtnIco); DDX_Control(pDX, BlackPen, BlackP); DDX_Control(pDX, RedPen, RedP); DDX_Control(pDX, GreenPen, GreenP); DDX_Control(pDX, BluePen, BlueP); DDX_Control(pDX, DrawBtn, DrawBtnCtrl); DDX_Control(pDX, Point1_x, Point1_x_show); DDX_Control(pDX, Point1_y, Point1_y_show); DDX_Control(pDX, Point2_x, Point2_x_show); DDX_Control(pDX, Point2_y, Point2_y_show); DDX_Control(pDX, HuaiJiu, huaiJiuCtrl); DDX_Control(pDX, RouHua, rouHuaCtrl); } BEGIN_MESSAGE_MAP(CMyPhotoShopDlg, CDialogEx) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_InputPic, &CMyPhotoShopDlg::OnBnClickedInputpic) ON_NOTIFY(NM_CUSTOMDRAW, Brightness_slider, &CMyPhotoShopDlg::OnNMCustomdrawslider) ON_NOTIFY(NM_CUSTOMDRAW, Intensity_slider, &CMyPhotoShopDlg::OnNMCustomdrawslider2) ON_BN_CLICKED(chooseOverlay, &CMyPhotoShopDlg::OnBnClickedchooseoverlay) ON_NOTIFY(NM_CUSTOMDRAW, Mosaic_slider, &CMyPhotoShopDlg::OnNMCustomdrawslider3) ON_WM_LBUTTONDOWN() ON_BN_CLICKED(DrawSwitch, &CMyPhotoShopDlg::OnBnClickedBlackPen) ON_WM_LBUTTONUP() ON_WM_MOUSEMOVE() ON_BN_CLICKED(repealBtn, &CMyPhotoShopDlg::OnBnClickedrepealbtn) ON_NOTIFY(NM_RELEASEDCAPTURE, Brightness_slider, &CMyPhotoShopDlg::OnNMReleasedBrightness) ON_NOTIFY(NM_RELEASEDCAPTURE, Intensity_slider, &CMyPhotoShopDlg::OnNMReleasedIntensity) ON_NOTIFY(NM_RELEASEDCAPTURE, Mosaic_slider, &CM
100+评论
captcha