fxDash.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. unit fxDash;
  2. interface
  3. uses
  4. System.SysUtils,
  5. System.Types,
  6. System.UITypes,
  7. System.Classes,
  8. System.Variants,
  9. GR32,
  10. GR32_Polygons,
  11. FMX.Types,
  12. FMX.Controls,
  13. FMX.Forms,
  14. FMX.Graphics, FMX.Dialogs,
  15. FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.Layouts;
  16. type
  17. TFormDash = class(TForm)
  18. Image1: TImage;
  19. TrackBar1: TTrackBar;
  20. DashChk: TCheckBox;
  21. ToolBar1: TToolBar;
  22. Panel1: TLayout;
  23. Button1: TButton;
  24. procedure TrackBar1Change(Sender: TObject);
  25. private
  26. { Private declarations }
  27. public
  28. { Public declarations }
  29. end;
  30. var
  31. FormDash: TFormDash;
  32. implementation
  33. {$R *.fmx}
  34. procedure TFormDash.TrackBar1Change(Sender: TObject);
  35. var b32: TBitmap32;
  36. Points: TArrayOfFloatPoint;
  37. Dashes: TArrayOfFloat;
  38. d: Single;
  39. begin
  40. b32 := TBitmap32.Create;
  41. b32.SetSize(350, 350);
  42. SetLength(Points, 10);
  43. Points[0] := FloatPoint(128.57142 * 2, 155.21932 * 2);
  44. Points[1] := FloatPoint(82.877695 * 2, 135.39077 * 2);
  45. Points[2] := FloatPoint(37.202937 * 2, 155.26298 * 2);
  46. Points[3] := FloatPoint(41.940878 * 2, 105.6783 * 2);
  47. Points[4] := FloatPoint(8.9270057 * 2, 68.379869 * 2);
  48. Points[5] := FloatPoint(57.548943 * 2, 57.563411 * 2);
  49. Points[6] := FloatPoint(82.820007 * 2, 14.639505 * 2);
  50. Points[7] := FloatPoint(108.13208 * 2, 57.539246 * 2);
  51. Points[8] := FloatPoint(156.76432 * 2, 68.309239 * 2);
  52. Points[9] := FloatPoint(123.78611 * 2, 105.6392 * 2);
  53. if DashChk.IsChecked then
  54. begin
  55. SetLength(Dashes, 3);
  56. d := TrackBar1.Value;
  57. Dashes[0] := d;
  58. Dashes[1] := d;
  59. Dashes[2] := d;
  60. DashLineFS(b32, Points, Dashes, Color32(clRed32), True, TrackBar1.Value);
  61. end
  62. else PolyPolylineFS(b32, [Points], Color32(clRed32), True, TrackBar1.Value, TJoinStyle.jsRound, TEndStyle.esButt);
  63. Image1.Bitmap.Assign(b32);
  64. b32.Free;
  65. end;
  66. end.