Advertisement
WarPie90

rowp - illustration

Dec 22nd, 2022 (edited)
1,421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.73 KB | None | 0 0
  1. program new;
  2. {$I SRL/osr.simba}
  3. //HACK TO WORK: Start it once, stop the script, use simba to target the debug image that showed up, start the script..
  4.  
  5.  
  6. var
  7.   BMP: TMufasaBitmap;
  8.   x: Int32;
  9.   P: TPoint;
  10.   rect: TRectangle;
  11.   M: TSingleMatrix;
  12.   n: Double;
  13.   TPA: TPointArray;
  14.   mouses: TPointArray;
  15.   h,s,l: Extended;
  16.   pts: TPointArray;
  17. begin
  18.   SRL_GAUSS_CUTOFF := 5.5;
  19.  
  20.   BMP := GetMufasaBitmap(CreateBitmap(500, 500));
  21.   BMP.Debug();
  22.   M.SetSize(500,500);
  23.  
  24.   rect := Box(Random(190, 200), Random(190, 200), Random(250, 350), Random(250, 350)).ToRectangle.Rotate(Radians(Random(360)));
  25.   pts := [[Random(100, 400),Random(100, 400)],[Random(100, 400),Random(100, 400)],[Random(100, 400),Random(100, 400)],[Random(100, 400),Random(100, 400)]];
  26.  
  27.   repeat
  28.     BMP.DrawRect(rect, clOrange);
  29.     for x:=1 to 3 do
  30.     begin
  31.       if x <> 3 then
  32.         P := pts[x]
  33.       else
  34.         P := Mouse.Position();
  35.  
  36.       mouses.append(p);
  37.       for 0 to 10000 do
  38.         with srl.rowp(P, rect) do
  39.         begin
  40.           M[Y,X] += 1;
  41.           M[Y+1,X] += 1;
  42.           M[Y-1,X] += 1;
  43.           M[Y,X-1] += 1;
  44.           M[Y,X+1] += 1;
  45.           TPA.Append(Point(X,Y));
  46.         end;
  47.     end;
  48.  
  49.     n := M.Max();
  50.  
  51.     for p in TPA do
  52.     begin
  53.       //H := Min(30, 180 - M[p.Y,p.X] / n * 180);
  54.       //S := 100;
  55.       //L := 60*min(1,h/5);
  56.       //BMP.SetPixel(p.x, p.y, HSLToColor(H,S,L));
  57.  
  58.       BMP.SetPixel(p.X, p.Y, HSLToColor(90 - M[p.Y,p.X] / n * 90, 100, 60));
  59.     end;
  60.  
  61.     for p in mouses do
  62.       BMP.DrawCircleFilled(P, 5, False, clRed);
  63.  
  64.     DrawBitmapDebugImg(bmp.getIndex());
  65.     BMP.Clear();
  66.     TPA := [];
  67.     mouses := [];
  68.     M.Fill(TBox([0,0,490,490]), 0);
  69.   until False;
  70.  
  71.  
  72.  
  73.   BMP.Free();
  74. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement