Results 1 to 18 of 18

Thread: My plugin - FindMultiColorsTolerance

  1. #1
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default My plugin - FindMultiColorsTolerance

    I was bored, so I thought: Why not create a nice little plugin?

    So here I present:
    function FindMultiColorsTolerance(var Points : T2dPointArray; colors : TIntegerArray; xs, ys, xe, ye : integer; tolerances : TIntegerArray; dc : longword) : boolean;

    WTF will this do? Eat my cookies???!?!?!
    It'll search for multiple colors in one function, saving some time compared to multiple findcolorstolerance, as this reduces some overhead with multiple colors. That will make this faster then just a few old plain FindColorsTolerance

    So, tell me exactly why I should use this
    Ok. If you mess with TPAA's much, you know that FindColorsTolerance takes a while, as you need to run it for every color you want to look for. So everytime it'll create a new bitmap, loop through all pixels etc etc.
    This, creates one bitmap, loops one time through the pixels, and then compares if the pixel matches any of the colors.

    Wow, sounds nice, but how can I use it?
    Let's go through all parameters.
    var Points : T2dPointArray; - This is the functions output. Each color gets its own TPA.
    Example: You are looking for three colors, color 1, 2 and 3.
    color 1 is found at 12, 34. color 2 is found at 1,1 2,2 and 5,5 and color 3 isn't found
    The array would then look like this:

    Points[0][0] = 12, 34
    Points[1][0] = 1,1
    Points[1][1] = 2, 2
    Points[1][2] = 5, 5
    Points[2] = empty


    colors : TIntegerArray - Here you enter the colors: example: [123456, 1236, 122]
    xs, ys, xe, ye : integer; - You should know about these
    tolerances : TIntegerArray; - Here you enter the tolerances. Each color must have it's own tol, duplicate tols are allowed. Example: [0, 0, 56]
    dc : longword - If you are really leet, enter the dc here. If not: getclientcanvas.handle

    Credits
    Freddy1990, it's based on his FindColorTolerance source
    I made a new script, check it out!.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you done it again, still need to find out what!
    ~Hermen

  3. #3
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Lol, thanks
    I made a new script, check it out!.

  4. #4
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Amazing work! Keep it up!
    -stijn.
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  5. #5
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice!
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  6. #6
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    I though it was a HDC? Never would have though.


    Nice job though, but I think you should refine the way it stores the points...
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  7. #7
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by R0b0t1 View Post
    Nice job though, but I think you should refine the way it stores the points...

    Like one big TPA for all colors?
    I made a new script, check it out!.

  8. #8
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  9. #9
    Join Date
    Sep 2007
    Location
    England
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very Handy

  10. #10
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    I could use this later thx markus.

    ->{Nauman}<-

  11. #11
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice, well done! Keep up the good work.

    ~Raymond
    Verrekte Koekwous

  12. #12
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Yes, you can read my mind Markus. Use a TPointArray instead of the T2DIntArray.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  13. #13
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by R0b0t1 View Post
    Yes, you can read my mind Markus. Use a TPointArray instead of the T2DIntArray.
    Well it's actually a T2dPointArray
    But ok, it's five mins of work. How should I call it? FindMultiTpaColorsTolerance?
    I made a new script, check it out!.

  14. #14
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Keep it as a T2DPointArray so that you know what points are for which colors?
    The truth finally came out...


  15. #15
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Quote Originally Posted by mat_de_b View Post
    Keep it as a T2DPointArray so that you know what points are for which colors?
    That's what I currently got
    I made a new script, check it out!.

  16. #16
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Nice i like it!

  17. #17
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    10-12-2007, 03:05 PM

    @Markus: Very good

  18. #18
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Hehe gravedig.

    Few things:
    1. This doesnt work correctly if the X and Y corner aren't 0
    2. Tolerance is a bit broken
    I made a new script, check it out!.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opinions about a plugin I'm considering
    By Grippy in forum News and General
    Replies: 12
    Last Post: 03-05-2009, 08:33 PM
  2. Wizzy Plugin
    By Drew_Dawg in forum OSR Help
    Replies: 10
    Last Post: 02-24-2008, 04:14 PM
  3. Wizzy plugin bug
    By chrisn2323 in forum News and General
    Replies: 0
    Last Post: 01-23-2008, 04:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •