cairo 1.8.5 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cairo might be problematic. Click here for more details.

Files changed (106) hide show
  1. data/NEWS +2 -2
  2. data/Rakefile +44 -7
  3. data/ext/cairo/cairo.def +28 -1
  4. data/ext/cairo/extconf.rb +14 -16
  5. data/ext/cairo/rb_cairo.c +4 -1
  6. data/ext/cairo/rb_cairo.h +65 -1
  7. data/ext/cairo/rb_cairo_constants.c +150 -3
  8. data/ext/cairo/rb_cairo_context.c +17 -0
  9. data/ext/cairo/rb_cairo_device.c +406 -0
  10. data/ext/cairo/rb_cairo_exception.c +83 -32
  11. data/ext/cairo/rb_cairo_io.c +166 -0
  12. data/ext/cairo/rb_cairo_io.h +44 -0
  13. data/ext/cairo/rb_cairo_matrix.c +1 -1
  14. data/ext/cairo/rb_cairo_private.h +3 -0
  15. data/ext/cairo/rb_cairo_region.c +385 -0
  16. data/ext/cairo/rb_cairo_surface.c +674 -199
  17. data/samples/blur.rb +2 -3
  18. data/samples/{pac2.rb → pac-nomralize.rb} +5 -6
  19. data/samples/pac-tee.rb +170 -0
  20. data/samples/pac.rb +2 -3
  21. data/samples/png.rb +2 -3
  22. data/samples/scalable.rb +2 -3
  23. data/samples/text-on-path.rb +2 -3
  24. data/samples/text2.rb +2 -3
  25. data/test/cairo-test-utils.rb +15 -0
  26. data/test/run-test.rb +5 -4
  27. data/test/test_context.rb +4 -4
  28. data/test/test_font_face.rb +34 -21
  29. data/test/test_recording_surface.rb +18 -0
  30. data/test/test_region.rb +102 -0
  31. data/test/test_script_device.rb +46 -0
  32. data/test/test_script_surface.rb +13 -0
  33. data/test/test_surface.rb +14 -4
  34. data/test/test_tee_surface.rb +32 -0
  35. data/test/test_xml_device.rb +22 -0
  36. data/test/test_xml_surface.rb +32 -0
  37. metadata +49 -77
  38. data/pkg-config.rb +0 -313
  39. data/test-unit/Rakefile +0 -30
  40. data/test-unit/bin/testrb +0 -5
  41. data/test-unit/lib/test/unit.rb +0 -280
  42. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
  43. data/test-unit/lib/test/unit/assertions.rb +0 -722
  44. data/test-unit/lib/test/unit/attribute.rb +0 -125
  45. data/test-unit/lib/test/unit/autorunner.rb +0 -254
  46. data/test-unit/lib/test/unit/collector.rb +0 -43
  47. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  48. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  49. data/test-unit/lib/test/unit/collector/load.rb +0 -135
  50. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  51. data/test-unit/lib/test/unit/color.rb +0 -61
  52. data/test-unit/lib/test/unit/diff.rb +0 -524
  53. data/test-unit/lib/test/unit/error.rb +0 -124
  54. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  55. data/test-unit/lib/test/unit/failure.rb +0 -110
  56. data/test-unit/lib/test/unit/fixture.rb +0 -185
  57. data/test-unit/lib/test/unit/notification.rb +0 -125
  58. data/test-unit/lib/test/unit/omission.rb +0 -143
  59. data/test-unit/lib/test/unit/pending.rb +0 -146
  60. data/test-unit/lib/test/unit/priority.rb +0 -146
  61. data/test-unit/lib/test/unit/runner/console.rb +0 -46
  62. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  63. data/test-unit/lib/test/unit/testcase.rb +0 -281
  64. data/test-unit/lib/test/unit/testresult.rb +0 -89
  65. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  66. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  67. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -195
  68. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
  69. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
  70. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  71. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  72. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  73. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  74. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  75. data/test-unit/lib/test/unit/version.rb +0 -7
  76. data/test-unit/sample/adder.rb +0 -13
  77. data/test-unit/sample/subtracter.rb +0 -12
  78. data/test-unit/sample/tc_adder.rb +0 -18
  79. data/test-unit/sample/tc_subtracter.rb +0 -18
  80. data/test-unit/sample/ts_examples.rb +0 -7
  81. data/test-unit/test/collector/test_descendant.rb +0 -135
  82. data/test-unit/test/collector/test_dir.rb +0 -406
  83. data/test-unit/test/collector/test_load.rb +0 -333
  84. data/test-unit/test/collector/test_objectspace.rb +0 -98
  85. data/test-unit/test/run-test.rb +0 -13
  86. data/test-unit/test/test_assertions.rb +0 -693
  87. data/test-unit/test/test_attribute.rb +0 -86
  88. data/test-unit/test/test_color.rb +0 -37
  89. data/test-unit/test/test_diff.rb +0 -477
  90. data/test-unit/test/test_emacs_runner.rb +0 -60
  91. data/test-unit/test/test_error.rb +0 -26
  92. data/test-unit/test/test_failure.rb +0 -33
  93. data/test-unit/test/test_fixture.rb +0 -252
  94. data/test-unit/test/test_notification.rb +0 -33
  95. data/test-unit/test/test_omission.rb +0 -81
  96. data/test-unit/test/test_pending.rb +0 -70
  97. data/test-unit/test/test_priority.rb +0 -89
  98. data/test-unit/test/test_testcase.rb +0 -430
  99. data/test-unit/test/test_testresult.rb +0 -113
  100. data/test-unit/test/test_testsuite.rb +0 -129
  101. data/test-unit/test/testunit_test_util.rb +0 -14
  102. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  103. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  104. data/test-unit/test/util/test_observable.rb +0 -102
  105. data/test-unit/test/util/test_procwrapper.rb +0 -36
  106. data/test/test_pkg_config.rb +0 -123
data/NEWS CHANGED
@@ -4,14 +4,14 @@ Release 1.8.5 (2010-08-28) Kouhei Sutou <kou@cozmixng.org>)
4
4
  Fixes
5
5
  -----
6
6
  * Fix build system. (patch by kimura watasu and suggested by OBATA Akio)
7
- * Fix Windows gem. (reported by Dominic Sisneros, supported by Masayas TARUI)
7
+ * Fix Windows gem. (reported by Dominic Sisneros, supported by Masaya TARUI)
8
8
 
9
9
  Thanks
10
10
  ------
11
11
  * Dominic Sisneros
12
12
  * kimura wataru
13
13
  * OBATA Akio
14
- * Masayas TARUI
14
+ * Masaya TARUI
15
15
 
16
16
  Release 1.8.3 (2010-08-26) Kouhei Sutou <kou@cozmixng.org>)
17
17
  ===========================================================
data/Rakefile CHANGED
@@ -78,6 +78,7 @@ project = Hoe.spec('cairo') do |project|
78
78
  :require_paths => ['lib'],
79
79
  :has_rdoc => false,
80
80
  }
81
+ project.extra_deps << ['pkg-config', '>= 0']
81
82
  platform = ENV["FORCE_PLATFORM"]
82
83
  project.spec_extras[:platform] = platform if platform
83
84
  news = File.join(base_dir, "NEWS")
@@ -89,19 +90,55 @@ end
89
90
 
90
91
  project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
91
92
 
93
+ binary_dir = File.join("vendor", "local")
92
94
  Rake::ExtensionTask.new("cairo", project.spec) do |ext|
93
95
  ext.cross_compile = true
96
+ ext.cross_compiling do |spec|
97
+ if /mingw|mswin/ =~ spec.platform.to_s
98
+ binary_files = []
99
+ Find.find(binary_dir) do |name|
100
+ next unless File.file?(name)
101
+ next if /\.zip\z/i =~ name
102
+ binary_files << name
103
+ end
104
+ spec.files += binary_files
105
+ end
106
+ end
107
+ end
108
+
109
+ task 'cross' => "download_windows_binaries"
110
+
111
+ def download_windows_binaries(binary_dir)
112
+ base_url = "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/"
113
+ dependencies = [
114
+ ["cairo", "1.10.0-1"],
115
+ ["cairo-dev", "1.10.0-1"],
116
+ ["libpng", "1.4.3-1"],
117
+ ["zlib", "1.2.5-2"],
118
+ ["expat", "2.0.1-1"],
119
+ ["fontconfig", "2.8.0-2"],
120
+ ["freetype", "2.4.2-1"],
121
+ ]
122
+ dependencies.each do |name, version|
123
+ file_name = "#{name}_#{version}_win32.zip"
124
+ full_file_name = File.join(binary_dir, file_name)
125
+ next if File.exist?(full_file_name)
126
+ open("#{base_url}#{file_name}", "rb") do |input|
127
+ File.open(full_file_name, "wb") do |output|
128
+ output.print(input.read)
129
+ end
130
+ end
131
+ sh("unzip", full_file_name, "-d", binary_dir)
132
+ end
94
133
  end
95
134
 
96
- task :add_win32_binaries do
97
- cairo_win32_dir = File.join("vendor", "local")
98
- cairo_files = []
99
- Find.find(cairo_win32_dir) do |f|
100
- cairo_files << f
135
+ task "download_windows_binaries" do
136
+ require 'open-uri'
137
+ unless File.exist?(binary_dir)
138
+ mkdir_p(binary_dir)
139
+ download_windows_binaries(binary_dir)
101
140
  end
102
- project.spec.files += cairo_files
103
141
  end
104
- task :cross => :add_win32_binaries
105
142
 
106
143
  # fix Hoe's incorrect guess.
107
144
  project.spec.executables.clear
@@ -9,6 +9,7 @@ EXPORTS
9
9
  rb_cCairo_PathCurveTo DATA
10
10
  rb_cCairo_PathClosePath DATA
11
11
  rb_cCairo_Matrix DATA
12
+ rb_cCairo_Region DATA
12
13
  rb_cCairo_Pattern DATA
13
14
  rb_cCairo_SolidPattern DATA
14
15
  rb_cCairo_SurfacePattern DATA
@@ -34,6 +35,24 @@ EXPORTS
34
35
  rb_cCairo_Win32PrintingSurface DATA
35
36
  rb_cCairo_QuartzSurface DATA
36
37
  rb_cCairo_QuartzImageSurface DATA
38
+ rb_cCairo_ScriptSurface DATA
39
+ rb_cCairo_QtSurface DATA
40
+ rb_cCairo_RecordingSurface DATA
41
+ rb_cCairo_VGSurface DATA
42
+ rb_cCairo_GLSurface DATA
43
+ rb_cCairo_GLTextureSurface DATA
44
+ rb_cCairo_DRMSurface DATA
45
+ rb_cCairo_TeeSurface DATA
46
+ rb_cCairo_XMLSurface DATA
47
+ rb_cCairo_SkiaSurface DATA
48
+ rb_cCairo_SubSurface DATA
49
+ rb_cCairo_Device DATA
50
+ rb_cCairo_DRMDevice DATA
51
+ rb_cCairo_GLDevice DATA
52
+ rb_cCairo_ScriptDevice DATA
53
+ rb_cCairo_XCBDevice DATA
54
+ rb_cCairo_XlibtDevice DATA
55
+ rb_cCairo_XMLDevice DATA
37
56
 
38
57
  rb_mCairo_Operator DATA
39
58
  rb_mCairo_Antialias DATA
@@ -52,7 +71,10 @@ EXPORTS
52
71
  rb_mCairo_Filter DATA
53
72
  rb_mCairo_SVGVersion DATA
54
73
  rb_mCairo_PSLevel DATA
55
- rb_mCairo_LCDFilter DATA
74
+ rb_mCairo_PDFVersion DATA
75
+ rb_mCairo_TextClusterFlag DATA
76
+ rb_mCairo_ScriptMode DATA
77
+ rb_mCairo_MimeType DATA
56
78
 
57
79
  rb_mCairo_Color DATA
58
80
  rb_cCairo_Color_Base DATA
@@ -64,6 +86,8 @@ EXPORTS
64
86
  rb_cairo_path_to_ruby_object
65
87
  rb_cairo_matrix_from_ruby_object
66
88
  rb_cairo_matrix_to_ruby_object
89
+ rb_cairo_region_from_ruby_object
90
+ rb_cairo_region_to_ruby_object
67
91
  rb_cairo_pattern_from_ruby_object
68
92
  rb_cairo_pattern_to_ruby_object
69
93
  rb_cairo_font_face_from_ruby_object
@@ -83,6 +107,8 @@ EXPORTS
83
107
  rb_cairo_surface_from_ruby_object
84
108
  rb_cairo_surface_to_ruby_object
85
109
  rb_cairo_surface_to_ruby_object_with_destroy
110
+ rb_cairo_device_from_ruby_object
111
+ rb_cairo_device_to_ruby_object
86
112
  rb_cairo_operator_from_ruby_object
87
113
  rb_cairo_antialias_from_ruby_object
88
114
  rb_cairo_fill_rule_from_ruby_object
@@ -100,5 +126,6 @@ EXPORTS
100
126
  rb_cairo_filter_from_ruby_object
101
127
  rb_cairo_svg_version_from_ruby_object
102
128
  rb_cairo_ps_level_from_ruby_object
129
+ rb_cairo_pdf_version_from_ruby_object
103
130
  rb_cairo_text_cluster_flags_from_ruby_object
104
131
  rb_cairo_check_status
@@ -6,10 +6,12 @@ require 'English'
6
6
  require 'mkmf'
7
7
  require 'fileutils'
8
8
 
9
- base_dir = (Pathname(__FILE__).dirname + ".." + "..").expand_path
10
- $LOAD_PATH.unshift(base_dir.to_s)
11
-
12
- require 'pkg-config'
9
+ begin
10
+ require 'pkg-config'
11
+ rescue LoadError
12
+ require 'rubygems'
13
+ require 'pkg-config'
14
+ end
13
15
 
14
16
  checking_for(checking_message("GCC")) do
15
17
  if macro_defined?("__GNUC__", "")
@@ -24,8 +26,7 @@ package = "cairo"
24
26
  module_name = "cairo"
25
27
  major, minor, micro = 1, 2, 0
26
28
 
27
- PKGConfig.have_package(package, major, minor, micro) or exit 1
28
-
29
+ base_dir = Pathname(__FILE__).dirname.parent.parent
29
30
  checking_for(checking_message("Win32 OS")) do
30
31
  case RUBY_PLATFORM
31
32
  when /cygwin|mingw|mswin32/
@@ -33,16 +34,11 @@ checking_for(checking_message("Win32 OS")) do
33
34
  import_library_name = "libruby-#{module_name}.a"
34
35
  $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
35
36
  $cleanfiles << import_library_name
36
- local_cairo_install_dir = base_dir + "vendor" + "local"
37
- $CFLAGS += " -I#{local_cairo_install_dir}/include"
38
- local_cairo_lib_dir = local_cairo_install_dir + "lib"
39
- ["cairo.lib", "libcairo.dll.a"].each do |libcairo_base|
40
- libcairo = local_cairo_lib_dir + libcairo_base
41
- if libcairo.exist?
42
- $LDFLAGS += " -L#{local_cairo_lib_dir}"
43
- break
44
- end
45
- end
37
+ binary_base_dir = base_dir + "vendor" + "local"
38
+ $CFLAGS += " -I#{binary_base_dir}/include"
39
+ pkg_config_dir = binary_base_dir + "lib" + "pkgconfig"
40
+ PKGConfig.add_path(pkg_config_dir.to_s)
41
+ PKGConfig.set_override_variable("prefix", binary_base_dir.to_s)
46
42
  true
47
43
  else
48
44
  false
@@ -70,6 +66,8 @@ checking_for(checking_message("Mac OS X")) do
70
66
  end
71
67
  end
72
68
 
69
+ PKGConfig.have_package(package, major, minor, micro) or exit 1
70
+
73
71
  $defs << "-DRB_CAIRO_COMPILATION"
74
72
 
75
73
  have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
@@ -76,7 +76,7 @@ Init_cairo ()
76
76
 
77
77
  rb_define_const (rb_mCairo, "BINDINGS_VERSION",
78
78
  rb_ary_new3 (4,
79
- INT2FIX (1), INT2FIX (8), INT2FIX (5), Qnil));
79
+ INT2FIX (1), INT2FIX (10), INT2FIX (0), Qnil));
80
80
 
81
81
  rb_define_module_function (rb_mCairo, "satisfied_version?",
82
82
  rb_cairo_satisfied_version, -1);
@@ -86,11 +86,14 @@ Init_cairo ()
86
86
  rb_cCairo_Paper = rb_const_get (rb_mCairo, rb_intern ("Paper"));
87
87
 
88
88
  Init_cairo_private ();
89
+ Init_cairo_io ();
89
90
  Init_cairo_constants ();
90
91
 
91
92
  Init_cairo_context ();
92
93
  Init_cairo_path ();
93
94
  Init_cairo_matrix ();
95
+ Init_cairo_region ();
96
+ Init_cairo_device ();
94
97
  Init_cairo_surface ();
95
98
  Init_cairo_exception ();
96
99
  Init_cairo_font ();
@@ -31,6 +31,10 @@
31
31
  # include <cairo-svg.h>
32
32
  #endif
33
33
 
34
+ #ifdef CAIRO_HAS_SCRIPT_SURFACE
35
+ # include <cairo-script.h>
36
+ #endif
37
+
34
38
  #define CAIRO_CHECK_VERSION(major, minor, micro) \
35
39
  (CAIRO_VERSION_MAJOR > (major) || \
36
40
  (CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR > (minor)) || \
@@ -77,6 +81,7 @@ RB_CAIRO_VAR VALUE rb_cCairo_PathLineTo;
77
81
  RB_CAIRO_VAR VALUE rb_cCairo_PathCurveTo;
78
82
  RB_CAIRO_VAR VALUE rb_cCairo_PathClosePath;
79
83
  RB_CAIRO_VAR VALUE rb_cCairo_Matrix;
84
+ RB_CAIRO_VAR VALUE rb_cCairo_Region;
80
85
  RB_CAIRO_VAR VALUE rb_cCairo_Pattern;
81
86
  RB_CAIRO_VAR VALUE rb_cCairo_SolidPattern;
82
87
  RB_CAIRO_VAR VALUE rb_cCairo_SurfacePattern;
@@ -103,6 +108,24 @@ RB_CAIRO_VAR VALUE rb_cCairo_Win32PrintingSurface;
103
108
  #define rb_cCairo_WIN32Surface rb_cCairo_Win32Surface
104
109
  RB_CAIRO_VAR VALUE rb_cCairo_QuartzSurface;
105
110
  RB_CAIRO_VAR VALUE rb_cCairo_QuartzImageSurface;
111
+ RB_CAIRO_VAR VALUE rb_cCairo_ScriptSurface;
112
+ RB_CAIRO_VAR VALUE rb_cCairo_QtSurface;
113
+ RB_CAIRO_VAR VALUE rb_cCairo_RecordingSurface;
114
+ RB_CAIRO_VAR VALUE rb_cCairo_VGSurface;
115
+ RB_CAIRO_VAR VALUE rb_cCairo_GLSurface;
116
+ RB_CAIRO_VAR VALUE rb_cCairo_GLTextureSurface;
117
+ RB_CAIRO_VAR VALUE rb_cCairo_DRMSurface;
118
+ RB_CAIRO_VAR VALUE rb_cCairo_TeeSurface;
119
+ RB_CAIRO_VAR VALUE rb_cCairo_XMLSurface;
120
+ RB_CAIRO_VAR VALUE rb_cCairo_SkiaSurface;
121
+ RB_CAIRO_VAR VALUE rb_cCairo_SubSurface;
122
+ RB_CAIRO_VAR VALUE rb_cCairo_Device;
123
+ RB_CAIRO_VAR VALUE rb_cCairo_DRMDevice;
124
+ RB_CAIRO_VAR VALUE rb_cCairo_GLDevice;
125
+ RB_CAIRO_VAR VALUE rb_cCairo_ScriptDevice;
126
+ RB_CAIRO_VAR VALUE rb_cCairo_XCBDevice;
127
+ RB_CAIRO_VAR VALUE rb_cCairo_XlibtDevice;
128
+ RB_CAIRO_VAR VALUE rb_cCairo_XMLDevice;
106
129
 
107
130
  RB_CAIRO_VAR VALUE rb_mCairo_Operator;
108
131
  RB_CAIRO_VAR VALUE rb_mCairo_Antialias;
@@ -124,8 +147,12 @@ RB_CAIRO_VAR VALUE rb_mCairo_Extend;
124
147
  RB_CAIRO_VAR VALUE rb_mCairo_Filter;
125
148
  RB_CAIRO_VAR VALUE rb_mCairo_SVGVersion;
126
149
  RB_CAIRO_VAR VALUE rb_mCairo_PSLevel;
127
- RB_CAIRO_VAR VALUE rb_mCairo_LCDFilter;
150
+ RB_CAIRO_VAR VALUE rb_mCairo_PDFVersion;
128
151
  RB_CAIRO_VAR VALUE rb_mCairo_SVGVersion;
152
+ RB_CAIRO_VAR VALUE rb_mCairo_TextClusterFlag;
153
+ RB_CAIRO_VAR VALUE rb_mCairo_ScriptMode;
154
+ RB_CAIRO_VAR VALUE rb_mCairo_MimeType;
155
+ RB_CAIRO_VAR VALUE rb_mCairo_RegionOverlap;
129
156
  RB_CAIRO_VAR VALUE rb_mCairo_Color;
130
157
  RB_CAIRO_VAR VALUE rb_cCairo_Color_Base;
131
158
  RB_CAIRO_VAR VALUE rb_cCairo_Paper;
@@ -140,6 +167,9 @@ RB_CAIRO_VAR VALUE rb_cCairo_Paper;
140
167
  #define RVAL2CRMATRIX(obj) (rb_cairo_matrix_from_ruby_object(obj))
141
168
  #define CRMATRIX2RVAL(matrix) (rb_cairo_matrix_to_ruby_object(matrix))
142
169
 
170
+ #define RVAL2CRREGION(obj) (rb_cairo_region_from_ruby_object(obj))
171
+ #define CRREGION2RVAL(region) (rb_cairo_region_to_ruby_object(region))
172
+
143
173
  #define RVAL2CRPATTERN(obj) (rb_cairo_pattern_from_ruby_object(obj))
144
174
  #define CRPATTERN2RVAL(pattern) (rb_cairo_pattern_to_ruby_object(pattern))
145
175
 
@@ -169,6 +199,9 @@ RB_CAIRO_VAR VALUE rb_cCairo_Paper;
169
199
  #define CRSURFACE2RVAL_WITH_DESTROY(surface) \
170
200
  (rb_cairo_surface_to_ruby_object_with_destroy(surface))
171
201
 
202
+ #define RVAL2CRDEVICE(obj) (rb_cairo_device_from_ruby_object(obj))
203
+ #define CRDEVICE2RVAL(device) (rb_cairo_device_to_ruby_object(device))
204
+
172
205
  cairo_t *rb_cairo_context_from_ruby_object (VALUE obj);
173
206
  VALUE rb_cairo_context_to_ruby_object (cairo_t *cr);
174
207
 
@@ -178,6 +211,11 @@ VALUE rb_cairo_path_to_ruby_object (cairo_path_t *path
178
211
  cairo_matrix_t *rb_cairo_matrix_from_ruby_object (VALUE obj);
179
212
  VALUE rb_cairo_matrix_to_ruby_object (cairo_matrix_t *matrix);
180
213
 
214
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
215
+ cairo_region_t *rb_cairo_region_from_ruby_object (VALUE obj);
216
+ VALUE rb_cairo_region_to_ruby_object (cairo_region_t *region);
217
+ #endif
218
+
181
219
  cairo_pattern_t *rb_cairo_pattern_from_ruby_object (VALUE obj);
182
220
  VALUE rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pat);
183
221
 
@@ -209,6 +247,10 @@ VALUE rb_cairo_surface_to_ruby_object (cairo_surface_t *s
209
247
  VALUE rb_cairo_surface_to_ruby_object_with_destroy
210
248
  (cairo_surface_t *surface);
211
249
 
250
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
251
+ cairo_device_t *rb_cairo_device_from_ruby_object (VALUE obj);
252
+ VALUE rb_cairo_device_to_ruby_object (cairo_device_t *device);
253
+ #endif
212
254
 
213
255
  #define RVAL2CROPERATOR(obj) (rb_cairo_operator_from_ruby_object(obj))
214
256
  #define RVAL2CRANTIALIAS(obj) (rb_cairo_antialias_from_ruby_object(obj))
@@ -233,9 +275,20 @@ VALUE rb_cairo_surface_to_ruby_object_with_destroy
233
275
  #define RVAL2CRPSLEVEL(obj) (rb_cairo_ps_level_from_ruby_object(obj))
234
276
  # endif
235
277
  #endif
278
+ #ifdef CAIRO_HAS_PDF_SURFACE
279
+ # if CAIRO_CHECK_VERSION(1, 10, 0)
280
+ #define RVAL2CRPDFVERSION(obj) (rb_cairo_pdf_version_from_ruby_object(obj))
281
+ # endif
282
+ #endif
236
283
  #if CAIRO_CHECK_VERSION(1, 7, 6)
237
284
  #define RVAL2CRTEXTCLUSTERFLAGS(obj) (rb_cairo_text_cluster_flags_from_ruby_object(obj))
238
285
  #endif
286
+ #ifdef CAIRO_HAS_SCRIPT_SURFACE
287
+ #define RVAL2CRSCRIPTMODE(obj) (rb_cairo_script_mode_from_ruby_object(obj))
288
+ #endif
289
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
290
+ #define RVAL2CRREGIONOVERLAP(obj) (rb_cairo_region_overalap_from_ruby_object(obj))
291
+ #endif
239
292
 
240
293
  cairo_operator_t rb_cairo_operator_from_ruby_object (VALUE obj);
241
294
  cairo_antialias_t rb_cairo_antialias_from_ruby_object (VALUE obj);
@@ -260,9 +313,20 @@ cairo_svg_version_t rb_cairo_svg_version_from_ruby_object (VALUE obj);
260
313
  cairo_ps_level_t rb_cairo_ps_level_from_ruby_object (VALUE obj);
261
314
  # endif
262
315
  #endif
316
+ #ifdef CAIRO_HAS_PDF_SURFACE
317
+ # if CAIRO_CHECK_VERSION(1, 10, 0)
318
+ cairo_pdf_version_t rb_cairo_pdf_version_from_ruby_object (VALUE obj);
319
+ # endif
320
+ #endif
263
321
  #if CAIRO_CHECK_VERSION(1, 7, 6)
264
322
  cairo_text_cluster_flags_t rb_cairo_text_cluster_flags_from_ruby_object (VALUE obj);
265
323
  #endif
324
+ #ifdef CAIRO_HAS_SCRIPT_SURFACE
325
+ cairo_script_mode_t rb_cairo_script_mode_from_ruby_object (VALUE obj);
326
+ #endif
327
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
328
+ cairo_region_overlap_t rb_cairo_region_overlap_from_ruby_object(VALUE obj);
329
+ #endif
266
330
 
267
331
  void rb_cairo_check_status (cairo_status_t status);
268
332
 
@@ -5,6 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-19 12:56:27 $
7
7
  *
8
+ * Copyright 2005-2010 Kouhei Sutou <kou@cozmixng.org>
8
9
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
9
10
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
10
11
  *
@@ -34,6 +35,10 @@ VALUE rb_mCairo_Filter;
34
35
  VALUE rb_mCairo_SVGVersion = Qnil;
35
36
  VALUE rb_mCairo_PSLevel = Qnil;
36
37
  VALUE rb_mCairo_TextClusterFlag = Qnil;
38
+ VALUE rb_mCairo_PDFVersion = Qnil;
39
+ VALUE rb_mCairo_ScriptMode = Qnil;
40
+ VALUE rb_mCairo_MimeType = Qnil;
41
+ VALUE rb_mCairo_RegionOverlap = Qnil;
37
42
 
38
43
  #define CAIRO_OPERATOR_MIN CAIRO_OPERATOR_CLEAR
39
44
  #define CAIRO_OPERATOR_MAX CAIRO_OPERATOR_SATURATE
@@ -72,7 +77,7 @@ VALUE rb_mCairo_TextClusterFlag = Qnil;
72
77
  #define CAIRO_CONTENT_MAX CAIRO_CONTENT_COLOR_ALPHA
73
78
 
74
79
  #define CAIRO_FORMAT_MIN CAIRO_FORMAT_ARGB32
75
- #define CAIRO_FORMAT_MAX CAIRO_FORMAT_A1
80
+ #define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB16_565
76
81
 
77
82
  #define CAIRO_EXTEND_MIN CAIRO_EXTEND_NONE
78
83
  #define CAIRO_EXTEND_MAX CAIRO_EXTEND_REFLECT
@@ -86,9 +91,18 @@ VALUE rb_mCairo_TextClusterFlag = Qnil;
86
91
  #define CAIRO_PS_LEVEL_MIN CAIRO_PS_LEVEL_2
87
92
  #define CAIRO_PS_LEVEL_MAX CAIRO_PS_LEVEL_3
88
93
 
94
+ #define CAIRO_PDF_VERSION_MIN CAIRO_PDF_VERSION_1_4
95
+ #define CAIRO_PDF_VERSION_MAX CAIRO_PDF_VERSION_1_5
96
+
89
97
  #define CAIRO_TEXT_CLUSTER_FLAG_MIN 0
90
98
  #define CAIRO_TEXT_CLUSTER_FLAG_MAX CAIRO_TEXT_CLUSTER_FLAG_BACKWARD
91
99
 
100
+ #define CAIRO_SCRIPT_MODE_MIN CAIRO_SCRIPT_MODE_BINARY
101
+ #define CAIRO_SCRIPT_MODE_MAX CAIRO_SCRIPT_MODE_ASCII
102
+
103
+ #define CAIRO_REGION_OVERLAP_MIN CAIRO_REGION_OVERLAP_IN
104
+ #define CAIRO_REGION_OVERLAP_MAX CAIRO_REGION_OVERLAP_PART
105
+
92
106
  #define DEFINE_RVAL2ENUM(name, const_name) \
93
107
  cairo_ ## name ## _t \
94
108
  rb_cairo_ ## name ## _from_ruby_object (VALUE rb_ ## name) \
@@ -139,10 +153,25 @@ DEFINE_RVAL2ENUM(ps_level, PS_LEVEL)
139
153
  # endif
140
154
  #endif
141
155
 
156
+ #ifdef CAIRO_HAS_PDF_SURFACE
157
+ # if CAIRO_CHECK_VERSION(1, 10, 0)
158
+ DEFINE_RVAL2ENUM(pdf_version, PDF_VERSION)
159
+ #define PDF_VERSION_ENUM_DEFINED 1
160
+ # endif
161
+ #endif
162
+
142
163
  #if CAIRO_CHECK_VERSION(1, 7, 6)
143
164
  DEFINE_RVAL2ENUM(text_cluster_flags, TEXT_CLUSTER_FLAG)
144
165
  #endif
145
166
 
167
+ #ifdef CAIRO_HAS_SCRIPT_SURFACE
168
+ DEFINE_RVAL2ENUM(script_mode, SCRIPT_MODE)
169
+ #endif
170
+
171
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
172
+ DEFINE_RVAL2ENUM(region_overlap, REGION_OVERLAP)
173
+ #endif
174
+
146
175
  #if defined(RB_CAIRO_PLATFORM_WIN32) && !defined(PS_LEVEL_ENUM_DEFINED)
147
176
  void
148
177
  rb_cairo_ps_level_from_ruby_object (VALUE rb_ps_level)
@@ -236,6 +265,43 @@ cr_ps_level_to_string (int argc, VALUE *argv, VALUE self)
236
265
  # endif
237
266
  #endif
238
267
 
268
+ #ifdef CAIRO_HAS_PDF_SURFACE
269
+ # if CAIRO_CHECK_VERSION(1, 10, 0)
270
+ static VALUE
271
+ cr_pdf_get_versions (VALUE self)
272
+ {
273
+ VALUE rb_versions;
274
+ const cairo_pdf_version_t *versions;
275
+ int i, n_versions;
276
+
277
+ cairo_pdf_get_versions (&versions, &n_versions);
278
+
279
+ rb_versions = rb_ary_new2 (n_versions);
280
+ for (i = 0; i < n_versions; i++)
281
+ {
282
+ rb_ary_push (rb_versions, INT2NUM (versions[i]));
283
+ }
284
+
285
+ return rb_versions;
286
+ }
287
+
288
+ static VALUE
289
+ cr_pdf_version_to_string (int argc, VALUE *argv, VALUE self)
290
+ {
291
+ if (argc == 0)
292
+ {
293
+ return rb_call_super (argc, argv);
294
+ }
295
+ else
296
+ {
297
+ VALUE version;
298
+ rb_scan_args (argc, argv, "1", &version);
299
+ return rb_str_new2 (cairo_pdf_version_to_string (RVAL2CRPDFVERSION (version)));
300
+ }
301
+ }
302
+ # endif
303
+ #endif
304
+
239
305
  void
240
306
  Init_cairo_constants (void)
241
307
  {
@@ -273,6 +339,38 @@ Init_cairo_constants (void)
273
339
  rb_define_const (rb_mCairo_Operator, "SATURATE",
274
340
  INT2FIX (CAIRO_OPERATOR_SATURATE));
275
341
 
342
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
343
+ rb_define_const (rb_mCairo_Operator, "MULTIPLY",
344
+ INT2FIX (CAIRO_OPERATOR_MULTIPLY));
345
+ rb_define_const (rb_mCairo_Operator, "SCREEN",
346
+ INT2FIX (CAIRO_OPERATOR_SCREEN));
347
+ rb_define_const (rb_mCairo_Operator, "OVERLAY",
348
+ INT2FIX (CAIRO_OPERATOR_OVERLAY));
349
+ rb_define_const (rb_mCairo_Operator, "DARKEN",
350
+ INT2FIX (CAIRO_OPERATOR_DARKEN));
351
+ rb_define_const (rb_mCairo_Operator, "LIGHTEN",
352
+ INT2FIX (CAIRO_OPERATOR_LIGHTEN));
353
+ rb_define_const (rb_mCairo_Operator, "COLOR_DODGE",
354
+ INT2FIX (CAIRO_OPERATOR_COLOR_DODGE));
355
+ rb_define_const (rb_mCairo_Operator, "COLOR_BURN",
356
+ INT2FIX (CAIRO_OPERATOR_COLOR_BURN));
357
+ rb_define_const (rb_mCairo_Operator, "HARD_LIGHT",
358
+ INT2FIX (CAIRO_OPERATOR_HARD_LIGHT));
359
+ rb_define_const (rb_mCairo_Operator, "SOFT_LIGHT",
360
+ INT2FIX (CAIRO_OPERATOR_SOFT_LIGHT));
361
+ rb_define_const (rb_mCairo_Operator, "DIFFERENCE",
362
+ INT2FIX (CAIRO_OPERATOR_DIFFERENCE));
363
+ rb_define_const (rb_mCairo_Operator, "EXCLUSION",
364
+ INT2FIX (CAIRO_OPERATOR_EXCLUSION));
365
+ rb_define_const (rb_mCairo_Operator, "HSL_HUE",
366
+ INT2FIX (CAIRO_OPERATOR_HSL_HUE));
367
+ rb_define_const (rb_mCairo_Operator, "HSL_SATURATION",
368
+ INT2FIX (CAIRO_OPERATOR_HSL_SATURATION));
369
+ rb_define_const (rb_mCairo_Operator, "HSL_COLOR",
370
+ INT2FIX (CAIRO_OPERATOR_HSL_COLOR));
371
+ rb_define_const (rb_mCairo_Operator, "HSL_LUMINOSITY",
372
+ INT2FIX (CAIRO_OPERATOR_HSL_LUMINOSITY));
373
+ #endif
276
374
 
277
375
  /* cairo_antialias_t */
278
376
  rb_mCairo_Antialias = rb_define_module_under (rb_mCairo, "Antialias");
@@ -394,6 +492,10 @@ Init_cairo_constants (void)
394
492
 
395
493
  /* cairo_format_t */
396
494
  rb_mCairo_Format = rb_define_module_under (rb_mCairo, "Format");
495
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
496
+ rb_define_const (rb_mCairo_Format, "INVALID",
497
+ INT2FIX (CAIRO_FORMAT_INVALID));
498
+ #endif
397
499
  rb_define_const (rb_mCairo_Format, "ARGB32",
398
500
  INT2FIX (CAIRO_FORMAT_ARGB32));
399
501
  rb_define_const (rb_mCairo_Format, "RGB24",
@@ -402,10 +504,8 @@ Init_cairo_constants (void)
402
504
  INT2FIX (CAIRO_FORMAT_A8));
403
505
  rb_define_const (rb_mCairo_Format, "A1",
404
506
  INT2FIX (CAIRO_FORMAT_A1));
405
- #if !CAIRO_CHECK_VERSION(1, 3, 0)
406
507
  rb_define_const (rb_mCairo_Format, "RGB16_565",
407
508
  INT2FIX (CAIRO_FORMAT_RGB16_565));
408
- #endif
409
509
 
410
510
  #if CAIRO_CHECK_VERSION(1, 5, 8)
411
511
  rb_define_singleton_method (rb_mCairo_Format, "stride_for_width",
@@ -468,6 +568,22 @@ Init_cairo_constants (void)
468
568
  # endif
469
569
  #endif
470
570
 
571
+ #ifdef CAIRO_HAS_PDF_SURFACE
572
+ # if CAIRO_CHECK_VERSION(1, 10, 0)
573
+ /* cairo_pdf_version_t */
574
+ rb_mCairo_PDFVersion = rb_define_module_under (rb_mCairo, "PDFVersion");
575
+ rb_define_const (rb_mCairo_PDFVersion, "VERSION_1_4",
576
+ INT2FIX (CAIRO_PDF_VERSION_1_4));
577
+ rb_define_const (rb_mCairo_PDFVersion, "VERSION_1_5",
578
+ INT2FIX (CAIRO_PDF_VERSION_1_5));
579
+
580
+ rb_define_singleton_method (rb_mCairo_PDFVersion, "list",
581
+ cr_pdf_get_versions, 0);
582
+ rb_define_singleton_method (rb_mCairo_PDFVersion, "name",
583
+ cr_pdf_version_to_string, -1);
584
+ # endif
585
+ #endif
586
+
471
587
  #if CAIRO_CHECK_VERSION(1, 7, 6)
472
588
  /* cairo_text_cluster_flags_t */
473
589
  rb_mCairo_TextClusterFlag =
@@ -475,4 +591,35 @@ Init_cairo_constants (void)
475
591
  rb_define_const (rb_mCairo_TextClusterFlag, "BACKWARD",
476
592
  INT2FIX (CAIRO_TEXT_CLUSTER_FLAG_BACKWARD));
477
593
  #endif
594
+
595
+ #ifdef CAIRO_HAS_SCRIPT_SURFACE
596
+ /* cairo_script_mode_t */
597
+ rb_mCairo_ScriptMode = rb_define_module_under (rb_mCairo, "ScriptMode");
598
+ rb_define_const (rb_mCairo_ScriptMode, "BINARY",
599
+ INT2FIX (CAIRO_SCRIPT_MODE_BINARY));
600
+ rb_define_const (rb_mCairo_ScriptMode, "ASCII",
601
+ INT2FIX (CAIRO_SCRIPT_MODE_ASCII));
602
+ #endif
603
+
604
+ #if CAIRO_CHECK_VERSION(1, 10, 0)
605
+ rb_mCairo_MimeType = rb_define_module_under (rb_mCairo, "MimeType");
606
+
607
+ rb_define_const (rb_mCairo_MimeType, "JPEG",
608
+ rb_str_new2 (CAIRO_MIME_TYPE_JPEG));
609
+ rb_define_const (rb_mCairo_MimeType, "PNG",
610
+ rb_str_new2 (CAIRO_MIME_TYPE_PNG));
611
+ rb_define_const (rb_mCairo_MimeType, "JP2",
612
+ rb_str_new2 (CAIRO_MIME_TYPE_JP2));
613
+ rb_define_const (rb_mCairo_MimeType, "URI",
614
+ rb_str_new2 (CAIRO_MIME_TYPE_URI));
615
+
616
+ rb_mCairo_RegionOverlap = rb_define_module_under (rb_mCairo, "RegionOverlap");
617
+
618
+ rb_define_const (rb_mCairo_RegionOverlap, "IN",
619
+ INT2FIX (CAIRO_REGION_OVERLAP_IN));
620
+ rb_define_const (rb_mCairo_RegionOverlap, "OUT",
621
+ INT2FIX (CAIRO_REGION_OVERLAP_OUT));
622
+ rb_define_const (rb_mCairo_RegionOverlap, "PART",
623
+ INT2FIX (CAIRO_REGION_OVERLAP_PART));
624
+ #endif
478
625
  }