/src/wrappers/cairo/library/cairo_pdf_surface.e

http://github.com/tybor/Liberty · Specman e · 97 lines · 34 code · 17 blank · 46 comment · 2 complexity · 20971f77fea775de6d43da3104ed80e9 MD5 · raw file

  1. note
  2. description: "PDF Surfaces -- Rendering PDF documents."
  3. copyright: "[
  4. Copyright (C) 2007-2017: Paolo Redaelli, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. wrapped_version: "1.2.4"
  19. class CAIRO_PDF_SURFACE
  20. inherit CAIRO_SURFACE
  21. insert CAIRO_PDF_SURFACE_EXTERNALS
  22. create {ANY} make, from_external_pointer
  23. feature {} -- Creation
  24. make (a_filename: STRING; a_width_in_points, an_height_in_points: REAL)
  25. -- Creates a PDF surface of the specified size in points to
  26. -- be written to filename.
  27. -- `a_filename' : a filename for the PDF output (must be
  28. -- writable)
  29. -- `a_width_in_points' : width of the surface, in points (1
  30. -- point == 1/72.0 inch)
  31. -- `an_height_in_points' : height of the surface, in points
  32. -- (1 point == 1/72.0 inch)
  33. do
  34. from_external_pointer(cairo_pdf_surface_create
  35. (a_filename.to_external, a_width_in_points,an_height_in_points))
  36. -- cairo_pdf_surface_create returns a pointer to the newly
  37. -- created surface. The caller owns the surface and should
  38. -- call cairo_surface_destroy when done with it. This
  39. -- function always returns a valid pointer, but it will
  40. -- return a pointer to a "nil" surface if an error such as
  41. -- out of memory occurs. You can use cairo_surface_status()
  42. -- to check for this.
  43. end
  44. -- TODO: cairo_pdf_surface_create_for_stream ()
  45. -- cairo_surface_t* cairo_pdf_surface_create_for_stream
  46. -- (cairo_write_func_t write_func,
  47. -- void *closure,
  48. -- double width_in_points,
  49. -- double height_in_points);
  50. --
  51. -- Creates a PDF surface of the specified size in points to be written
  52. -- incrementally to the stream represented by write_func and closure.
  53. --
  54. -- write_func : a cairo_write_func_t to accept the output data
  55. -- closure : the closure argument for write_func
  56. -- width_in_points : width of the surface, in points (1 point == 1/72.0
  57. -- inch)
  58. -- height_in_points : height of the surface, in points (1 point == 1/72.0
  59. -- inch)
  60. -- Returns : a pointer to the newly created surface. The caller owns
  61. -- the surface and should call cairo_surface_destroy when
  62. -- done with it. This function always returns a valid
  63. -- pointer, but it will return a pointer to a "nil"
  64. -- surface if an error such as out of memory occurs. You
  65. -- can use cairo_surface_status() to check for this.
  66. feature {ANY}
  67. set_size (a_width_in_points, an_height_in_points: REAL)
  68. -- Changes the size of a PDF surface for the current (and subsequent) pages.
  69. -- This function should only be called before any drawing
  70. -- operations have been performed on the current page. The
  71. -- simplest way to do this is to call this function
  72. -- immediately after creating the surface or immediately
  73. -- after completing a page with either cairo_show_page() or
  74. -- cairo_copy_page().
  75. -- width_in_points : new surface width, in points (1 point == 1/72.0 inch)
  76. -- height_in_points : new surface height, in points (1 point == 1/72.0 inch)
  77. do
  78. cairo_pdf_surface_set_size(handle,a_width_in_points,an_height_in_points)
  79. end
  80. end -- class CAIRO_PDF_SURFACE