Results 1 to 3 of 3

Thread: FindBitmapInCircle?

  1. #1
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindBitmapInCircle?

    Sorry for asking again, I've got a way to get the Road Color, and it works right now, but it would work.... a little better if i had a function like FindBitmapInCircle or something where it only searched for the bitmap in the circle instead of a quadrilater.

    Sorry for all the questions, I've got limited time on the computer right now (Football in state playoffs n such), so the little time i have away from school, church (more time consuming than you'd expect), sports, family, and friends, i'd prefer to be scripting instead of researching code to make it.

    FindBitmapInCircle(Bitmap, x, y, Centerx, centery, radius:integer):boolean

    Any and all help is appreciated.

  2. #2
    Join Date
    Feb 2006
    Posts
    406
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i cant believe freddy didnt write a plugin or something to do this :P
    oh well, here you go
    it should work, i dunno

    Code:
    function FindBitmapInCircleTol(bitmap:integer; var x, y: Integer; Centerx, Centery, Radius, Tol:integer): Boolean;
    var
      Temp: TCanvas;
      Cx, Cy, H, W, ScreenBmp, TempBmp, Handle: Integer;
    begin
      W := 2*Radius;
      H := 2*Radius;
      Handle := GetClientWindowHandle;
      TempBmp := BitmapFromString(W, H, '');
      Temp := GetBitmapCanvas(TempBmp);
      ScreenBmp := BitmapFromString(W, H, '');
      FastDrawClear(TempBmp, -1);
      CopyClientToBitmap(ScreenBmp, CenterX-Radius, CenterY-Radius, CenterX+Radius, CenterY+Radius);
      CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
      Temp.Ellipse(0, 0, W, H);
      CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
      SetTransparentColor(TempBmp, 16777215);
      FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
      SetTargetBitmap(ScreenBmp);
      X := -1;
      Y := -1;
      Cx := W div 2;
      Cy := H div 2;
      if FindBitmapSpiralTolerance(Bitmap, Cx, Cy, 0, 0, W, H, Tol) then
      begin
        X := Cx+CenterX-Radius;
        Y := Cy+CenterY-Radius;
        Result := true;
      end;
      SetClientWindowHandle(Handle);
      FreeBitmap(TempBmp);
      FreeBitmap(ScreenBmp);
    end;

  3. #3
    Join Date
    Oct 2006
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a bunch <3

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
  •