summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cairomm/region.cc14
-rw-r--r--cairomm/region.h17
2 files changed, 26 insertions, 5 deletions
diff --git a/cairomm/region.cc b/cairomm/region.cc
index 021c31b..bbbeeb1 100644
--- a/cairomm/region.cc
+++ b/cairomm/region.cc
@@ -25,11 +25,13 @@ namespace Cairo
Region::Region()
: m_cobject(cairo_region_create())
{
+ check_object_status_and_throw_exception (*this);
}
Region::Region(const RectangleInt& rectangle)
: m_cobject(cairo_region_create_rectangle(&rectangle))
{
+ check_object_status_and_throw_exception (*this);
}
Region::Region(cairo_region_t* cobject, bool has_reference)
@@ -39,6 +41,18 @@ Region::Region(cairo_region_t* cobject, bool has_reference)
m_cobject = cobject;
else
m_cobject = cairo_region_reference(cobject);
+
+ check_object_status_and_throw_exception (*this);
+}
+
+RefPtr<Region> Region::create()
+{
+ return RefPtr<Region>(new Region());
+}
+
+RefPtr<Region> Region::create(const RectangleInt& rectangle)
+{
+ return RefPtr<Region>(new Region(rectangle));
}
Region::~Region()
diff --git a/cairomm/region.h b/cairomm/region.h
index ea26a74..d4cf7db 100644
--- a/cairomm/region.h
+++ b/cairomm/region.h
@@ -28,14 +28,17 @@
namespace Cairo
{
-//TODO: Documentation.
-
/**
- * This is a reference-counted object that should be used via Cairo::RefPtr.
- */
+ * A Region represents a set of integer-aligned rectangles.
+ *
+ * It allows set-theoretical operations like do_union() and intersect() to be
+ * performed on them.
+ *
+ * Since: 1.10
+ **/
class Region
{
-public:
+private:
Region();
@@ -44,12 +47,16 @@ public:
//TODO: wrapping cairo_region_create_rectangles()
//Region(const RectangleInt *rects, int count);
+public:
/** 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.
*/
explicit Region(cairo_region_t* cobject, bool has_reference = false);
+ static RefPtr<Region> create();
+ static RefPtr<Region> create(const RectangleInt& rectangle);
+
//TODO:
//cairo_public cairo_region_t *
//cairo_region_copy (const cairo_region_t *original);