diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2006-06-28 01:11:24 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2006-06-28 01:11:24 +0800 |
commit | b76420a91df7463616d9dbcb6d7ec53a20866db4 (patch) | |
tree | abe79f20e8c82f6b8da8379890a9b59274c63a49 /graphics/cairomm/files | |
parent | cf72a9891c2a579b03f8630437212f05ca384cbe (diff) | |
download | marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar.gz marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar.bz2 marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar.lz marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar.xz marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.tar.zst marcuscom-ports-b76420a91df7463616d9dbcb6d7ec53a20866db4.zip |
Fix build with the latest cairo snapshot.
Obtained from: cairo CVS
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@6497 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'graphics/cairomm/files')
-rw-r--r-- | graphics/cairomm/files/patch-cairomm_surface.cc | 106 | ||||
-rw-r--r-- | graphics/cairomm/files/patch-cairomm_surface.h | 139 |
2 files changed, 245 insertions, 0 deletions
diff --git a/graphics/cairomm/files/patch-cairomm_surface.cc b/graphics/cairomm/files/patch-cairomm_surface.cc new file mode 100644 index 000000000..b6d1d6560 --- /dev/null +++ b/graphics/cairomm/files/patch-cairomm_surface.cc @@ -0,0 +1,106 @@ +--- cairomm/surface.cc 2006/03/06 17:55:51 1.12 ++++ cairomm/surface.cc 2006/06/27 01:46:14 1.15 +@@ -76,6 +76,17 @@ + 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); ++ check_object_status_and_throw_exception(*this); ++} ++ + #ifdef CAIRO_HAS_PNG_FUNCTIONS + void Surface::write_to_png(const std::string& filename) + { +@@ -164,6 +175,25 @@ + 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); ++} + + + /******************************************************************************* +@@ -195,9 +225,9 @@ + return RefPtr<PdfSurface>(new PdfSurface(cobject, true /* has reference */)); + } + +-void PdfSurface::set_dpi(double x_dpi, double y_dpi) ++void PdfSurface::set_size(double width_in_points, double height_in_points) + { +- cairo_pdf_surface_set_dpi(m_cobject, x_dpi, y_dpi); ++ cairo_pdf_surface_set_size(m_cobject, width_in_points, height_in_points); + check_object_status_and_throw_exception(*this); + } + +@@ -231,12 +261,32 @@ + return RefPtr<PsSurface>(new PsSurface(cobject, true /* has reference */)); + } + +-void PsSurface::set_dpi(double x_dpi, double y_dpi) ++void PsSurface::set_size(double width_in_points, double height_in_points) + { +- cairo_ps_surface_set_dpi(m_cobject, x_dpi, y_dpi); ++ 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 + + +@@ -267,12 +317,6 @@ + return RefPtr<SvgSurface>(new SvgSurface(cobject, true /* has reference */)); + } + +-void SvgSurface::set_dpi(double x_dpi, double y_dpi) +-{ +- cairo_svg_surface_set_dpi(m_cobject, x_dpi, y_dpi); +- check_object_status_and_throw_exception(*this); +-} +- + #endif // CAIRO_HAS_SVG_SURFACE + + diff --git a/graphics/cairomm/files/patch-cairomm_surface.h b/graphics/cairomm/files/patch-cairomm_surface.h new file mode 100644 index 000000000..024b5ed45 --- /dev/null +++ b/graphics/cairomm/files/patch-cairomm_surface.h @@ -0,0 +1,139 @@ +--- cairomm/surface.h 2006/03/06 17:55:51 1.10 ++++ cairomm/surface.h 2006/06/27 01:46:14 1.13 +@@ -137,6 +137,17 @@ + */ + 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 ++ * @param y_pixels_per_inch Pixels per inch in the y direction ++ */ ++ void set_fallback_resolution(double x_pixels_per_inch, double y_pixels_per_inch); ++ + #ifdef CAIRO_HAS_PNG_FUNCTIONS + + /** Writes the contents of surface to a new file filename as a PNG image. +@@ -243,6 +254,29 @@ + */ + 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 +@@ -367,12 +401,19 @@ + */ + static RefPtr<PdfSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points); + +- /** Sets the resolution of the image in dots per inch +- * +- * @param x_dpi The dpi in the x direction +- * @param y_dpi The dpi in the y direction +- */ +- void set_dpi(double x_dpi, double y_dpi); ++/** ++ * 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 +@@ -424,12 +465,45 @@ + */ + static RefPtr<PsSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points); + +- /** Sets the resolution of the image in dots per inch ++ /** ++ * 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. + * +- * @param x_dpi The dpi in the x direction +- * @param y_dpi The dpi in the y direction ++ * 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 set_dpi(double x_dpi, double y_dpi); ++ 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(); + + }; + +@@ -483,12 +557,6 @@ + */ + static RefPtr<SvgSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points); + +- /** Sets the resolution of the image in dots per inch +- * +- * @param x_dpi The dpi in the x direction +- * @param y_dpi The dpi in the y direction +- */ +- void set_dpi(double x_dpi, double y_dpi); + }; + + #endif // CAIRO_HAS_SVG_SURFACE |