fpvwritetest.pas 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {
  2. FPVectorial example application for writing vectorial images
  3. generated in code to disk. This program will generate the following
  4. vectorial images:
  5. single_line_1 One line from (0, 20) to (30, 30)
  6. single_line_2 One line from (20, 30) to (30, 20)
  7. polyline_1 One line from (0, 0) to (10, 10) to (20, 30) to (30, 20)
  8. polyline_2 One line from (10, 10) to (20, 30) to (30, 20) to (40, 40)
  9. bezier_1 One path starting in (0, 0) lining to (10, 10) then bezier to (20, 10) and then line to (30, 0)
  10. bezier_2 One curve from (10, 10) to (20, 20)
  11. text_ascii One text written at (10, 10)
  12. text_europen One text testing european languages at (20, 20)
  13. text_asian One text testing asian languages at (30, 30)
  14. Author: Felipe Monteiro de Carvalho
  15. License: Public Domain
  16. }
  17. program fpvwritetest;
  18. {$mode objfpc}{$H+}
  19. uses
  20. fpvectorial, svgvectorialwriter;
  21. const
  22. cFormat = vfSVG;
  23. cExtension = '.svg';
  24. var
  25. Vec: TvVectorialDocument;
  26. begin
  27. Vec := TvVectorialDocument.Create;
  28. try
  29. // single_line_1 One line from (0, 20) to (30, 30)
  30. Vec.StartPath(0, 20);
  31. Vec.AddLineToPath(30, 30);
  32. Vec.EndPath();
  33. Vec.WriteToFile('single_line_1' + cExtension, cFormat);
  34. // single_line_2 One line from (20, 30) to (30, 20)
  35. Vec.Clear;
  36. Vec.StartPath(20, 30);
  37. Vec.AddLineToPath(30, 20);
  38. Vec.EndPath();
  39. Vec.WriteToFile('single_line_2' + cExtension, cFormat);
  40. // polyline_1 One line from (0, 0) to (10, 10) to (20, 30) to (30, 20)
  41. Vec.Clear;
  42. Vec.StartPath(0, 0);
  43. Vec.AddLineToPath(10, 10);
  44. Vec.AddLineToPath(20, 30);
  45. Vec.AddLineToPath(30, 20);
  46. Vec.EndPath();
  47. Vec.WriteToFile('polyline_1' + cExtension, cFormat);
  48. // polyline_2 One line from (10, 10) to (20, 30) to (30, 20) to (40, 40)
  49. Vec.Clear;
  50. Vec.StartPath(10, 10);
  51. Vec.AddLineToPath(20, 30);
  52. Vec.AddLineToPath(30, 20);
  53. Vec.AddLineToPath(40, 40);
  54. Vec.EndPath();
  55. Vec.WriteToFile('polyline_2' + cExtension, cFormat);
  56. // bezier_1 One path starting in (0, 0) lining to (10, 10) then bezier to (20, 10) and then line to (30, 0)
  57. // bezier_2 One curve from (10, 10) to (20, 20)
  58. // text_ascii One text written at (10, 10)
  59. // text_europen One text testing european languages at (20, 20)
  60. // text_asian One text testing asian languages at (30, 30)
  61. finally
  62. Vec.Free;
  63. end;
  64. end.