Results 1 to 8 of 8

Thread: GetColor

  1. #1
    Join Date
    Apr 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default GetColor

    Currently I have a script where I want to know whether a pixel at a specific coordinate is black. I used GetColor but it is really slow. Any suggestions on how to determine if a spot is black or not?

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Shouldn't GetColor be pretty much instantaneous? Post your code, it's probably something else slowing it down.

  3. #3
    Join Date
    Apr 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    program new;
    {$i SRL\SRL.simba}

    var
    Arr : TPointArray;

    ScreenX, ScreenY : Integer;


    Procedure FindScreen;
    var
    corner: Integer;

    begin
    corner := BitmapFromString(10, 5, 'meJwzd/BihAE3Tz9zJC4EvH926/q' +
    'No5cv7/S0tsyuKgayIQgoDpSFsIGyO3fOF5KQX7Kk5/TpdRCELAvk' +
    'AqXkpKQrOqomTultnlQMl4UrAIprqqpALAUAlEBG8w==');

    FindBitmapToleranceIn (corner, ScreenX, ScreenY, 0, 0, 1919, 1057, 10);

    FreeBitmap (corner);

    ScreenY := ScreenY + 12;
    ScreenX := ScreenX + 13;

    end;

    Procedure ScanBoard;
    var
    x, i, m, color: Integer;
    begin


    for i := 0 to 30 do
    begin
    for x := 0 to 22 do
    begin
    MoveMouse (ScreenX+18*x, ScreenY+18*i)
    // Wait(100);

    color := GetColor (ScreenX+18*x, ScreenY+18*i);

    // if(color = 0) then
    // Writeln ('black')

    end;
    end;

    end;

    begin
    SetupSRL;
    ClearDebug;

    FindScreen;
    ScanBoard;

    end.
    Last edited by Evil Chicken; 04-24-2013 at 08:42 PM.

  4. #4
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    you don't free bitmap "color"?
    Code:
    color := BitmapFromString(1, 1, 'meJxjYGAAAAADAAE=');

  5. #5
    Join Date
    Apr 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    you don't free bitmap "color"?
    Color isn't a bitmap

  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Your looping through it over 600 times... thats why it's so slow


    Simba Code:
    for i := 0 to 30 do
      begin
        for x := 0 to 22 do

  7. #7
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    Quote Originally Posted by Evil Chicken View Post
    Color isn't a bitmap
    you removed it

  8. #8
    Join Date
    Apr 2012
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Your looping through it over 600 times... thats why it's so slow
    Nice CutOut.png

    I need to scan this as a grid into an Array. I only want to know where the empty blocks are. Is there any other faster way to scan this?

    you removed it
    Yeah I know. That wasn't suppose to be there in the first place

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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