[Lazarus] DrawFPVectorialToCanvas differs from SVG

Leonardo M. Ramé l.rame at griensu.com
Tue Nov 29 23:06:18 CET 2011


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;

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list