Results 1 to 8 of 8

Thread: CountColorTolerance

  1. #1
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default CountColorTolerance

    Does CountColorTolerance use CTS 1 or 2? I would like to use this function to shorten up my code rather than making a TPA and getting the length of the TPA. That would save so many lines.

    "Simba is completely open sourced blah blah blah" Then why can't I look at the code for half the functions I use?

  2. #2
    Join Date
    Feb 2012
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    CountColorTolerance can use any tolerance speed, as any color function can do

    simply call SetColorToleranceSpeed before the color finding

    edit: u can look at the source for the functions u use?
    Last edited by Velvet Glam; 07-03-2012 at 10:00 PM.

  3. #3
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    It isnt in the srl include so idk on how to answer that :O

  4. #4
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  5. #5
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    I know what it does man. I need to know what CTS it uses.

  6. #6
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    I know what it does man. I need to know what CTS it uses.
    It uses whatever CTS you've set. CTS is independent of color-finding (unless it's a function with CTS built-in, of course; but most aren't). You can view the source code here:

    https://github.com/MerlijnWajer/Simba

    Go to Units -> MMLCore to find most of the common built-in Simba functions.

  7. #7
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Simba Code:
    function TMFinder.CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;
    var
       PtrData: TRetData;
       Ptr: PRGB32;
       PtrInc: Integer;
       dX, dY, xx, yy: Integer;

      compare: TCTSCompareFunction;
      ctsinfo: TCTSInfo;
    begin
      Result := 0;
      DefaultOperations(xs, ys, xe, ye);

      dX := xe - xs;
      dY := ye - ys;

      PtrData := TClient(Client).IOManager.ReturnData(xs, ys, dX + 1, dY + 1);
      Ptr := PtrData.Ptr;
      PtrInc := PtrData.IncPtrWith;
      result := 0;

      ctsinfo := Create_CTSInfo(Color, Tolerance);
      compare := Get_CTSCompare(Self.CTS);

      for yy := ys to ye do
      begin;
        for xx := xs to xe do
        begin
          if compare(ctsinfo, Ptr) then
            inc(result);
          Inc(Ptr);
        end;
        Inc(Ptr, PtrInc)
      end;

      Free_CTSInfo(ctsinfo);
      TClient(Client).IOManager.FreeReturnData;
    end;

    Uses the global CTS aka the current CTS before the function was called.
    I am Ggzz..
    Hackintosher

  8. #8
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default




    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

Thread Information

Users Browsing this Thread

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

Posting Permissions

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