AutoHotkey Community

It is currently May 27th, 2012, 6:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 11th, 2004, 12:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
This small subroutine might be useful to someone. It retrieves the number of pixels in a region that match a certain color:
Code:
GPC_Color = 0x3444b0
GPC_X1 = 100
GPC_X2 = 150
GPC_Y1 = 100
GPC_Y2 = 150
Gosub GetPixelCount
if PixelCount > 7
{
...
}
return

GetPixelCount:
PixelCount = 0
GPC_X = %GPC_X1%
Loop
{
   if GPC_X > %GPC_X2%
      break
   GPC_Y = %GPC_Y1%
   Loop
   {
      if GPC_Y > %GPC_Y2%
         break
      PixelGetColor, GPC_ColorTemp, %GPC_X%, %GPC_Y%
      if GPC_ColorTemp = %GPC_Color%
         ++PixelCount
      ++GPC_Y
   }
   ++GPC_X
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks!
PostPosted: March 3rd, 2008, 3:21 pm 
Offline

Joined: March 3rd, 2008, 2:48 pm
Posts: 12
Location: Inside your mind.
Is there any way to get a complete list of hex colors of a specified region?
i.e. I am looking to differentiate between a certain shade of red and blue, but red is not the majority color (and thus there are many many colors to try when i use your subroutine)

Thanks!

Um... if you could take a look at the topic labeled

Image Search Fails to recognize screenshot if trigger (game)
http://www.autohotkey.com/forum/viewtopic.php?t=29258

Would be much appreciated. An expert could tell me what im doing wrong in a few secs im sure.

_________________
ImageImage
ImageImage


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group