如何得到某一点的象素值?

knightxie 2003-09-11 05:55:33
如何得到某一点的象素值?通过GetPixel可以吗?
请详细说明。
谢谢!
...全文
25 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Freshyy 2003-09-18
  • 打赏
  • 举报
回复
看你在什么场合了!
如果整个处理整个场景,GetPixel() is very very slowly!

如果真是这样,应该研究DIB,在内存中获取。
kyanitelj 2003-09-18
  • 打赏
  • 举报
回复
CPoint point;
GetCursorPos(&point);//get cursor pos
HDC hDC = ::GetDC(NULL);//lock paint DC

COLORREF colorref = ::GetPixel(hDC, point.x, point.y);//get the cursor color
GetRValue(colorref);//store red color
GetGValue(colorref);//store green color
GetBValue(colorref);//store blue color

::ReleaseDC(NULL, hDC);//unlock DC
thisisjjjj 2003-09-11
  • 打赏
  • 举报
回复
我说的是SDK下哈
MFC的不清楚
只晓得格式好象是
COLOREF GetPixel(int x,int y);
thisisjjjj 2003-09-11
  • 打赏
  • 举报
回复
在WM_PAINT消息里
使用GetPixel(hdc, X, Y);返回值是坐标为(X,Y)点的RGB值

就晓得这么多,献丑啦:)

shines77 2003-09-11
  • 打赏
  • 举报
回复
GetPixel() 太慢了,如果只是几个像素还可以忍受,多的话,还是研究一下DIB(即Bitmap)吧
alamb 2003-09-11
  • 打赏
  • 举报
回复
都知道了还问
knightxie 2003-09-11
  • 打赏
  • 举报
回复
请说详细点
最好有源代码
Oversense 2003-09-11
  • 打赏
  • 举报
回复
yes

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧