| 1746 | } |
| 1747 | |
| 1748 | void CColorCopDlg::OnMouseMove(UINT nFlags, CPoint point) { |
| 1749 | CString strStatus; |
| 1750 | |
| 1751 | // |
| 1752 | // Handle capture for eyedropper or magnifier |
| 1753 | // |
| 1754 | if (m_isEyedropping || m_isMagnifying) { |
| 1755 | if (::GetCapture() == nullptr) { |
| 1756 | SetCapture(); |
| 1757 | } else { |
| 1758 | ClientToScreen(&point); // convert to screen coordinates |
| 1759 | } |
| 1760 | } |
| 1761 | |
| 1762 | // |
| 1763 | // Eyedropper mode |
| 1764 | // |
| 1765 | if (m_isEyedropping) { |
| 1766 | bool skipColor = false; |
| 1767 | |
| 1768 | if (m_InitialMove) { |
| 1769 | AdvanceColorHistory(); |
| 1770 | m_InitialMove = FALSE; |
| 1771 | } |
| 1772 | |
| 1773 | WindowDC hdc(nullptr); // RAII DC |
| 1774 | |
| 1775 | if (m_Appflags & Sampling1) { |
| 1776 | const COLORREF crefxy = ::GetPixel(hdc, point.x, point.y); |
| 1777 | |
| 1778 | if (crefxy != CLR_INVALID) { |
| 1779 | const COLORREF current = RGB(m_Reddec, m_Greendec, m_Bluedec); |
| 1780 | |
| 1781 | if (current != crefxy) { |
| 1782 | m_Reddec = GetRValue(crefxy); |
| 1783 | m_Greendec = GetGValue(crefxy); |
| 1784 | m_Bluedec = GetBValue(crefxy); |
| 1785 | |
| 1786 | UpdateCMYKFromRGB(m_Reddec, m_Greendec, m_Bluedec); |
| 1787 | } else { |
| 1788 | skipColor = true; |
| 1789 | } |
| 1790 | } |
| 1791 | } else { |
| 1792 | // 3×3, 5×5, or multi‑pixel sampling |
| 1793 | skipColor = AveragePixelArea(hdc, &m_Reddec, &m_Greendec, &m_Bluedec, point); |
| 1794 | UpdateCMYKFromRGB(m_Reddec, m_Greendec, m_Bluedec); |
| 1795 | } |
| 1796 | |
| 1797 | // |
| 1798 | // Relative‑position mode |
| 1799 | // |
| 1800 | if (bRelativePosition) { |
| 1801 | RelativePointEnd = point; |
| 1802 | |
| 1803 | int dx = point.x - RelativePoint.x; |
| 1804 | int dy = point.y - RelativePoint.y; |
| 1805 |
nothing calls this directly
no outgoing calls
no test coverage detected