Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

DrawFPVectorialToCanvas differs from SVG

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

This is a simple test for fpVectorial, I want to compare the output quality of an fpVectorial page to TCanvas vs the same page exported as SVG.

To view the SVG I use Inkscape.

I've found the vector drawings are equal in both, the SVG and the TPaintbox, while the Text is positioned in differente places between them. Can you test it?.

You'll have to create a form with a TButton on it and a TPaintBox.

procedure TForm1.Button1Click(Sender: TObject);
var
  VecDoc: TvVectorialDocument;
  Vec: TvVectorialPage;
begin
  VecDoc := TvVectorialDocument.Create;
  try
    Vec := VecDoc.AddPage();
    // All documents are 10cm x 10cm
    Vec.Width := 100;
    Vec.Height := 100;
    // ...
    // multi_test_1     Combines various elements
    Vec.Clear;
    Vec.StartPath(0, 20);
    Vec.AddLineToPath(30, 30);
    Vec.EndPath();
    Vec.StartPath(0, 0);
    Vec.AddLineToPath(100, 0);
    Vec.AddLineToPath(100, 100);
    Vec.AddLineToPath(0, 100);
    Vec.AddLineToPath(0, 0);
    Vec.EndPath();
    Vec.StartPath(0, 0);
    Vec.AddLineToPath(10, 10);
    Vec.AddBezierToPath(10, 20, 20, 20, 20, 10);
    Vec.AddLineToPath(30, 0);
    Vec.EndPath();
    Vec.AddText(10, 10, 0, '10,10 Some text in english.');
    VecDoc.WriteToFile('multi_test_1.svg', vfSVG);
    DrawFPVectorialToCanvas(Vec, PaintBox1.canvas, 0, PaintBox1.Height - 100, 1, -1);
  finally
    VecDoc.Free;
  end;
end;

Reply by email