我在.NET应用程序中使用与getPixel()
从GDI32.DLL到屏幕上的任意位置取样像素的颜色。它的工作原理确定,但它是我的一个主要性能瓶颈。
I'm using GetPixel()
from gdi32.dll in a .NET app to sample the colour of a pixel anywhere on the screen. It works ok but it is a major performance bottleneck for me.
有没有做这件事的一个更快的方法?
Is there a faster way of doing it?
快速访问像素可以使用 LockBits()
的方法的位图
。这将包含一个指向的对象返回到你的像素数据的开始,你可以使用不安全code来访问内存。
Fast access to pixels are possible using LockBits()
method of the Bitmap
. This will return to you an object containing a pointer to the start of the pixel data and you can use unsafe code to access the memory.
http://www.bobpowell.net/lockingbits.htm
上一篇:有没有办法在C#来检测Windows关机/注销和取消操作(询问用户后)没有办法、操作、用户、Windows
下一篇:需要:一个Windows服务执行作业从作业队列中的一个数据库;求购:例如code作业、队列、数据库、Windows