/src/wrappers/cairo/library/cairo_svg_surface.e

http://github.com/tybor/Liberty · Specman e · 158 lines · 52 code · 20 blank · 86 comment · 2 complexity · d943bceef1664d0f10b116dbe799f014 MD5 · raw file

  1. note
  2. description: "SVG Surfaces: Rendering SVG documents."
  3. copyright: "[
  4. Copyright (C) 2007-2017: Paolo Redaelli, Cairo 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_SVG_SURFACE
  20. inherit CAIRO_SURFACE
  21. insert CAIRO_SVG_VERSION
  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 SVG surface of the specified size in points to
  26. -- be written to filename.
  27. -- `a_filename' : a filename for the SVG 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. require filename_not_void: a_filename/=Void
  34. do
  35. from_external_pointer(cairo_svg_surface_create
  36. (a_filename.to_external, a_width_in_points, an_height_in_points))
  37. -- cairo_svg_surface_create returns a pointer to the newly
  38. -- created surface. The caller owns the surface and should
  39. -- call cairo_surface_destroy when done with it. This
  40. -- function always returns a valid pointer, but it will
  41. -- return a pointer to a "nil" surface if an error such as
  42. -- out of memory occurs. You can use cairo_surface_status()
  43. -- to check for this.
  44. end
  45. -- cairo_svg_surface_create_for_stream ()
  46. --
  47. -- cairo_surface_t* cairo_svg_surface_create_for_stream
  48. -- (cairo_write_func_t write_func,
  49. -- void *closure,
  50. -- double width_in_points,
  51. -- double height_in_points);
  52. --
  53. -- Creates a SVG surface of the specified size in points to be written
  54. -- incrementally to the stream represented by write_func and closure.
  55. --
  56. -- write_func : a cairo_write_func_t to accept the output data
  57. -- closure : the closure argument for write_func
  58. -- width_in_points : width of the surface, in points (1 point == 1/72.0
  59. -- inch)
  60. -- height_in_points : height of the surface, in points (1 point == 1/72.0
  61. -- inch)
  62. -- Returns : a pointer to the newly created surface. The caller owns
  63. -- the surface and should call cairo_surface_destroy when
  64. -- done with it. This function always returns a valid
  65. -- pointer, but it will return a pointer to a "nil"
  66. -- surface if an error such as out of memory occurs. You
  67. -- can use cairo_surface_status() to check for this.
  68. --
  69. -- Since 1.2
  70. --
  71. feature {ANY}
  72. restrict_to_version (a_version: INTEGER)
  73. -- Restricts the generated SVG file to version. See
  74. -- `versions' for a list of available version values that can
  75. -- be used here.
  76. -- This function should only be called before any drawing
  77. -- operations have been performed on the given surface. The
  78. -- simplest way to do this is to call this function
  79. -- immediately after creating the surface.
  80. require valid_version: is_valid_svg_version(a_version)
  81. do
  82. cairo_svg_surface_restrict_to_version(handle, a_version)
  83. end
  84. -- TODO versions: ARRAY[INTEGER] is
  85. --
  86. -- void cairo_svg_get_versions (cairo_svg_version_t const **versions,
  87. -- int *num_versions);
  88. --
  89. -- Used to retrieve the list of supported versions. See
  90. -- cairo_svg_surface_restrict_to_version().
  91. --
  92. -- versions : supported version list
  93. -- num_versions : list length
  94. --
  95. -- Since 1.2
  96. --
  97. -- version_to_string ()
  98. --
  99. -- const char* cairo_svg_version_to_string (cairo_svg_version_t version);
  100. --
  101. -- Get the string representation of the given version id. This function will
  102. -- return NULL if version isn't valid. See cairo_svg_get_versions() for a way
  103. -- to get the list of valid version ids.
  104. --
  105. -- version : a version id
  106. -- Returns : the string associated to given version.
  107. --
  108. -- Since 1.2
  109. feature {}
  110. cairo_svg_surface_create (a_filename: POINTER; a_width_in_points, an_height_in_points: REAL): POINTER
  111. -- cairo_surface_t* cairo_svg_surface_create (const char
  112. -- *filename, double width_in_points, double
  113. -- height_in_points);
  114. external "C use <cairo.h>"
  115. end
  116. cairo_svg_surface_create_for_stream (a_write_func, a_closure: POINTER; a_width_in_points, an_height_in_points: REAL): POINTER
  117. -- cairo_surface_t* cairo_svg_surface_create_for_stream
  118. -- (cairo_write_func_t write_func, void *closure, double
  119. -- width_in_points, double height_in_points);
  120. external "C use <cairo.h>"
  121. end
  122. cairo_svg_surface_restrict_to_version (a_surface: POINTER; a_version: INTEGER)
  123. -- void cairo_svg_surface_restrict_to_version
  124. -- (cairo_surface_t *surface, cairo_svg_version_t version);
  125. external "C use <cairo.h>"
  126. end
  127. -- enum cairo_svg_version_t;
  128. cairo_svg_get_versions (some_versions, a_num_versions: POINTER)
  129. -- void cairo_svg_get_versions (cairo_svg_version_t const
  130. -- **versions, int *num_versions);
  131. external "C use <cairo.h>"
  132. end
  133. cairo_svg_version_to_string (a_version: INTEGER): POINTER
  134. -- const char* cairo_svg_version_to_string (cairo_svg_version_t
  135. -- version);
  136. external "C use <cairo.h>"
  137. end
  138. end -- class CAIRO_SVG_SURFACE