summaryrefslogtreecommitdiff
path: root/include/basegfx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-06-28 00:03:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-07-01 04:49:07 +0200
commitbfc19d77cb8db445f1c6123347c19a4c0c6a6cf8 (patch)
treed5deaaa44975838dec487d977d064c37080cf40e /include/basegfx
parent45a2eecfee472d8822130a90999b46ad371dee95 (diff)
Improve the looks of a wave line by draw it with bezier curves
This adds drawing the wave line (typically used to underline the wrongly spelled words) with bezier curves. Previously the wave lines were drawn with drawing pixels, which didn't look that good, especially on HiDPI display, so the looks of wave lines now is therefor much better. The creation of the wave line as a polygon has been added to the basegfx module, so it can be reused if needed. In addition, everytime we draw the waveline, we have to enable antialiasing, to have a much better quality of the curves. By default the antialiasing is disabled for some reason. This also adds ScopedStates.hxx file which currently includes ScopedAntialiasing, which sets the antialiasing to a certain state for the time the object is in scope, and then sets it back to the original state. Change-Id: I4b866fc5d69725eb7f6f78a1acf4176b1205aa73 Reviewed-on: https://gerrit.libreoffice.org/74810 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/basegfx')
-rw-r--r--include/basegfx/polygon/WaveLine.hxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/basegfx/polygon/WaveLine.hxx b/include/basegfx/polygon/WaveLine.hxx
new file mode 100644
index 000000000000..9d703165b212
--- /dev/null
+++ b/include/basegfx/polygon/WaveLine.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_BASEGFX_POLYGON_WAVELINE_HXX
+#define INCLUDED_BASEGFX_POLYGON_WAVELINE_HXX
+
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+
+namespace basegfx
+{
+// Creates a polygon of a wave line in the input rectangle.
+//
+// The polygon is created with points at the center of the rectangle,
+// and the quadratic control points at the upper and lower side. See
+// the diagram below.
+//
+// *----Q---------------Q------------*
+// | |
+// |P-------P-------P-------P-------P|
+// | |
+// *------------Q---------------Q----*
+//
+// P is the point
+// Q is the quadratic bezier control point
+//
+BASEGFX_DLLPUBLIC B2DPolygon createWaveLinePolygon(basegfx::B2DRectangle const& rRectangle);
+
+} // end of namespace basegfx
+
+#endif // INCLUDED_BASEGFX_POLYGON_WAVELINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */