I am trying to make a color SVG file using fpVectorial. Using this link as a start :
https://wiki.lazarus.freepascal.org/fpvectorialI have looked at fpVectorial.pas located here :
https://github.com/fpc/Lazarus/blob/main/components/fpvectorial/fpvectorial.pasI want to do simple colors. I have tried changing the pen and brush, but those do not seem to work. I am likely doing something wrong.
This is the code I was trying to modify and add some color ( I left out my modifications, they did not work) :
{
Author: Felipe Monteiro de Carvalho
License: Public Domain
}
program fpvwritetest;
{$mode objfpc}{$H+}
uses
fpvectorial, svgvectorialwriter;
const
cFormat = vfSVG;
cExtension = '.svg';
var
VecDoc: TvVectorialDocument;
Vec: TvVectorialPage;
s : String;
begin
VecDoc := TvVectorialDocument.Create;
try
// All documents are 10cm x 10cm
VecDoc.Width := 100;
VecDoc.Height := 100;
Vec := VecDoc.AddPage();
Vec.Width := VecDoc.Width;
Vec.Height := VecDoc.Height;
// ...
// 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.');
s := '20, 20 Mówić, cześć, Włosku, Parabéns.';
Vec.AddText(20, 20, 0, s);
s := '30, 30 森林,是一个高密';
Vec.AddText(30, 30, 0, s);
VecDoc.WriteToFile('multi_test_1' + cExtension, cFormat);
finally
VecDoc.Free;
end;
end.
Does anybody have an example of how to change the pen color in fpVectorial ?
or would I be better off trying out BGRABitmap for programmatically making SVG's ?
https://bgrabitmap.github.io/ I could find no other documentation on fpVectorial.
Thank you.