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?
See Question&Answers more detail:osI'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?
See Question&Answers more detail:osFast 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.
https://web.archive.org/web/20150330113356/http://bobpowell.net/lockingbits.aspx