You may want to use the latest (beta) version 2.0 of GR32 as it introduced a vector engine. With this you can continue to use your existing code and add vector graphic drawn on top of the pixel image you already have.
To do so first switch to the latest GR32 version. The code can be obtained from the open SVN repository. The trunk can be found here:
https://sourceforge.net/p/graphics32/code/HEAD/tree/trunk/
If you use SVN (recommended) you can check out the code using
svn checkout svn://svn.code.sf.net/p/graphics32/code/trunk graphics32-code
or use TortoiseSVN for explorer integration.
Once you have the code you can start exploration. There are many examples which show you how to use the vector engine. Just look at the examples under Examples\Drawing.
In particular have a look at the 'Polygons' example where you can create (and manipulate) polygons with the mouse (three clicks are required to create a simple triangle).
To create a vector graphic on your own you can use code like this:
uses
..., GR32_Polygons, GR32_Paths, GR32_Brushes;
var
Canvas: TCanvas32;
Stroke: TStrokeBrush;
begin
// use a higher level abstraction class to generate the polygons
Canvas := TCanvas32.Create(Image.Bitmap);
// add a stroke brush and specify the color and width
Canvas.Brushes.Add(TStrokeBrush);
Stroke := TStrokeBrush(Canvas.Brushes[0]);
Stroke.FillColor := SetAlpha(clBlack32, 200);
Stroke.StrokeWidth := 2;
// begin a path
Canvas.Path.BeginPath;
// specify 3 vertices
Canvas.Path.MoveTo(10, 10);
Canvas.Path.LineTo(20, 90);
Canvas.Path.LineTo(60, 40);
// close path
Canvas.Path.ClosePath;
Canvas.Path.EndPath;
end;
Additionally you can use the low level API. For this you only need the unit 'GR32_Polygons'. The same code would then look like this:
uses
..., GR32_Polygons;
var
Points: array of TFloatPoint;
begin
SetLength(Points, 3);
// specify 3 vertices
Points[0] := FloatPoint(10, 10);
Points[1] := FloatPoint(20, 90);
Points[2] := FloatPoint(60, 40);
// draw poylgon with certain color and width
PolylineFS(Image.Bitmap, Points, SetAlpha(clBlack32, 200), True, 2.0);
end;
While this looks simpler in the first place it gets slightly more difficult the more complex your drawings with the vector engine get.
To get rid of entering each vertex separately you can use auxiliary functions from the GR32_VectorUtils unit. It includes
Rectangle(const R: TFloatRect): TArrayOfFloatPoint;
which should be the most useful for your application.
If you want you can also add transformations that are applied before the polygon is drawn.
The same example could also be written entirely using the AggPas code. It's neither faster nor more elegant, but just different.