-
GetPixel Question
Hi, :wave:
Have been lurking on this forum for about a year now, but up until now every question I have had has been answered by previous posts (rather well as I may add :thumb: ). My question is this: -
Is it possible to use GetPixel on an image still in memory? What I am trying to do is scan the picture for a red pixel and then load the image into a picture box at the coordinates of the pixel. (In this case it's text surrounded by a red checked box)
At the moment I am loading a bitmap into a StdPicture, but for GetPixel to work you need the hWnd for it, so my next thought would be to use iPicture instead as it does have a handle, but again fails due to iPicture using Himetrics. The other option is the GetDC functions, but I don't really know how to use it or if it can be manipulated to do it.
Any help is appreciated, even it's tp say that it can't be done!
Many Thanks
Xcelsior
Machina improba! Vel mihi ede potum vel mihi redde nummos meos!
-
Re: GetPixel Question
Have you considered the GetDIBits() API function? Much faster. There's an example of using it in the Image Comparison link in my signature.
Once the pixels are dumped into a byte array you can just check the byte values.
Sorry, I'm not sure how to use GetPixel on an StdPicture object. It has been done before, because I've seen it on www.pscode.com/vb but I'm not much of a GDI programmer.
-
Re: GetPixel Question
I recommend you to visit Http://www.mvps.org/EDais/ and downlod the small ebook on 'Basic introduction to
Graphics programming in VB' . A very good one. Might be helpfull in your case.