summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2017-04-19 11:55:37 +0200
committerMurray Cumming <murrayc@murrayc.com>2017-04-19 12:36:03 +0200
commitb02bb4b589281e70d111581205950c8a2037640d (patch)
treed79b863846240fc6b4f50523fdabe69189a6e98a
parent3c6357c11f061abc8e209428156efb2f138cc2f7 (diff)
Change Cairo::Extend enum to Cairo::Pattern::Extend.
And change this from an old-style enum to a C++11 enum class.
-rw-r--r--cairomm/pattern.cc2
-rw-r--r--cairomm/pattern.h41
2 files changed, 40 insertions, 3 deletions
diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc
index 4834ad7..48a3ba4 100644
--- a/cairomm/pattern.cc
+++ b/cairomm/pattern.cc
@@ -86,7 +86,7 @@ void Pattern::set_extend(Extend extend)
check_object_status_and_throw_exception(*this);
}
-Extend Pattern::get_extend() const
+Pattern::Extend Pattern::get_extend() const
{
const auto result = static_cast<Extend>(cairo_pattern_get_extend(m_cobject));
check_object_status_and_throw_exception(*this);
diff --git a/cairomm/pattern.h b/cairomm/pattern.h
index cea7ed4..5e731c2 100644
--- a/cairomm/pattern.h
+++ b/cairomm/pattern.h
@@ -50,6 +50,43 @@ protected:
public:
+ /**
+ * Cairo::Extend is used to describe how pattern color/alpha will be determined
+ * for areas "outside" the pattern's natural area, (for example, outside the
+ * surface bounds or outside the gradient geometry).
+ *
+ * Mesh patterns are not affected by the extend mode.
+ *
+ * The default extend mode is Cairo::Pattern::Extend::NONE for surface patterns and
+ * Cairo::Pattern::Extend::PAD for gradient patterns.
+ *
+ * New entries may be added in future versions.
+ **/
+ enum class Extend
+ {
+ /**
+ * Pixels outside of the source pattern are fully transparent
+ */
+ NONE = CAIRO_EXTEND_NONE,
+
+ /**
+ * The pattern is tiled by repeating
+ */
+ REPEAT = CAIRO_EXTEND_REPEAT,
+
+ /**
+ * The pattern is tiled by reflecting at the edges (Implemented for surface
+ * patterns since 1.6)
+ */
+ REFLECT = CAIRO_EXTEND_REFLECT,
+
+ /**
+ * Pixels outside of the pattern copy the closest pixel from the source
+ * (Since 1.2; but only implemented for surface patterns since 1.6)
+ */
+ PAD = CAIRO_EXTEND_PAD
+ };
+
/** Create a C++ wrapper for the C instance. This C++ instance should then be given to a RefPtr.
* @param cobject The C instance.
* @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference.
@@ -111,8 +148,8 @@ public:
* Sets the mode to be used for drawing outside the area of a pattern. See
* Cairo::Extend for details on the semantics of each extend strategy.
*
- * The default extend mode is Cairo::EXTEND_NONE for surface patterns and
- * Cairo::EXTEND_PAD for gradient patterns.
+ * The default extend mode is Cairo::Pattern::Extend::NONE for surface patterns and
+ * Cairo::Pattern::Extend::PAD for gradient patterns.
*
* @param Cairo::Extend describing how the area outsize of the pattern will
* be drawn