summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@gnome.org>2006-06-26 13:18:44 +0000
committerJonathon Jongsma <jjongsma@gnome.org>2006-06-26 13:18:44 +0000
commit35cab8ca4832146a82153992257e866679033775 (patch)
tree6458449b745e85d5567ccaa8c902b6ac0458f9f7
parent3d3d3182bf4b68d34c888be092e955e303960e5c (diff)
2006-06-26 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* cairomm/surface.cc: * cairomm/surface.h: Added new Surface and ImageSurface API from 1.1.x snapshots
-rw-r--r--ChangeLog6
-rw-r--r--cairomm/surface.cc24
-rw-r--r--cairomm/surface.h27
3 files changed, 57 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cc0bb49..7a10bb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-26 Jonathon Jongsma <jonathon.jongsma@gmail.com>
+
+ * cairomm/surface.cc:
+ * cairomm/surface.h: Added new Surface and ImageSurface API from 1.1.x
+ snapshots
+
2006-06-23 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* cairomm/context.cc:
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index 9d12bb6..aa8b5e1 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -76,6 +76,11 @@ void Surface::set_device_offset(double x_offset, double y_offset)
check_object_status_and_throw_exception(*this);
}
+void Surface::get_device_offset(double& x_offset, double& y_offset)
+{
+ cairo_surface_get_device_offset(m_cobject, &x_offset, &y_offset);
+}
+
void Surface::set_fallback_resolution(double x_pixels_per_inch, double y_pixels_per_inch)
{
cairo_surface_set_fallback_resolution(m_cobject, x_pixels_per_inch, y_pixels_per_inch);
@@ -170,6 +175,25 @@ int ImageSurface::get_height() const
return result;
}
+unsigned char* ImageSurface::get_data()
+{
+ return cairo_image_surface_get_data(m_cobject);
+}
+
+const unsigned char* ImageSurface::get_data() const
+{
+ return cairo_image_surface_get_data(m_cobject);
+}
+
+Format ImageSurface::get_format() const
+{
+ return static_cast<Format>(cairo_image_surface_get_format(m_cobject));
+}
+
+int ImageSurface::get_stride() const
+{
+ return cairo_image_surface_get_stride(m_cobject);
+}
/*******************************************************************************
diff --git a/cairomm/surface.h b/cairomm/surface.h
index 60a48f6..1841399 100644
--- a/cairomm/surface.h
+++ b/cairomm/surface.h
@@ -137,6 +137,10 @@ public:
*/
void set_device_offset(double x_offset, double y_offset);
+ /** Returns a previous device offset set by set_device_offset().
+ */
+ void get_device_offset(double& x_offset, double& y_offset);
+
/** Sets the fallback resolution of the image in dots per inch
*
* @param x_pixels_per_inch Pixels per inch in the x direction
@@ -250,6 +254,29 @@ public:
*/
int get_height() const;
+ /**
+ * Get a pointer to the data of the image surface, for direct
+ * inspection or modification.
+ *
+ * Return value: a pointer to the image data of this surface or NULL
+ * if @surface is not an image surface.
+ */
+ unsigned char* get_data();
+ const unsigned char* get_data() const;
+
+ /** gets the format of the surface
+ */
+ Format get_format() const;
+
+ /**
+ * Return value: the stride of the image surface in bytes (or 0 if
+ * @surface is not an image surface). The stride is the distance in
+ * bytes from the beginning of one row of the image data to the
+ * beginning of the next row.
+ */
+ int get_stride() const;
+
+
/** Creates an image surface of the specified format and dimensions. The
* initial contents of the surface is undefined; you must explicitely clear
* the buffer, using, for example, Cairo::Context::rectangle() and