[cairo-commit] cairomm/cairomm surface.cc, 1.14, 1.15 surface.h, 1.12, 1.13 xlib_surface.cc, 1.3, 1.4 xlib_surface.h, 1.3, 1.4

Jonathon Jongsma commit at pdx.freedesktop.org
Mon Jun 26 18:46:16 PDT 2006


Committed by: jjongsma

Update of /cvs/cairo/cairomm/cairomm
In directory kemper:/tmp/cvs-serv5131/cairomm

Modified Files:
	surface.cc surface.h xlib_surface.cc xlib_surface.h 
Log Message:
2006-06-26  Jonathon Jongsma  <jonathon.jongsma at gmail.com>

	* cairomm/surface.cc, cairomm/surface.h: add new PsSurface and PdfSurface
	API: set_size, dsc_comment, dsc_begin_setup, dsc_begin_page_setup
	* cairomm/xlib_surface.cc, cairomm/xlib_surface.h: add new XlibSurface API:
	get_display, get_drawable, get_screen, get_visual, get_depth


Index: surface.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/surface.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- surface.cc	26 Jun 2006 13:18:45 -0000	1.14
+++ surface.cc	27 Jun 2006 01:46:14 -0000	1.15
@@ -225,6 +225,12 @@
   return RefPtr<PdfSurface>(new PdfSurface(cobject, true /* has reference */));
 }
 
+void PdfSurface::set_size(double width_in_points, double height_in_points)
+{
+  cairo_pdf_surface_set_size(m_cobject, width_in_points, height_in_points);
+  check_object_status_and_throw_exception(*this);
+}
+
 #endif // CAIRO_HAS_PDF_SURFACE
 
 
@@ -255,6 +261,32 @@
   return RefPtr<PsSurface>(new PsSurface(cobject, true /* has reference */));
 }
 
+void PsSurface::set_size(double width_in_points, double height_in_points)
+{
+  cairo_ps_surface_set_size(m_cobject, width_in_points, height_in_points);
+  check_object_status_and_throw_exception(*this);
+}
+
+
+void PsSurface::dsc_comment(std::string comment)
+{
+  cairo_ps_surface_dsc_comment(m_cobject, comment.c_str());
+  check_object_status_and_throw_exception(*this);
+}
+
+void PsSurface::dsc_begin_setup()
+{
+  cairo_ps_surface_dsc_begin_setup(m_cobject);
+  check_object_status_and_throw_exception(*this);
+}
+
+void PsSurface::dsc_begin_page_setup()
+{
+  cairo_ps_surface_dsc_begin_page_setup(m_cobject);
+  check_object_status_and_throw_exception(*this);
+}
+
+
 #endif // CAIRO_HAS_PS_SURFACE
 
 

Index: surface.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/surface.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- surface.h	26 Jun 2006 13:18:45 -0000	1.12
+++ surface.h	27 Jun 2006 01:46:14 -0000	1.13
@@ -401,6 +401,19 @@
    */
   static RefPtr<PdfSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
 
+/**
+ * Changes the size of a PDF surface for the current (and subsequent) pages.
+ *
+ * This function should only be called before any drawing operations have been
+ * performed on the current page. The simplest way to do this is to call this
+ * function immediately after creating the surface or immediately after
+ * completing a page with either Context::show_page() or Context::copy_page().
+ *
+ * \param width_in_points new surface width, in points (1 point == 1/72.0 inch)
+ * \param height_in_points new surface height, in points (1 point == 1/72.0 inch)
+ **/
+  void set_size(double width_in_points, double height_in_points);
+
 };
 
 #endif  // CAIRO_HAS_PDF_SURFACE
@@ -452,6 +465,45 @@
    */
   static RefPtr<PsSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
 
+  /**
+   * Changes the size of a PostScript surface for the current (and
+   * subsequent) pages.
+   *
+   * This function should only be called before any drawing operations have been
+   * performed on the current page. The simplest way to do this is to call this
+   * function immediately after creating the surface or immediately after
+   * completing a page with either Context::show_page() or Context::copy_page().
+   *
+   * \param width_in_points new surface width, in points (1 point == 1/72.0 inch)
+   * \param height_in_points new surface height, in points (1 point == 1/72.0 inch)
+   */
+  void set_size(double width_in_points, double height_in_points);
+
+  /** Emit a comment into the PostScript output for the given surface.  See the
+   * cairo reference documentation for more information.
+   *
+   * \param comment a comment string to be emitted into the PostScript output
+   */
+  void dsc_comment(std::string comment);
+
+  /**
+   * This function indicates that subsequent calls to dsc_comment() should direct
+   * comments to the Setup section of the PostScript output.
+   *
+   * This function should be called at most once per surface, and must be called
+   * before any call to dsc_begin_page_setup() and before any drawing is performed
+   * to the surface.
+   */
+  void dsc_begin_setup();
+
+  /** This function indicates that subsequent calls to dsc_comment() should
+   * direct comments to the PageSetup section of the PostScript output.
+   *
+   * This function call is only needed for the first page of a surface. It
+   * should be called after any call to dsc_begin_setup() and before any drawing
+   * is performed to the surface.
+   */
+  void dsc_begin_page_setup();
 
 };
 

Index: xlib_surface.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/xlib_surface.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xlib_surface.cc	6 Mar 2006 17:55:51 -0000	1.3
+++ xlib_surface.cc	27 Jun 2006 01:46:14 -0000	1.4
@@ -60,6 +60,62 @@
   check_object_status_and_throw_exception(*this);
 }
 
+Drawable XlibSurface::get_drawable() const
+{
+  Drawable drawable = cairo_xlib_surface_get_drawable(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return drawable;
+}
+
+const Display* XlibSurface::get_display() const
+{
+  const Display* dpy = cairo_xlib_surface_get_display(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return dpy;
+}
+
+Display* XlibSurface::get_display()
+{
+  Display* dpy = cairo_xlib_surface_get_display(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return dpy;
+}
+
+Screen* XlibSurface::get_screen()
+{
+  Screen* screen = cairo_xlib_surface_get_screen(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return screen;
+}
+
+const Screen* XlibSurface::get_screen() const
+{
+  const Screen* screen = cairo_xlib_surface_get_screen(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return screen;
+}
+
+Visual* XlibSurface::get_visual()
+{
+  Visual* visual = cairo_xlib_surface_get_visual(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return visual;
+}
+
+const Visual* XlibSurface::get_visual() const
+{
+  const Visual* visual = cairo_xlib_surface_get_visual(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return visual;
+}
+
+int XlibSurface::get_depth() const
+{
+  int depth = cairo_xlib_surface_get_depth(m_cobject);
+  check_object_status_and_throw_exception(*this);
+  return depth;
+}
+
 #endif // CAIRO_HAS_XLIB_SURFACE
 
 } //namespace Cairo

Index: xlib_surface.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/xlib_surface.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xlib_surface.h	6 Mar 2006 17:55:51 -0000	1.3
+++ xlib_surface.h	27 Jun 2006 01:46:14 -0000	1.4
@@ -110,6 +110,20 @@
    */
   void set_drawable(Drawable drawable, int width, int height);
 
+  /** gets the Drawable object associated with this surface
+   */
+  Drawable get_drawable() const;
+
+  const Display* get_display() const;
+  Display* get_display();
+
+  Screen* get_screen();
+  const Screen* get_screen() const;
+
+  Visual* get_visual();
+  const Visual* get_visual() const;
+  int get_depth() const;
+
 };
 
 #endif // CAIRO_HAS_XLIB_SURFACE



More information about the cairo-commit mailing list