summaryrefslogtreecommitdiff
path: root/include/basegfx
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-01-31 00:52:50 +0100
committerThorsten Behrens <tbehrens@suse.com>2013-10-07 17:33:45 +0200
commit3e2dba1accbd018f7dac362a2636bed135f1b5bb (patch)
treef9999b443935eb2f11f8655713f0a47af569cfc1 /include/basegfx
parent60ff4fa99654e9c2ad9a9b023dae0ccda75d7d95 (diff)
Add 7-segment display polygon generator to basegfx.
Basegfx gets a basegfx::tools::number2PolyPolygon method that converts a number 0-9 into a 7-segment digit display polygon. Change-Id: I4d3326c9fe9e42d07a6248781127f19ac27d8b72
Diffstat (limited to 'include/basegfx')
-rw-r--r--include/basegfx/polygon/b2dpolypolygontools.hxx20
-rw-r--r--include/basegfx/tools/tools.hxx25
2 files changed, 45 insertions, 0 deletions
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
index 1d138a03b5b7..59f03ff3a63d 100644
--- a/include/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -220,6 +220,26 @@ namespace basegfx
// #i76891# Try to remove existing curve segments if they are simply edges
BASEGFX_DLLPUBLIC B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate);
+ /** Creates polypolygon for seven-segment display number
+
+ This function takes an integer number between 0 and 9 and
+ convert it into the well-known seven-segment display
+ number (like most digital clocks show their numbers). The
+ digit will exactly fit the unit rectangle. The polypolygon
+ will be a line polygon, i.e. if you need the segment parts
+ to have width, use createAreaGeometry() on the result.
+
+ @param cNumber
+ Number from '0' to '9' as ASCII char, or '-', 'E' and '.'
+ to convert to 7 segment code
+
+ @param bLitSegments
+ When true, return a polygon containing the segments that
+ are 'lit' for the given number. Return un-lit segments
+ otherwise.
+ */
+ B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char cNumber, bool bLitSegments=true);
+
/** snap some polygon coordinates to discrete coordinates
This method allows to snap some polygon points to discrete (integer) values
diff --git a/include/basegfx/tools/tools.hxx b/include/basegfx/tools/tools.hxx
index c1fa0940ae35..c9af12b73fcd 100644
--- a/include/basegfx/tools/tools.hxx
+++ b/include/basegfx/tools/tools.hxx
@@ -27,6 +27,7 @@ namespace basegfx
{
class B2DPoint;
class B2DRange;
+ class B2DPolyPolygon;
namespace tools
{
@@ -94,6 +95,30 @@ namespace basegfx
::basegfx::B2DPoint& io_rRightBottom,
const ::basegfx::B2DRange& rFitTarget );
+ /** Creates polypolygon with the given number as seven-segment
+ digits
+
+ @param fVal
+ Value to convert
+
+ @param nTotalDigits
+ Total number of digits to display. If less is needed for
+ given number, fill space with blanks.
+
+ @param nDecPlaces
+ Decimal places to show. When 0, display as integer. When
+ negative, fill given number of before-the-decimal point
+ with zero.
+
+ @param bLitSegments
+ When true, return a polygon containing the segments that
+ are 'lit' for the given number. Return un-lit segments
+ otherwise.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon number2PolyPolygon(double fVal,
+ sal_Int32 nTotalDigits,
+ sal_Int32 nDecPlaces,
+ bool bLitSegments=true);
}
}