summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2010-09-02 13:44:36 +0200
committerMurray Cumming <murrayc@murrayc.com>2010-09-02 13:44:36 +0200
commitcab739de4dd1a5e786db18e8e28b4f406db658be (patch)
tree352133374068bbdf8b18f9b1b8e561183e5cda38
parent4a705f726115fc17b15741e9406db94c02d38dfb (diff)
Context: set_dash(): Make the dashes parameter const.
* cairomm/context.[h|cc]: set_dash(): Add versions that take a const vector parameter, deprecating the old versions.
-rw-r--r--ChangeLog9
-rw-r--r--cairomm/context.cc12
-rw-r--r--cairomm/context.h31
3 files changed, 51 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 86ef75b..6d311bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,15 @@
2010-09-02 Murray Cumming <murrayc@murrayc.com>
+ Context: set_dash(): Make the dashes parameter const.
+
+ * cairomm/context.[h|cc]: set_dash(): Add versions that take a const
+ vector parameter, deprecating the old versions.
+
+2010-09-02 Murray Cumming <murrayc@murrayc.com>
+
Context: Make some methods const, deprecating the non-const versions.
- * cairomm/context.h: device_to_user(, device_to_user_distance(),
+ * cairomm/context.[h|cc]: device_to_user(, device_to_user_distance(),
user_to_device(), user_to_device_distance(): Deprecate the non-const versions,
adding const versions.
diff --git a/cairomm/context.cc b/cairomm/context.cc
index 10c2cce..b70da2b 100644
--- a/cairomm/context.cc
+++ b/cairomm/context.cc
@@ -165,6 +165,18 @@ void Context::set_dash(std::vector<double>& dashes, double offset)
check_object_status_and_throw_exception(*this);
}
+void Context::set_dash(const std::valarray<double>& dashes, double offset)
+{
+ cairo_set_dash(cobj(), &dashes[0], dashes.size(), offset);
+ check_object_status_and_throw_exception(*this);
+}
+
+void Context::set_dash(const std::vector<double>& dashes, double offset)
+{
+ cairo_set_dash(cobj(), &dashes[0], dashes.size(), offset);
+ check_object_status_and_throw_exception(*this);
+}
+
void Context::unset_dash()
{
cairo_set_dash(cobj(), NULL, 0, 0.0);
diff --git a/cairomm/context.h b/cairomm/context.h
index 6abebf4..499d9e7 100644
--- a/cairomm/context.h
+++ b/cairomm/context.h
@@ -232,9 +232,12 @@ public:
*/
void set_line_join(LineJoin line_join);
+#ifndef CAIROMM_DISABLE_DEPRECATED
/**
* Alternate version of set_dash(). You'll probably want to use the one that
* takes a std::vector argument instead.
+ *
+ * @deprecated Instead use the version that takes a const dashes parameter.
*/
void set_dash(std::valarray<double>& dashes, double offset);
@@ -254,8 +257,36 @@ public:
* @param offset an offset into the dash pattern at which the stroke should start
*
* @exception
+ *
+ * @deprecated Instead use the version that takes a const dashes parameter.
*/
void set_dash(std::vector<double>& dashes, double offset);
+#endif //CAIROMM_DISABLE_DEPRECATED
+
+ /**
+ * Alternate version of set_dash(). You'll probably want to use the one that
+ * takes a std::vector argument instead.
+ */
+ void set_dash(const std::valarray<double>& dashes, double offset);
+
+ /** Sets the dash pattern to be used by stroke(). A dash pattern is specified
+ * by dashes, an array of positive values. Each value provides the user-space
+ * length of altenate "on" and "off" portions of the stroke. The offset
+ * specifies an offset into the pattern at which the stroke begins.
+ *
+ * If dashes is empty dashing is disabled. If the size of dashes is 1, a
+ * symmetric pattern is assumed with alternating on and off portions of the
+ * size specified by the single value in dashes.
+ *
+ * It is invalid for any value in dashes to be negative, or for all values to
+ * be 0. If this is the case, an exception will be thrown
+ *
+ * @param dashes an array specifying alternate lengths of on and off portions
+ * @param offset an offset into the dash pattern at which the stroke should start
+ *
+ * @exception
+ */
+ void set_dash(const std::vector<double>& dashes, double offset);
/** This function disables a dash pattern that was set with set_dash()
*/