Kaydet (Commit) c13f0a62 authored tarafından Mark Hung's avatar Mark Hung

tdf#100236 implement waveline in mtfrenderer.

Create B2DPolygon with ::basegfx::utils::createWaveline
to render the waveline. Parameters are adapted from
the drawinglayer. Thickness of the line isn't really
implemented yet.

Change-Id: I74d05744632d5d54e439a2a3e144fa2daf4ae1bb
Reviewed-on: https://gerrit.libreoffice.org/61947
Tested-by: Jenkins
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst 226f3971
...@@ -257,6 +257,42 @@ namespace cppcanvas ...@@ -257,6 +257,42 @@ namespace cppcanvas
namespace namespace
{ {
void appendWaveline( ::basegfx::B2DPolyPolygon& o_rPoly,
const ::basegfx::B2DPoint& rStartPos,
const double nStartOffset,
const double nWidth,
const double nHeight,
sal_Int8 nLineStyle)
{
const double x(rStartPos.getX());
const double y(rStartPos.getY());
const double nY1 = y + nStartOffset;
const double nX2 = x + nWidth;
const double nY2 = nY1 + nHeight;
double nWaveWidth = nHeight * 10.6 * 0.25;
// Offset for the double line.
double nOffset = 0.0;
if (nLineStyle == LINESTYLE_DOUBLEWAVE)
nOffset = -nHeight * 0.5;
else
nWaveWidth *= 2.0;
o_rPoly.append(::basegfx::utils::createWaveline(
::basegfx::utils::createPolygonFromRect(::basegfx::B2DRectangle(x, nY1 + nOffset, nX2, nY2 + nOffset)),
nWaveWidth,
nWaveWidth * 0.5));
if (nLineStyle == LINESTYLE_DOUBLEWAVE)
{
nOffset = nHeight * 1.2;
o_rPoly.append(::basegfx::utils::createWaveline(
::basegfx::utils::createPolygonFromRect(::basegfx::B2DRectangle(x, nY1 + nOffset, nX2, nY2 + nOffset)),
nWaveWidth,
nWaveWidth * 0.5));
}
}
void appendRect( ::basegfx::B2DPolyPolygon& o_rPoly, void appendRect( ::basegfx::B2DPolyPolygon& o_rPoly,
const ::basegfx::B2DPoint& rStartPos, const ::basegfx::B2DPoint& rStartPos,
const double nX1, const double nX1,
...@@ -324,10 +360,22 @@ namespace cppcanvas ...@@ -324,10 +360,22 @@ namespace cppcanvas
case LINESTYLE_DONTKNOW: case LINESTYLE_DONTKNOW:
break; break;
case LINESTYLE_SMALLWAVE: // TODO(F3): NYI case LINESTYLE_DOUBLEWAVE:
// FALLTHROUGH intended // FALLTHROUGH intended
case LINESTYLE_WAVE: // TODO(F3): NYI case LINESTYLE_SMALLWAVE:
// FALLTHROUGH intended
case LINESTYLE_BOLDWAVE:
// FALLTHROUGH intended // FALLTHROUGH intended
case LINESTYLE_WAVE:
appendWaveline(
aTextLinesPolyPoly,
rStartPos,
rTextLineInfo.mnOverlineOffset,
rLineWidth,
rTextLineInfo.mnOverlineHeight,
rTextLineInfo.mnOverlineStyle);
break;
case LINESTYLE_SINGLE: case LINESTYLE_SINGLE:
appendRect( appendRect(
aTextLinesPolyPoly, aTextLinesPolyPoly,
...@@ -348,8 +396,6 @@ namespace cppcanvas ...@@ -348,8 +396,6 @@ namespace cppcanvas
// FALLTHROUGH intended // FALLTHROUGH intended
case LINESTYLE_BOLDDASHDOTDOT:// TODO(F3): NYI case LINESTYLE_BOLDDASHDOTDOT:// TODO(F3): NYI
// FALLTHROUGH intended // FALLTHROUGH intended
case LINESTYLE_BOLDWAVE: // TODO(F3): NYI
// FALLTHROUGH intended
case LINESTYLE_BOLD: case LINESTYLE_BOLD:
appendRect( appendRect(
aTextLinesPolyPoly, aTextLinesPolyPoly,
...@@ -360,8 +406,6 @@ namespace cppcanvas ...@@ -360,8 +406,6 @@ namespace cppcanvas
rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight ); rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight );
break; break;
case LINESTYLE_DOUBLEWAVE: // TODO(F3): NYI
// FALLTHROUGH intended
case LINESTYLE_DOUBLE: case LINESTYLE_DOUBLE:
appendRect( appendRect(
aTextLinesPolyPoly, aTextLinesPolyPoly,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment