raven-gm
Joined: 25 Mar 2007 Posts: 24
|
Posted: Sun May 13, 2007 5:23 pm Post subject: |
|
|
Sure; use PixelSearch instead. Whenever you get a White pixel, call a subroutine (or a function) that checks all the pixels around it to see if they're black.
| Code: |
CheckForBlackAround(PxlX,PxlY)
{
X1 := PxlX - 1,Y1 := PxlY - 1 ; Start the search one pixel above and to the left of the passed pixel
X2 := PxlX + 1,Y2 := PxlY + 1 ; End it one pixel below and one pixel to the right of the passed pixel
PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, 0x000000
if errorlevel = 1
Return true ; the color was not found
if errorlevel = 0
return false ; the color was found
if errorlevel = 2
Msgbox There was an error conducting the search
Return
}
|
Here's an (untested) function that takes a pixel, and checks to see if the area around it (Including it, so don't pass it black pixels!) has any black pixels in it.
To do what you want, you'd want to do a PixelSearch for white pixels, then run this test on them.
If it fails the test, do another pixelsearch without including that pixel (like the rest of that column, then all the other pixels to the right of that column), then call the funciton again.
Although, because there are a lot of white pixels around (most of the time, anyways, but from what it sounds like, you need this for a game...), you might want to use the [fast] option of PixelSearch.[/code] _________________ I would like to think that I know what I'm doing, but there's just to much stuff I've yet to learn... |
|