cairo-svg.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* cairo - a vector graphics library with display and print output
  2. *
  3. * cairo-svg.h
  4. *
  5. * Copyright © 2005 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it either under the terms of the GNU Lesser General Public
  9. * License version 2.1 as published by the Free Software Foundation
  10. * (the "LGPL") or, at your option, under the terms of the Mozilla
  11. * Public License Version 1.1 (the "MPL"). If you do not alter this
  12. * notice, a recipient may use your version of this file under either
  13. * the MPL or the LGPL.
  14. *
  15. * You should have received a copy of the LGPL along with this library
  16. * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
  18. * You should have received a copy of the MPL along with this library
  19. * in the file COPYING-MPL-1.1
  20. *
  21. * The contents of this file are subject to the Mozilla Public License
  22. * Version 1.1 (the "License"); you may not use this file except in
  23. * compliance with the License. You may obtain a copy of the License at
  24. * http://www.mozilla.org/MPL/
  25. *
  26. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  27. * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  28. * the specific language governing rights and limitations.
  29. *
  30. */
  31. #ifndef CAIRO_SVG_H
  32. #define CAIRO_SVG_H
  33. #include "cairo.h"
  34. #if CAIRO_HAS_SVG_SURFACE
  35. CAIRO_BEGIN_DECLS
  36. /**
  37. * cairo_svg_version_t:
  38. * @CAIRO_SVG_VERSION_1_1: The version 1.1 of the SVG specification. (Since 1.2)
  39. * @CAIRO_SVG_VERSION_1_2: The version 1.2 of the SVG specification. (Since 1.2)
  40. *
  41. * #cairo_svg_version_t is used to describe the version number of the SVG
  42. * specification that a generated SVG file will conform to.
  43. *
  44. * Since: 1.2
  45. **/
  46. typedef enum _cairo_svg_version {
  47. CAIRO_SVG_VERSION_1_1,
  48. CAIRO_SVG_VERSION_1_2
  49. } cairo_svg_version_t;
  50. /**
  51. * cairo_svg_unit_t:
  52. * @CAIRO_SVG_UNIT_USER: User unit, a value in the current coordinate system.
  53. * If used in the root element for the initial coordinate systems it
  54. * corresponds to pixels. (Since 1.16)
  55. * @CAIRO_SVG_UNIT_EM: The size of the element's font. (Since 1.16)
  56. * @CAIRO_SVG_UNIT_EX: The x-height of the element’s font. (Since 1.16)
  57. * @CAIRO_SVG_UNIT_PX: Pixels (1px = 1/96th of 1in). (Since 1.16)
  58. * @CAIRO_SVG_UNIT_IN: Inches (1in = 2.54cm = 96px). (Since 1.16)
  59. * @CAIRO_SVG_UNIT_CM: Centimeters (1cm = 96px/2.54). (Since 1.16)
  60. * @CAIRO_SVG_UNIT_MM: Millimeters (1mm = 1/10th of 1cm). (Since 1.16)
  61. * @CAIRO_SVG_UNIT_PT: Points (1pt = 1/72th of 1in). (Since 1.16)
  62. * @CAIRO_SVG_UNIT_PC: Picas (1pc = 1/6th of 1in). (Since 1.16)
  63. * @CAIRO_SVG_UNIT_PERCENT: Percent, a value that is some fraction of another
  64. * reference value. (Since 1.16)
  65. *
  66. * #cairo_svg_unit_t is used to describe the units valid for coordinates and
  67. * lengths in the SVG specification.
  68. *
  69. * See also:
  70. * - [SVG Units](https://www.w3.org/TR/SVG/coords.html#Units)
  71. * - [SVG Types](https://www.w3.org/TR/SVG/types.html#DataTypeLength)
  72. * - [CSS Length](https://www.w3.org/TR/css-values-3/#lengths)
  73. *
  74. * Since: 1.16
  75. **/
  76. typedef enum _cairo_svg_unit {
  77. CAIRO_SVG_UNIT_USER = 0,
  78. CAIRO_SVG_UNIT_EM,
  79. CAIRO_SVG_UNIT_EX,
  80. CAIRO_SVG_UNIT_PX,
  81. CAIRO_SVG_UNIT_IN,
  82. CAIRO_SVG_UNIT_CM,
  83. CAIRO_SVG_UNIT_MM,
  84. CAIRO_SVG_UNIT_PT,
  85. CAIRO_SVG_UNIT_PC,
  86. CAIRO_SVG_UNIT_PERCENT
  87. } cairo_svg_unit_t;
  88. cairo_public cairo_surface_t *
  89. cairo_svg_surface_create (const char *filename,
  90. double width_in_points,
  91. double height_in_points);
  92. cairo_public cairo_surface_t *
  93. cairo_svg_surface_create_for_stream (cairo_write_func_t write_func,
  94. void *closure,
  95. double width_in_points,
  96. double height_in_points);
  97. cairo_public void
  98. cairo_svg_surface_restrict_to_version (cairo_surface_t *surface,
  99. cairo_svg_version_t version);
  100. cairo_public void
  101. cairo_svg_get_versions (cairo_svg_version_t const **versions,
  102. int *num_versions);
  103. cairo_public const char *
  104. cairo_svg_version_to_string (cairo_svg_version_t version);
  105. cairo_public void
  106. cairo_svg_surface_set_document_unit (cairo_surface_t *surface,
  107. cairo_svg_unit_t unit);
  108. cairo_public cairo_svg_unit_t
  109. cairo_svg_surface_get_document_unit (cairo_surface_t *surface);
  110. CAIRO_END_DECLS
  111. #else /* CAIRO_HAS_SVG_SURFACE */
  112. # error Cairo was not compiled with support for the svg backend
  113. #endif /* CAIRO_HAS_SVG_SURFACE */
  114. #endif /* CAIRO_SVG_H */