summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx4
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx18
2 files changed, 22 insertions, 0 deletions
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index 47ff41b75e70..cba5a4920ca2 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
@@ -274,6 +274,10 @@ namespace basegfx
*/
B2DPolygon createPolygonFromRect( const B2DRectangle& rRect );
+ /** Create the unit polygon
+ */
+ B2DPolygon createUnitPolygon();
+
/** Create a circle polygon with given radius.
This method creates a circle approximation consisting of
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index d62462b8c097..dcdaad4b5e37 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -1837,6 +1837,24 @@ namespace basegfx
return aRetval;
}
+ B2DPolygon createUnitPolygon()
+ {
+ static B2DPolygon aRetval;
+
+ if(!aRetval.count())
+ {
+ aRetval.append( B2DPoint( 0.0, 0.0 ) );
+ aRetval.append( B2DPoint( 1.0, 0.0 ) );
+ aRetval.append( B2DPoint( 1.0, 1.0 ) );
+ aRetval.append( B2DPoint( 0.0, 1.0 ) );
+
+ // close
+ aRetval.setClosed( true );
+ }
+
+ return aRetval;
+ }
+
B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius )
{
return createPolygonFromEllipse( rCenter, fRadius, fRadius );