All pastes #424351 Raw Edit

Miscellany

public text v1 · immutable
#424351 ·published 2007-04-04 18:54 UTC
rendered paste body
program symbol;
{.include srl/srl.scar}
{.include DoorProfiles.scar}

function GetSymbolBackgroundColor:integer;
var
  TmpBmp,lilbmp,MyX,MyY:integer;
  MyColor,tx,ty: integer;
  MyCanvas:tcanvas;
  TmpBool:boolean;
  MyH,MyS,MyL:extended;
begin
  TmpBmp:= BitmapFromString(100,90,'');
  lilbmp:=bitmapfromstring(2,2,' ');
  MyCanvas:=GetBitmapCanvas(TmpBmp)

  CopyCanvas(GetClientCanvas,MyCanvas,598,39,698,129,0,0,100,90)
  for MyY:=0 to 99 do
  begin
   for MyX:=0 to 89 do
    begin
      MyColor:= MyCanvas.pixels[MyX,MyY];
      ColortoHSL(MyColor,MyH,MyS,MyL);
      if MyS  <40.0 then
      begin
        if MyL > 65.0 then
        begin
          if MyH<60.0 then
          begin
            if MyL<100.0then
            begin
              if MyH>0.0 then
              begin
                FastDrawClear(lilbmp,MyColor);
                if FindBitmapIn(lilbmp,tx,ty,mmx1,mmy1,mmx2,mmy2) then
                  TmpBool:=true;
              end;
            end;
          end;
        end;
      end;
      if TmpBool then break;
    end;
    if TmpBool then break;
  end;
if TmpBool then result:=MyColor;
end;
Var DebugCanvas,BmpCanvas:TCanvas;
procedure AddArray (WhichTPA:array of tpoint; WhichColor:integer);
var parray, arraylength:integer;
begin
  arraylength:=getarraylength(whichtpa);
  for parray:=0 to arraylength-1 do
    bmpcanvas.pixels[whichtpa[parray].x-576+5,whichtpa[parray].y-9+5]:=WhichColor;
  Copycanvas(BmpCanvas,DebugCanvas,0,0,150,157,5,5,155,162)
end;


procedure StartMiniMapDebug;
Var bmpBlankMap:integer;
begin {
  bmpBlankMap:= LoadBitmap(apppath+'test.bmp');
  DisplayDebugImgWindow(160,167) //to show the canvas
  DebugCanvas:=getdebugcanvas //gets the referance to the debug image and stores in that varaible
  BmpCanvas:=GetBitmapCanvas(bmpBlankMap)//gets the regerance to the bmp and stores in that variable
  BlankMapCanvas:=GetBitmapCanvas(bmpBlankMap);
  Copycanvas(BmpCanvas,DebugCanvas,0,0,150,157,5,5,155,162)
  FreeBitmap(bmpBlankMap);

   }
  bmpBlankMap:= LoadBitmap(apppath+'test.bmp');
DisplayDebugImgWindow(160,167) //to show the canvas
DebugCanvas:=getdebugcanvas //gets the referance to the debug image and stores in that varaible
BmpCanvas:=GetBitmapCanvas(bmpBlankMap)//gets the regerance to the bmp and stores in that variable
Copycanvas(BmpCanvas,DebugCanvas,0,0,150,157,5,5,155,162)

end;


var SymbolBackgroundColor,t,f:integer;
tmpTPA1: array of tpoint;
tmpAOTPA: array of array of tpoint;
begin
setupsrl;
t:=getsystemtime;
SymbolBackgroundColor:=GetSymbolBackgroundColor;
writeln(inttostr(SymbolBackgroundColor));
if SymbolBackgroundColor=0 then writeln('there are no symbols on the minimap');
writeln(inttostr(getsystemtime-t)+'ms');

if SymbolBackgroundColor<>0 then
begin
tmpTPA1:=GetPixelsD(SymbolBackgroundColor,mmx1,mmy1,mmx2,mmy2,0);
tmpAOTPA:=SplitTPA(tmpTPA1);


StartMiniMapDebug;
 for f:= 0 to getarraylength(tmpAOTPA)-1 do
begin

//cleardebug;
writeln('press f12');
repeat
wait(30);
until isfkeydown(12);
//StartMiniMapDebug;
//writeln(tPtArrayToStr(myAOTPA[f]));

writeln('press f11');
repeat
wait(30);
until isfkeydown(11);


AddArray(tmpAOTPA[f],16777215);


end;
end;

end.