diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2006-06-27 01:46:13 +0000 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2006-06-27 01:46:13 +0000 |
commit | 96eca5da1cc418021fac9c6c497dc9dc3167d53c (patch) | |
tree | b3ba8c147968aa0e0911832c39820878a4e5d221 | |
parent | 35cab8ca4832146a82153992257e866679033775 (diff) |
2006-06-26 Jonathon Jongsma <jonathon.jongsma@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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | cairomm/surface.cc | 32 | ||||
-rw-r--r-- | cairomm/surface.h | 52 | ||||
-rw-r--r-- | cairomm/xlib_surface.cc | 56 | ||||
-rw-r--r-- | cairomm/xlib_surface.h | 14 |
5 files changed, 161 insertions, 0 deletions
@@ -1,5 +1,12 @@ 2006-06-26 Jonathon Jongsma <jonathon.jongsma@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 + +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 diff --git a/cairomm/surface.cc b/cairomm/surface.cc index aa8b5e1..d68464e 100644 --- a/cairomm/surface.cc +++ b/cairomm/surface.cc @@ -225,6 +225,12 @@ RefPtr<PdfSurface> PdfSurface::create(cairo_write_func_t write_func, void *closu 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 @@ RefPtr<PsSurface> PsSurface::create(cairo_write_func_t write_func, void *closure 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 diff --git a/cairomm/surface.h b/cairomm/surface.h index 1841399..83b5d77 100644 --- a/cairomm/surface.h +++ b/cairomm/surface.h @@ -401,6 +401,19 @@ public: */ 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 @@ public: */ 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(); }; diff --git a/cairomm/xlib_surface.cc b/cairomm/xlib_surface.cc index 3a6acc6..d959be4 100644 --- a/cairomm/xlib_surface.cc +++ b/cairomm/xlib_surface.cc @@ -60,6 +60,62 @@ void XlibSurface::set_drawable(Drawable drawable, int width, int height) 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 diff --git a/cairomm/xlib_surface.h b/cairomm/xlib_surface.h index 8231099..995dcc8 100644 --- a/cairomm/xlib_surface.h +++ b/cairomm/xlib_surface.h @@ -110,6 +110,20 @@ public: */ 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 |