summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2012-03-16 00:07:56 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-03-16 00:07:56 +0200
commit64d5026bc7576efaa3c8fd81b30ead5cc9c4ad50 (patch)
tree888fce36d5af8996b4254aef5b12aa7e69f4502f
parentae3bb81ae91ee412ee8199edce5e452b502d2519 (diff)
downloadfpGUI-64d5026bc7576efaa3c8fd81b30ead5cc9c4ad50.tar.xz
agg: TAgg2D.Rectangle() now has a new parameter for pixel alignment control
-rw-r--r--src/corelib/render/software/Agg2D.pas26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas
index e7257776..1d21bbb8 100644
--- a/src/corelib/render/software/Agg2D.pas
+++ b/src/corelib/render/software/Agg2D.pas
@@ -420,7 +420,7 @@ type
// Basic Shapes
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 );
+ procedure Rectangle(const x1 ,y1 ,x2 ,y2 : double; AFixAlignment: boolean = false);
procedure RoundedRect(const x1 ,y1 ,x2 ,y2 ,r : double ); overload;
procedure RoundedRect(const x1 ,y1 ,x2 ,y2 ,rx ,ry : double ); overload;
@@ -2309,13 +2309,27 @@ begin
end;
{ RECTANGLE }
-procedure TAgg2D.Rectangle(const x1 ,y1 ,x2 ,y2 : double );
+procedure TAgg2D.Rectangle(const x1 ,y1 ,x2 ,y2 : double; AFixAlignment: boolean);
+var
+ lx1, ly1, lx2, ly2: double;
begin
m_path.remove_all;
- m_path.move_to(x1 ,y1 );
- m_path.line_to(x2 ,y1 );
- m_path.line_to(x2 ,y2 );
- m_path.line_to(x1 ,y2 );
+
+ lx1 := x1;
+ ly1 := y1;
+ lx2 := x2;
+ ly2 := y2;
+
+ if AFixAlignment then
+ begin
+ AlignPoint(@lx1, @ly1);
+ AlignPoint(@lx2, @ly2);
+ end;
+
+ m_path.move_to(lx1 ,ly1 );
+ m_path.line_to(lx2 ,ly1 );
+ m_path.line_to(lx2 ,ly2 );
+ m_path.line_to(lx1 ,ly2 );
m_path.close_polygon;
DrawPath(AGG_FillAndStroke );