All pastes #708588 Raw Edit

Something

public text v1 · immutable
#708588 ·published 2007-09-23 23:36 UTC
rendered paste body
function FindAllBitmapsIn(TheBmp,startx,starty,endx,endy:integer):array of tpoint;
var tmpbool:boolean;
AL:integer;
curx,cury,tmpx,tmpy,height:integer;
begin
  tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,starty,endx,endy);
  if tmpbool then
  begin
    curx:=startx;
    cury:=starty;
    /////auto height finder///////
    tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,starty,endx,endy);
    height:=0;
    repeat
      height:=height+1;
      tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,tmpy,endx,tmpy+height);
    until tmpbool;
    //writeln('height '+inttostr(height));
    ///////////
    repeat
      tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,curx,cury,endx,cury+height);
      if tmpbool then
      begin
        curx:=tmpx+1;
        AL:=getarraylength(result);
        setarraylength(result,AL+1);
        result[AL].x:=tmpx;
        result[AL].y:=tmpy;
      end;
      if not tmpbool then
      begin
        curx:=startx;
        cury:=cury+1;
      end;
    until cury=endy+1;
  end;
end;