public bool GetPixelViewImage(Point pt, out Color color) { #region 通过物理坐标获取图像像素数据 bool ret = false; color = Color.FromArgb(100, 100, 100); if (m_bmp != null) { if (_lockbmp == null) { _lockbmp = new clsPointBitmap(m_bmp); _lockbmp.lockBits(); m_bLock = true; } else if (!m_bLock) { _lockbmp.lockBits(); m_bLock = true; } //PointBitmap _lockbmp = new PointBitmap(m_bmp); //_lockbmp.LockBits(); pt = LpToVp(pt); if (pt.X >= 0 && pt.Y >= 0 && pt.X < _lockbmp.Width && pt.Y < _lockbmp.Height) { color = _lockbmp.getPixel(pt.X, pt.Y); ret = true; } //_lockbmp.UnlockBits(); } return(ret); #endregion }
public bool GetPixelLiveImage(Point pt, out Color color) { #region 通过像素坐标获取图像像素数据 bool ret = false; color = Color.FromArgb(100, 100, 100); if (m_bmp != null) { clsPointBitmap _lockbmp = new clsPointBitmap(m_bmp); _lockbmp.lockBits(); if (pt.X < _lockbmp.Width && pt.Y < _lockbmp.Height) { color = _lockbmp.getPixel(pt.X, pt.Y); ret = true; } _lockbmp.unlockBits(); } return(ret); #endregion }