From 74eeab6c39869844e65e7c63a4e094e669636431 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 12 Mar 2012 01:55:10 +0200 Subject: aggpas: signature of Line() method changed. * Some parameters are now declared as const * Added a new AFixAlignment parameter. This is used when drawing vertical or horizontal lines, where the anti-aliasing doesn't give desired "visual" results. The AGG documentation explains the behaviour in great detail. --- src/corelib/render/software/Agg2D.pas | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 19b9009b..17faf904 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -427,7 +427,7 @@ type function InBox(worldX ,worldY : double ) : boolean; // Basic Shapes - procedure Line (x1 ,y1 ,x2 ,y2 : double ); + procedure Line(const x1, y1, x2, y2: double; AFixAlignment: boolean = false ); procedure Triangle (const x1 ,y1 ,x2 ,y2 ,x3 ,y3 : double ); procedure Rectangle(const x1 ,y1 ,x2 ,y2 : double ); @@ -2268,13 +2268,25 @@ begin end; { LINE } -procedure TAgg2D.Line(x1 ,y1 ,x2 ,y2 : double ); +procedure TAgg2D.Line(const x1, y1, x2, y2: double; AFixAlignment: boolean = false); +var + lx1, ly1, lx2, ly2: double; begin m_path.remove_all; - addLine (x1 ,y1 ,x2 ,y2 ); - DrawPath(AGG_StrokeOnly ); + lx1 := x1; + ly1 := y1; + lx2 := x2; + ly2 := y2; + + if AFixAlignment then + begin + AlignPoint(@lx1, @ly1); + AlignPoint(@lx2, @ly2); + end; + addLine(lx1, ly1, lx2, ly2); + DrawPath(AGG_StrokeOnly ); end; { TRIANGLE } -- cgit v1.2.3-70-g09d2