cairo 1.14.1-x86-mingw32 → 1.14.2-x86-mingw32
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.
- checksums.yaml +4 -4
- data/NEWS +21 -0
- data/Rakefile +18 -7
- data/ext/cairo/cairo.def +1 -0
- data/ext/cairo/extconf.rb +23 -10
- data/ext/cairo/rb_cairo.c +3 -0
- data/ext/cairo/rb_cairo.h +3 -3
- data/ext/cairo/rb_cairo_context.c +1 -1
- data/ext/cairo/rb_cairo_io.c +4 -0
- data/ext/cairo/rb_cairo_io.h +2 -0
- data/ext/cairo/rb_cairo_pattern.c +4 -4
- data/ext/cairo/rb_cairo_private.h +2 -0
- data/ext/cairo/rb_cairo_surface.c +64 -232
- data/lib/2.0/cairo.so +0 -0
- data/lib/2.1/cairo.so +0 -0
- data/lib/2.2/cairo.so +0 -0
- data/lib/cairo.rb +20 -19
- data/lib/cairo/region.rb +14 -0
- data/test/test_region.rb +26 -0
- data/vendor/local/bin/fc-cache.exe +0 -0
- data/vendor/local/bin/fc-cat.exe +0 -0
- data/vendor/local/bin/fc-list.exe +0 -0
- data/vendor/local/bin/fc-match.exe +0 -0
- data/vendor/local/bin/fc-pattern.exe +0 -0
- data/vendor/local/bin/fc-query.exe +0 -0
- data/vendor/local/bin/fc-scan.exe +0 -0
- data/vendor/local/bin/fc-validate.exe +0 -0
- data/vendor/local/bin/freetype-config +2 -2
- data/vendor/local/bin/libcairo-2.dll +0 -0
- data/vendor/local/bin/libcairo-gobject-2.dll +0 -0
- data/vendor/local/bin/libcairo-script-interpreter-2.dll +0 -0
- data/vendor/local/bin/libfontconfig-1.dll +0 -0
- data/vendor/local/bin/libfreetype-6.dll +0 -0
- data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
- data/vendor/local/bin/libpixman-1-0.dll +0 -0
- data/vendor/local/bin/libpng-config +1 -1
- data/vendor/local/bin/libpng16-16.dll +0 -0
- data/vendor/local/bin/libpng16-config +1 -1
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/libwinpthread-1.dll +0 -0
- data/vendor/local/bin/libxml2-2.dll +0 -0
- data/vendor/local/bin/png-fix-itxt.exe +0 -0
- data/vendor/local/bin/pngfix.exe +0 -0
- data/vendor/local/bin/xmlcatalog.exe +0 -0
- data/vendor/local/bin/xmllint.exe +0 -0
- data/vendor/local/bin/zlib1.dll +0 -0
- data/vendor/local/include/cairo/cairo-version.h +1 -1
- data/vendor/local/include/freetype2/config/ftconfig.h +19 -2
- data/vendor/local/include/freetype2/config/ftheader.h +7 -5
- data/vendor/local/include/freetype2/config/ftoption.h +9 -22
- data/vendor/local/include/freetype2/config/ftstdlib.h +2 -3
- data/vendor/local/include/freetype2/freetype.h +38 -17
- data/vendor/local/include/freetype2/ft2build.h +1 -1
- data/vendor/local/include/freetype2/ftadvanc.h +2 -2
- data/vendor/local/include/freetype2/ftautoh.h +50 -2
- data/vendor/local/include/freetype2/ftbbox.h +1 -1
- data/vendor/local/include/freetype2/ftbdf.h +1 -1
- data/vendor/local/include/freetype2/ftbitmap.h +11 -3
- data/vendor/local/include/freetype2/ftbzip2.h +1 -1
- data/vendor/local/include/freetype2/ftcache.h +3 -3
- data/vendor/local/include/freetype2/ftcffdrv.h +1 -1
- data/vendor/local/include/freetype2/ftcid.h +2 -1
- data/vendor/local/include/freetype2/fterrdef.h +1 -1
- data/vendor/local/include/freetype2/fterrors.h +1 -1
- data/vendor/local/include/freetype2/{ftxf86.h → ftfntfmt.h} +22 -14
- data/vendor/local/include/freetype2/ftgasp.h +1 -1
- data/vendor/local/include/freetype2/ftglyph.h +1 -1
- data/vendor/local/include/freetype2/ftgxval.h +1 -1
- data/vendor/local/include/freetype2/ftgzip.h +1 -1
- data/vendor/local/include/freetype2/ftimage.h +7 -13
- data/vendor/local/include/freetype2/ftincrem.h +1 -1
- data/vendor/local/include/freetype2/ftlcdfil.h +2 -2
- data/vendor/local/include/freetype2/ftlist.h +1 -1
- data/vendor/local/include/freetype2/ftlzw.h +1 -1
- data/vendor/local/include/freetype2/ftmac.h +1 -1
- data/vendor/local/include/freetype2/ftmm.h +17 -11
- data/vendor/local/include/freetype2/ftmodapi.h +4 -2
- data/vendor/local/include/freetype2/ftmoderr.h +1 -1
- data/vendor/local/include/freetype2/ftotval.h +1 -1
- data/vendor/local/include/freetype2/ftoutln.h +1 -1
- data/vendor/local/include/freetype2/ftpfr.h +1 -1
- data/vendor/local/include/freetype2/ftrender.h +3 -8
- data/vendor/local/include/freetype2/ftsizes.h +1 -1
- data/vendor/local/include/freetype2/ftsnames.h +1 -1
- data/vendor/local/include/freetype2/ftstroke.h +1 -1
- data/vendor/local/include/freetype2/ftsynth.h +5 -3
- data/vendor/local/include/freetype2/ftsystem.h +10 -1
- data/vendor/local/include/freetype2/fttrigon.h +1 -1
- data/vendor/local/include/freetype2/ftttdrv.h +85 -22
- data/vendor/local/include/freetype2/fttypes.h +1 -1
- data/vendor/local/include/freetype2/ftwinfnt.h +3 -3
- data/vendor/local/include/freetype2/t1tables.h +4 -3
- data/vendor/local/include/freetype2/ttnameid.h +116 -116
- data/vendor/local/include/freetype2/tttables.h +2 -2
- data/vendor/local/include/freetype2/tttags.h +1 -1
- data/vendor/local/include/freetype2/ttunpat.h +1 -1
- data/vendor/local/include/libpng16/png.h +63 -80
- data/vendor/local/include/libpng16/pngconf.h +8 -30
- data/vendor/local/include/libpng16/pnglibconf.h +10 -4
- data/vendor/local/include/png.h +63 -80
- data/vendor/local/include/pngconf.h +8 -30
- data/vendor/local/include/pnglibconf.h +10 -4
- data/vendor/local/lib/libcairo-gobject.a +0 -0
- data/vendor/local/lib/libcairo-gobject.dll.a +0 -0
- data/vendor/local/lib/libcairo-gobject.la +2 -2
- data/vendor/local/lib/libcairo-script-interpreter.a +0 -0
- data/vendor/local/lib/libcairo-script-interpreter.dll.a +0 -0
- data/vendor/local/lib/libcairo-script-interpreter.la +2 -2
- data/vendor/local/lib/libcairo.a +0 -0
- data/vendor/local/lib/libcairo.dll.a +0 -0
- data/vendor/local/lib/libcairo.la +2 -2
- data/vendor/local/lib/libfontconfig.dll.a +0 -0
- data/vendor/local/lib/libfreetype.a +0 -0
- data/vendor/local/lib/libfreetype.dll.a +0 -0
- data/vendor/local/lib/libfreetype.la +4 -4
- data/vendor/local/lib/libpixman-1.a +0 -0
- data/vendor/local/lib/libpixman-1.dll.a +0 -0
- data/vendor/local/lib/libpng.a +0 -0
- data/vendor/local/lib/libpng.dll.a +0 -0
- data/vendor/local/lib/libpng.la +4 -4
- data/vendor/local/lib/libpng16.a +0 -0
- data/vendor/local/lib/libpng16.dll.a +0 -0
- data/vendor/local/lib/libpng16.la +4 -4
- data/vendor/local/lib/libxml2.a +0 -0
- data/vendor/local/lib/libxml2.dll.a +0 -0
- data/vendor/local/lib/libz.a +0 -0
- data/vendor/local/lib/libz.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/cairo-fc.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-ft.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-gobject.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-pdf.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-png.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-ps.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-script.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-svg.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-win32-font.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo-win32.pc +1 -1
- data/vendor/local/lib/pkgconfig/cairo.pc +1 -1
- data/vendor/local/lib/pkgconfig/freetype2.pc +1 -1
- data/vendor/local/lib/pkgconfig/libpng.pc +1 -1
- data/vendor/local/lib/pkgconfig/libpng16.pc +1 -1
- data/vendor/local/share/aclocal/freetype2.m4 +1 -1
- data/vendor/local/share/gtk-doc/html/cairo/bindings-errors.html +12 -12
- data/vendor/local/share/gtk-doc/html/cairo/bindings-fonts.html +12 -12
- data/vendor/local/share/gtk-doc/html/cairo/bindings-memory.html +12 -12
- data/vendor/local/share/gtk-doc/html/cairo/bindings-overloading.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/bindings-path.html +12 -12
- data/vendor/local/share/gtk-doc/html/cairo/bindings-patterns.html +35 -35
- data/vendor/local/share/gtk-doc/html/cairo/bindings-return-values.html +10 -10
- data/vendor/local/share/gtk-doc/html/cairo/bindings-streams.html +11 -11
- data/vendor/local/share/gtk-doc/html/cairo/bindings-surfaces.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Error-handling.html +294 -225
- data/vendor/local/share/gtk-doc/html/cairo/cairo-FreeType-Fonts.html +387 -269
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html +432 -302
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PDF-Surfaces.html +325 -217
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PNG-Support.html +298 -193
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Paths.html +1121 -812
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PostScript-Surfaces.html +513 -383
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Quartz-(CGFont)-Fonts.html +126 -83
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Quartz-Surfaces.html +172 -119
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Raster-Sources.html +581 -372
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Recording-Surfaces.html +179 -130
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Regions.html +888 -539
- data/vendor/local/share/gtk-doc/html/cairo/cairo-SVG-Surfaces.html +287 -192
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Script-Surfaces.html +374 -231
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Transformations.html +395 -219
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Types.html +125 -75
- data/vendor/local/share/gtk-doc/html/cairo/cairo-User-Fonts.html +630 -464
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Version-Information.html +225 -200
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Fonts.html +336 -214
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Surfaces.html +277 -186
- data/vendor/local/share/gtk-doc/html/cairo/cairo-XCB-Surfaces.html +495 -350
- data/vendor/local/share/gtk-doc/html/cairo/cairo-XLib-Surfaces.html +557 -362
- data/vendor/local/share/gtk-doc/html/cairo/cairo-XLib-XRender-Backend.html +158 -111
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-device-t.html +655 -441
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-face-t.html +389 -280
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-options-t.html +667 -451
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-matrix-t.html +579 -351
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html +2006 -1545
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html +892 -618
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html +1624 -1188
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-t.html +2903 -2104
- data/vendor/local/share/gtk-doc/html/cairo/cairo-drawing.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/cairo-fonts.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/cairo-support.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/cairo-surfaces.html +13 -13
- data/vendor/local/share/gtk-doc/html/cairo/cairo-text.html +1115 -758
- data/vendor/local/share/gtk-doc/html/cairo/cairo.devhelp2 +419 -604
- data/vendor/local/share/gtk-doc/html/cairo/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/index-1.10.html +56 -56
- data/vendor/local/share/gtk-doc/html/cairo/index-1.12.html +70 -70
- data/vendor/local/share/gtk-doc/html/cairo/index-1.2.html +58 -58
- data/vendor/local/share/gtk-doc/html/cairo/index-1.4.html +39 -39
- data/vendor/local/share/gtk-doc/html/cairo/index-1.6.html +30 -30
- data/vendor/local/share/gtk-doc/html/cairo/index-1.8.html +38 -38
- data/vendor/local/share/gtk-doc/html/cairo/index-all.html +426 -426
- data/vendor/local/share/gtk-doc/html/cairo/index.html +6 -6
- data/vendor/local/share/gtk-doc/html/cairo/index.sgml +234 -325
- data/vendor/local/share/gtk-doc/html/cairo/language-bindings.html +12 -12
- data/vendor/local/share/gtk-doc/html/cairo/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/style.css +221 -26
- data/vendor/local/share/gtk-doc/html/cairo/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/up.png +0 -0
- data/vendor/local/share/license/cairo/README +1 -1
- data/vendor/local/share/license/freetype/README +6 -6
- data/vendor/local/share/license/freetype/README.git +1 -1
- data/vendor/local/share/license/libpng/README +2 -2
- data/vendor/local/share/man/man1/freetype-config.1 +1 -1
- data/vendor/local/share/man/man3/libpng.3 +85 -92
- data/vendor/local/share/man/man3/libpngpf.3 +2 -2
- data/vendor/local/share/man/man5/png.5 +1 -1
- metadata +23 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a69e01e415f4b00f5570f3b091cd3d7461d64b
|
4
|
+
data.tar.gz: 7f8c622638b26eed3373950daab8c3a3faa1ab2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5617b2c203b608503190439c5dd34c2e09aeb4b7a2c8d8656e020efd82415071a96361f227c087e4c77f90e82af50fd15a7029d26da7d53a3ebfad8d41c6c2a
|
7
|
+
data.tar.gz: 49e8ed70dccffb71cc4e15e614a1af9f4ff71c3b8abbce739c396ca1f0fff519a9b65f15abd76f92efdc1edac20d1ce2d26e3ac30a7e8ab6cda5aa1c05d64669
|
data/NEWS
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
Release 1.14.2 (2015-09-06) Kouhei Sutou <kou@cozmixng.org>
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
Improvements
|
5
|
+
------------
|
6
|
+
|
7
|
+
* Supported showing command execution result on failure.
|
8
|
+
[GitHub#36][Reported by Paul McMahon]
|
9
|
+
* Cairo::Region#each_rectangle: Added a convenience method.
|
10
|
+
* Cairo::Region#rectangles: Added a convenience method.
|
11
|
+
* Supported Pathname as output target for surface.
|
12
|
+
[GitHub#37][Reported by scivola]
|
13
|
+
* Exported rb_cairo_surface_check_status().
|
14
|
+
* Windows: Upgraded bundled libraries.
|
15
|
+
|
16
|
+
Thanks
|
17
|
+
------
|
18
|
+
|
19
|
+
* Paul McMahon
|
20
|
+
* scivola
|
21
|
+
|
1
22
|
Release 1.14.1 (2014-12-23) Kouhei Sutou <kou@cozmixng.org>
|
2
23
|
===========================================================
|
3
24
|
|
data/Rakefile
CHANGED
@@ -450,16 +450,16 @@ windows_task = WindowsTask.new(spec) do |task|
|
|
450
450
|
},
|
451
451
|
{
|
452
452
|
:name => "libpng",
|
453
|
-
:version => "1.6.
|
454
|
-
:download_base_url => "http://sourceforge.net/projects/libpng/files/libpng16/1.6.
|
453
|
+
:version => "1.6.18",
|
454
|
+
:download_base_url => "http://sourceforge.net/projects/libpng/files/libpng16/1.6.18",
|
455
455
|
:windows => {
|
456
|
-
:built_file => "bin/libpng16-
|
456
|
+
:built_file => "bin/libpng16-18.dll",
|
457
457
|
},
|
458
458
|
},
|
459
459
|
{
|
460
460
|
:name => "freetype",
|
461
|
-
:version => "2.
|
462
|
-
:download_base_url => "http://sourceforge.net/projects/freetype/files/freetype2/2.
|
461
|
+
:version => "2.6",
|
462
|
+
:download_base_url => "http://sourceforge.net/projects/freetype/files/freetype2/2.6",
|
463
463
|
:compression_method => "bz2",
|
464
464
|
:windows => {
|
465
465
|
:built_file => "bin/libfreetype-6.dll",
|
@@ -509,7 +509,7 @@ windows_task = WindowsTask.new(spec) do |task|
|
|
509
509
|
},
|
510
510
|
{
|
511
511
|
:name => "cairo",
|
512
|
-
:version => "1.14.
|
512
|
+
:version => "1.14.2",
|
513
513
|
:download_site => :cairo,
|
514
514
|
:windows => {
|
515
515
|
:built_file => "bin/libcairo-2.dll",
|
@@ -517,7 +517,6 @@ windows_task = WindowsTask.new(spec) do |task|
|
|
517
517
|
"--enable-gobject",
|
518
518
|
],
|
519
519
|
:patches => [
|
520
|
-
"cairo-1.14-missing-exeext-float-m4.diff"
|
521
520
|
],
|
522
521
|
:need_autoreconf => true,
|
523
522
|
},
|
@@ -526,6 +525,18 @@ windows_task = WindowsTask.new(spec) do |task|
|
|
526
525
|
end
|
527
526
|
windows_task.define
|
528
527
|
|
528
|
+
namespace :vm do
|
529
|
+
namespace :windows do
|
530
|
+
desc "Build all packages for Windows in VM"
|
531
|
+
task :build do
|
532
|
+
cd("build") do
|
533
|
+
sh("vagrant", "destroy", "--force")
|
534
|
+
sh("vagrant", "up")
|
535
|
+
end
|
536
|
+
end
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
529
540
|
# for releasing
|
530
541
|
task :dist do
|
531
542
|
sh "./dist.sh", spec.version.to_s
|
data/ext/cairo/cairo.def
CHANGED
data/ext/cairo/extconf.rb
CHANGED
@@ -103,16 +103,24 @@ def install_missing_native_package(native_package_info)
|
|
103
103
|
installing_message = "installing '#{package}' native package... "
|
104
104
|
message("%s", installing_message)
|
105
105
|
failed_to_get_super_user_priviledge = false
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
|
107
|
+
succeeded = false
|
108
|
+
execution_result = ""
|
109
|
+
File.open("mkmf.log") do |log|
|
110
|
+
log.seek(0, IO::SEEK_END)
|
111
|
+
if have_priviledge
|
111
112
|
succeeded = xsystem(install_command)
|
112
113
|
else
|
113
|
-
|
114
|
-
|
114
|
+
if sudo
|
115
|
+
install_command = "#{sudo} #{install_command}"
|
116
|
+
succeeded = xsystem(install_command)
|
117
|
+
else
|
118
|
+
succeeded = false
|
119
|
+
failed_to_get_super_user_priviledge = true
|
120
|
+
end
|
115
121
|
end
|
122
|
+
executed_command_line = log.gets
|
123
|
+
execution_result = log.read
|
116
124
|
end
|
117
125
|
|
118
126
|
if failed_to_get_super_user_priviledge
|
@@ -130,12 +138,15 @@ def install_missing_native_package(native_package_info)
|
|
130
138
|
if failed_to_get_super_user_priviledge
|
131
139
|
error_message = <<-EOM
|
132
140
|
'#{package}' native package is required.
|
133
|
-
|
141
|
+
Run the following command as super user to install required native package:
|
134
142
|
\# #{install_command}
|
135
143
|
EOM
|
136
144
|
else
|
137
145
|
error_message = <<-EOM
|
138
|
-
|
146
|
+
Failed to run '#{install_command}':
|
147
|
+
--
|
148
|
+
#{execution_result.chomp}
|
149
|
+
--
|
139
150
|
EOM
|
140
151
|
end
|
141
152
|
end
|
@@ -177,7 +188,7 @@ checking_for(checking_message("Mac OS X")) do
|
|
177
188
|
if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"])
|
178
189
|
checking_for("RubyCocoa") do
|
179
190
|
begin
|
180
|
-
require
|
191
|
+
require "osx/cocoa"
|
181
192
|
$defs << "-DHAVE_RUBY_COCOA"
|
182
193
|
$DLDFLAGS << " -Wl,-framework,RubyCocoa"
|
183
194
|
true
|
@@ -188,6 +199,8 @@ checking_for(checking_message("Mac OS X")) do
|
|
188
199
|
end
|
189
200
|
true
|
190
201
|
else
|
202
|
+
MakeMakefile::C_EXT.delete("m")
|
203
|
+
MakeMakefile::SRC_EXT.delete("m")
|
191
204
|
false
|
192
205
|
end
|
193
206
|
end
|
data/ext/cairo/rb_cairo.c
CHANGED
@@ -99,6 +99,9 @@ Init_cairo ()
|
|
99
99
|
Init_cairo_region ();
|
100
100
|
Init_cairo_device ();
|
101
101
|
Init_cairo_surface ();
|
102
|
+
#ifdef CAIRO_HAS_QUARTZ_SURFACE
|
103
|
+
Init_cairo_quartz_surface ();
|
104
|
+
#endif
|
102
105
|
Init_cairo_exception ();
|
103
106
|
Init_cairo_font ();
|
104
107
|
Init_cairo_font_extents ();
|
data/ext/cairo/rb_cairo.h
CHANGED
@@ -73,7 +73,7 @@ RB_CAIRO_BEGIN_DECLS
|
|
73
73
|
|
74
74
|
#define RB_CAIRO_VERSION_MAJOR 1
|
75
75
|
#define RB_CAIRO_VERSION_MINOR 14
|
76
|
-
#define RB_CAIRO_VERSION_MICRO
|
76
|
+
#define RB_CAIRO_VERSION_MICRO 2
|
77
77
|
|
78
78
|
RB_CAIRO_VAR VALUE rb_mCairo;
|
79
79
|
RB_CAIRO_VAR VALUE rb_cCairo_Context;
|
@@ -296,7 +296,7 @@ VALUE rb_cairo_device_to_ruby_object (cairo_device_t *de
|
|
296
296
|
#define RVAL2CRSCRIPTMODE(obj) (rb_cairo_script_mode_from_ruby_object(obj))
|
297
297
|
#endif
|
298
298
|
#if CAIRO_CHECK_VERSION(1, 10, 0)
|
299
|
-
#define RVAL2CRREGIONOVERLAP(obj) (
|
299
|
+
#define RVAL2CRREGIONOVERLAP(obj) (rb_cairo_region_overlap_from_ruby_object(obj))
|
300
300
|
#endif
|
301
301
|
|
302
302
|
cairo_operator_t rb_cairo_operator_from_ruby_object (VALUE obj);
|
@@ -338,7 +338,7 @@ cairo_region_overlap_t rb_cairo_region_overlap_from_ruby_object(VALUE obj);
|
|
338
338
|
#endif
|
339
339
|
|
340
340
|
void rb_cairo_check_status (cairo_status_t status);
|
341
|
-
|
341
|
+
void rb_cairo_surface_check_status (cairo_surface_t *surface);
|
342
342
|
|
343
343
|
#define RB_CAIRO_DEF_SETTERS(klass) rb_cairo_def_setters(klass);
|
344
344
|
void rb_cairo_def_setters (VALUE klass);
|
data/ext/cairo/rb_cairo_io.c
CHANGED
@@ -15,6 +15,8 @@
|
|
15
15
|
ID rb_cairo__io_id_read;
|
16
16
|
ID rb_cairo__io_id_write;
|
17
17
|
ID rb_cairo__io_id_output;
|
18
|
+
ID rb_cairo__io_id_to_io;
|
19
|
+
ID rb_cairo__io_id_to_path;
|
18
20
|
|
19
21
|
/* read/write callback */
|
20
22
|
rb_cairo__io_callback_closure_t *
|
@@ -163,4 +165,6 @@ Init_cairo_io (void)
|
|
163
165
|
rb_cairo__io_id_read = rb_intern ("read");
|
164
166
|
rb_cairo__io_id_write = rb_intern ("write");
|
165
167
|
rb_cairo__io_id_output = rb_intern ("output");
|
168
|
+
rb_cairo__io_id_to_io = rb_intern ("to_io");
|
169
|
+
rb_cairo__io_id_to_path = rb_intern ("to_path");
|
166
170
|
}
|
data/ext/cairo/rb_cairo_io.h
CHANGED
@@ -28,6 +28,8 @@ typedef struct rb_cairo__io_invoke_data {
|
|
28
28
|
RB_CAIRO_VAR ID rb_cairo__io_id_read;
|
29
29
|
RB_CAIRO_VAR ID rb_cairo__io_id_write;
|
30
30
|
RB_CAIRO_VAR ID rb_cairo__io_id_output;
|
31
|
+
RB_CAIRO_VAR ID rb_cairo__io_id_to_io;
|
32
|
+
RB_CAIRO_VAR ID rb_cairo__io_id_to_path;
|
31
33
|
|
32
34
|
rb_cairo__io_callback_closure_t *
|
33
35
|
rb_cairo__io_closure_new (VALUE target);
|
@@ -595,7 +595,7 @@ cr_mesh_pattern_set_control_point (VALUE self, VALUE rb_nth_point,
|
|
595
595
|
|
596
596
|
pattern = _SELF (self);
|
597
597
|
nth_point = NUM2UINT (rb_nth_point);
|
598
|
-
if (
|
598
|
+
if (nth_point <= 3)
|
599
599
|
{
|
600
600
|
cairo_mesh_pattern_set_control_point (pattern, nth_point,
|
601
601
|
NUM2DBL (rb_x), NUM2DBL (rb_y));
|
@@ -625,7 +625,7 @@ cr_mesh_pattern_set_corner_color_generic (int argc, VALUE *argv, VALUE self)
|
|
625
625
|
&rb_nth_corner, &rb_red, &rb_green, &rb_blue, &rb_alpha);
|
626
626
|
|
627
627
|
nth_corner = NUM2UINT (rb_nth_corner);
|
628
|
-
if (
|
628
|
+
if (nth_corner > 3)
|
629
629
|
{
|
630
630
|
VALUE inspected;
|
631
631
|
|
@@ -689,7 +689,7 @@ cr_mesh_pattern_get_corner_color (VALUE self,
|
|
689
689
|
|
690
690
|
nth_patch = NUM2UINT (rb_nth_patch);
|
691
691
|
nth_corner = NUM2UINT (rb_nth_corner);
|
692
|
-
if (
|
692
|
+
if (nth_corner > 3)
|
693
693
|
{
|
694
694
|
VALUE inspected;
|
695
695
|
|
@@ -723,7 +723,7 @@ cr_mesh_pattern_get_control_point (VALUE self,
|
|
723
723
|
|
724
724
|
nth_patch = NUM2UINT (rb_nth_patch);
|
725
725
|
nth_point = NUM2UINT (rb_nth_point);
|
726
|
-
if (
|
726
|
+
if (nth_point > 3)
|
727
727
|
{
|
728
728
|
VALUE inspected;
|
729
729
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
/*
|
3
3
|
* Ruby Cairo Binding
|
4
4
|
*
|
5
|
-
* Copyright 2005-
|
5
|
+
* Copyright 2005-2015 Kouhei Sutou <kou@cozmixng.org>
|
6
6
|
* Copyright 2014 Patrick Hanevold <patrick.hanevold@gmail.com>
|
7
7
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
8
8
|
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
@@ -45,17 +45,7 @@
|
|
45
45
|
#endif
|
46
46
|
|
47
47
|
#ifdef CAIRO_HAS_QUARTZ_SURFACE
|
48
|
-
# ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE
|
49
|
-
enum ruby_value_type {
|
50
|
-
RUBY_T_DATA = T_DATA
|
51
|
-
};
|
52
|
-
# endif
|
53
|
-
# undef T_DATA
|
54
|
-
# include <cairo-quartz.h>
|
55
|
-
# define T_DATA RUBY_T_DATA
|
56
|
-
# define RB_CAIRO_HAS_QUARTZ_SURFACE
|
57
48
|
# ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
58
|
-
# include <cairo-quartz-image.h>
|
59
49
|
# define RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
60
50
|
# endif
|
61
51
|
#endif
|
@@ -130,8 +120,8 @@ cr_paper_to_size_in_points (VALUE paper_description, VALUE *width, VALUE *height
|
|
130
120
|
*height = RARRAY_PTR (size)[1];
|
131
121
|
}
|
132
122
|
|
133
|
-
|
134
|
-
|
123
|
+
void
|
124
|
+
rb_cairo_surface_check_status (cairo_surface_t *surface)
|
135
125
|
{
|
136
126
|
rb_cairo_check_status (cairo_surface_status (surface));
|
137
127
|
}
|
@@ -467,13 +457,13 @@ cr_surface_finish (VALUE self)
|
|
467
457
|
|
468
458
|
if (closure && !NIL_P (closure->error))
|
469
459
|
rb_exc_raise (closure->error);
|
470
|
-
|
460
|
+
rb_cairo_surface_check_status (surface);
|
471
461
|
|
472
462
|
return self;
|
473
463
|
}
|
474
464
|
|
475
|
-
|
476
|
-
|
465
|
+
void
|
466
|
+
rb_cairo__surface_yield_and_finish (VALUE self)
|
477
467
|
{
|
478
468
|
cairo_surface_t *surface;
|
479
469
|
|
@@ -514,7 +504,7 @@ cr_surface_create_similar (int argc, VALUE *argv, VALUE self)
|
|
514
504
|
|
515
505
|
similar_surface = cairo_surface_create_similar (surface, content,
|
516
506
|
width, height);
|
517
|
-
|
507
|
+
rb_cairo_surface_check_status (similar_surface);
|
518
508
|
return CRSURFACE2RVAL_WITH_DESTROY (similar_surface);
|
519
509
|
}
|
520
510
|
|
@@ -552,7 +542,7 @@ cr_surface_create_similar_image (int argc, VALUE *argv, VALUE self)
|
|
552
542
|
|
553
543
|
similar_image = cairo_surface_create_similar_image (surface, format,
|
554
544
|
width, height);
|
555
|
-
|
545
|
+
rb_cairo_surface_check_status (similar_image);
|
556
546
|
return CRSURFACE2RVAL_WITH_DESTROY (similar_image);
|
557
547
|
}
|
558
548
|
|
@@ -590,7 +580,7 @@ cr_surface_map_to_image (int argc, VALUE *argv, VALUE self)
|
|
590
580
|
}
|
591
581
|
|
592
582
|
mapped_image = cairo_surface_map_to_image (surface, extents);
|
593
|
-
|
583
|
+
rb_cairo_surface_check_status (mapped_image);
|
594
584
|
return CRSURFACE2RVAL_WITH_DESTROY (mapped_image);
|
595
585
|
}
|
596
586
|
|
@@ -627,7 +617,7 @@ cr_surface_create_sub_rectangle_surface (VALUE self, VALUE x, VALUE y,
|
|
627
617
|
NUM2DBL (y),
|
628
618
|
NUM2DBL (width),
|
629
619
|
NUM2INT (height));
|
630
|
-
|
620
|
+
rb_cairo_surface_check_status (surface);
|
631
621
|
rb_surface = CRSURFACE2RVAL_WITH_DESTROY (surface);
|
632
622
|
if (rb_block_given_p ())
|
633
623
|
return rb_ensure (rb_yield, rb_surface,
|
@@ -759,7 +749,7 @@ cr_surface_get_font_options (VALUE self)
|
|
759
749
|
{
|
760
750
|
cairo_font_options_t *options = cairo_font_options_create();
|
761
751
|
cairo_surface_get_font_options (_SELF, options);
|
762
|
-
|
752
|
+
rb_cairo_surface_check_status (_SELF);
|
763
753
|
rb_cairo_check_status (cairo_font_options_status (options));
|
764
754
|
return CRFONTOPTIONS2RVAL (options);
|
765
755
|
}
|
@@ -768,7 +758,7 @@ static VALUE
|
|
768
758
|
cr_surface_flush (VALUE self)
|
769
759
|
{
|
770
760
|
cairo_surface_flush (_SELF);
|
771
|
-
|
761
|
+
rb_cairo_surface_check_status (_SELF);
|
772
762
|
return self;
|
773
763
|
}
|
774
764
|
|
@@ -806,7 +796,7 @@ cr_surface_mark_dirty (int argc, VALUE *argv, VALUE self)
|
|
806
796
|
rb_cairo__inspect (args));
|
807
797
|
}
|
808
798
|
|
809
|
-
|
799
|
+
rb_cairo_surface_check_status (_SELF);
|
810
800
|
return self;
|
811
801
|
}
|
812
802
|
|
@@ -816,7 +806,7 @@ cr_surface_set_device_offset (VALUE self, VALUE x_offset, VALUE y_offset)
|
|
816
806
|
cairo_surface_set_device_offset (_SELF,
|
817
807
|
NUM2DBL (x_offset),
|
818
808
|
NUM2DBL (y_offset));
|
819
|
-
|
809
|
+
rb_cairo_surface_check_status (_SELF);
|
820
810
|
return self;
|
821
811
|
}
|
822
812
|
|
@@ -826,7 +816,7 @@ cr_surface_get_device_offset (VALUE self)
|
|
826
816
|
double x_offset, y_offset;
|
827
817
|
|
828
818
|
cairo_surface_get_device_offset (_SELF, &x_offset, &y_offset);
|
829
|
-
|
819
|
+
rb_cairo_surface_check_status (_SELF);
|
830
820
|
return rb_ary_new3 (2, rb_float_new (x_offset), rb_float_new (y_offset));
|
831
821
|
}
|
832
822
|
|
@@ -837,7 +827,7 @@ cr_surface_set_device_scale (VALUE self, VALUE x_scale, VALUE y_scale)
|
|
837
827
|
cairo_surface_set_device_scale (_SELF,
|
838
828
|
NUM2DBL (x_scale),
|
839
829
|
NUM2DBL (y_scale));
|
840
|
-
|
830
|
+
rb_cairo_surface_check_status (_SELF);
|
841
831
|
return self;
|
842
832
|
}
|
843
833
|
|
@@ -859,7 +849,7 @@ cr_surface_set_fallback_resolution (VALUE self,
|
|
859
849
|
cairo_surface_set_fallback_resolution (_SELF,
|
860
850
|
NUM2DBL (x_pixels_per_inch),
|
861
851
|
NUM2DBL (y_pixels_per_inch));
|
862
|
-
|
852
|
+
rb_cairo_surface_check_status (_SELF);
|
863
853
|
return self;
|
864
854
|
}
|
865
855
|
|
@@ -872,7 +862,7 @@ cr_surface_get_fallback_resolution (VALUE self)
|
|
872
862
|
cairo_surface_get_fallback_resolution (_SELF,
|
873
863
|
&x_pixels_per_inch,
|
874
864
|
&y_pixels_per_inch);
|
875
|
-
|
865
|
+
rb_cairo_surface_check_status (_SELF);
|
876
866
|
return rb_ary_new3 (2,
|
877
867
|
rb_float_new (x_pixels_per_inch),
|
878
868
|
rb_float_new (y_pixels_per_inch));
|
@@ -885,7 +875,7 @@ static VALUE
|
|
885
875
|
cr_surface_copy_page (VALUE self)
|
886
876
|
{
|
887
877
|
cairo_surface_copy_page (_SELF);
|
888
|
-
|
878
|
+
rb_cairo_surface_check_status (_SELF);
|
889
879
|
return self;
|
890
880
|
}
|
891
881
|
|
@@ -893,7 +883,7 @@ static VALUE
|
|
893
883
|
cr_surface_show_page (VALUE self)
|
894
884
|
{
|
895
885
|
cairo_surface_show_page (_SELF);
|
896
|
-
|
886
|
+
rb_cairo_surface_check_status (_SELF);
|
897
887
|
return self;
|
898
888
|
}
|
899
889
|
#endif
|
@@ -934,7 +924,7 @@ cr_image_surface_create_from_png_generic (VALUE klass, VALUE target)
|
|
934
924
|
else
|
935
925
|
surface = cr_image_surface_create_from_png (target);
|
936
926
|
|
937
|
-
|
927
|
+
rb_cairo_surface_check_status (surface);
|
938
928
|
rb_surface = cr_surface_allocate (klass);
|
939
929
|
DATA_PTR (rb_surface) = surface;
|
940
930
|
return rb_surface;
|
@@ -992,10 +982,10 @@ cr_image_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
992
982
|
"(data, format, width, height, stride)): %s",
|
993
983
|
rb_cairo__inspect (rb_ary_new3 (4, arg1, arg2, arg3, arg4)));
|
994
984
|
|
995
|
-
|
985
|
+
rb_cairo_surface_check_status (surface);
|
996
986
|
DATA_PTR (self) = surface;
|
997
987
|
if (rb_block_given_p ())
|
998
|
-
|
988
|
+
rb_cairo__surface_yield_and_finish (self);
|
999
989
|
return Qnil;
|
1000
990
|
}
|
1001
991
|
|
@@ -1069,6 +1059,12 @@ cr_ ## type ## _surface_initialize (int argc, VALUE *argv, VALUE self) \
|
|
1069
1059
|
width_in_points = NUM2DBL (rb_width_in_points); \
|
1070
1060
|
height_in_points = NUM2DBL (rb_height_in_points); \
|
1071
1061
|
\
|
1062
|
+
if (rb_respond_to (target, rb_cairo__io_id_to_path) && \
|
1063
|
+
!rb_respond_to (target, rb_cairo__io_id_to_io)) \
|
1064
|
+
{ \
|
1065
|
+
target = rb_funcall (target, rb_cairo__io_id_to_path, 0); \
|
1066
|
+
} \
|
1067
|
+
\
|
1072
1068
|
if (rb_respond_to (target, rb_cairo__io_id_write)) \
|
1073
1069
|
{ \
|
1074
1070
|
rb_cairo__io_callback_closure_t *closure; \
|
@@ -1104,10 +1100,10 @@ cr_ ## type ## _surface_initialize (int argc, VALUE *argv, VALUE self) \
|
|
1104
1100
|
height_in_points); \
|
1105
1101
|
} \
|
1106
1102
|
\
|
1107
|
-
|
1103
|
+
rb_cairo_surface_check_status (surface); \
|
1108
1104
|
DATA_PTR (self) = surface; \
|
1109
1105
|
if (rb_block_given_p ()) \
|
1110
|
-
|
1106
|
+
rb_cairo__surface_yield_and_finish (self); \
|
1111
1107
|
return Qnil; \
|
1112
1108
|
}
|
1113
1109
|
|
@@ -1137,7 +1133,7 @@ cr_ ## type ## _surface_set_size (int argc, VALUE *argv, VALUE self) \
|
|
1137
1133
|
cairo_ ## type ## _surface_set_size (_SELF, \
|
1138
1134
|
NUM2DBL (width_in_points), \
|
1139
1135
|
NUM2DBL (height_in_points)); \
|
1140
|
-
|
1136
|
+
rb_cairo_surface_check_status (_SELF); \
|
1141
1137
|
return Qnil; \
|
1142
1138
|
}
|
1143
1139
|
|
@@ -1151,7 +1147,7 @@ static VALUE
|
|
1151
1147
|
cr_pdf_surface_restrict_to_version (VALUE self, VALUE version)
|
1152
1148
|
{
|
1153
1149
|
cairo_pdf_surface_restrict_to_version (_SELF, RVAL2CRPDFVERSION (version));
|
1154
|
-
|
1150
|
+
rb_cairo_surface_check_status (_SELF);
|
1155
1151
|
return Qnil;
|
1156
1152
|
}
|
1157
1153
|
# endif
|
@@ -1166,7 +1162,7 @@ static VALUE
|
|
1166
1162
|
cr_ps_surface_dsc_comment (VALUE self, VALUE comment)
|
1167
1163
|
{
|
1168
1164
|
cairo_ps_surface_dsc_comment (_SELF, StringValueCStr (comment));
|
1169
|
-
|
1165
|
+
rb_cairo_surface_check_status (_SELF);
|
1170
1166
|
return Qnil;
|
1171
1167
|
}
|
1172
1168
|
|
@@ -1174,7 +1170,7 @@ static VALUE
|
|
1174
1170
|
cr_ps_surface_dsc_begin_setup (VALUE self)
|
1175
1171
|
{
|
1176
1172
|
cairo_ps_surface_dsc_begin_setup (_SELF);
|
1177
|
-
|
1173
|
+
rb_cairo_surface_check_status (_SELF);
|
1178
1174
|
if (rb_block_given_p ())
|
1179
1175
|
return rb_yield (self);
|
1180
1176
|
else
|
@@ -1185,7 +1181,7 @@ static VALUE
|
|
1185
1181
|
cr_ps_surface_dsc_begin_page_setup (VALUE self)
|
1186
1182
|
{
|
1187
1183
|
cairo_ps_surface_dsc_begin_page_setup (_SELF);
|
1188
|
-
|
1184
|
+
rb_cairo_surface_check_status (_SELF);
|
1189
1185
|
if (rb_block_given_p ())
|
1190
1186
|
return rb_yield (self);
|
1191
1187
|
else
|
@@ -1197,7 +1193,7 @@ static VALUE
|
|
1197
1193
|
cr_ps_surface_restrict_to_level (VALUE self, VALUE level)
|
1198
1194
|
{
|
1199
1195
|
cairo_ps_surface_restrict_to_level (_SELF, RVAL2CRPSLEVEL (level));
|
1200
|
-
|
1196
|
+
rb_cairo_surface_check_status (_SELF);
|
1201
1197
|
return Qnil;
|
1202
1198
|
}
|
1203
1199
|
|
@@ -1211,135 +1207,12 @@ static VALUE
|
|
1211
1207
|
cr_ps_surface_set_eps (VALUE self, VALUE eps)
|
1212
1208
|
{
|
1213
1209
|
cairo_ps_surface_set_eps (_SELF, RTEST (eps));
|
1214
|
-
|
1210
|
+
rb_cairo_surface_check_status (_SELF);
|
1215
1211
|
return Qnil;
|
1216
1212
|
}
|
1217
1213
|
# endif
|
1218
1214
|
#endif
|
1219
1215
|
|
1220
|
-
#ifdef RB_CAIRO_HAS_QUARTZ_SURFACE
|
1221
|
-
/* Quartz-surface functions */
|
1222
|
-
#include <objc/objc-runtime.h>
|
1223
|
-
|
1224
|
-
# ifdef HAVE_RUBY_COCOA
|
1225
|
-
BOOL rbobj_to_nsobj (VALUE obj, id* nsobj);
|
1226
|
-
VALUE ocid_to_rbobj (VALUE context_obj, id ocid);
|
1227
|
-
# endif
|
1228
|
-
|
1229
|
-
static VALUE
|
1230
|
-
cr_quartz_surface_initialize (int argc, VALUE *argv, VALUE self)
|
1231
|
-
{
|
1232
|
-
id objc_object = nil;
|
1233
|
-
CGContextRef context;
|
1234
|
-
unsigned int width, height;
|
1235
|
-
cairo_surface_t *surface = NULL;
|
1236
|
-
cairo_format_t format = CAIRO_FORMAT_ARGB32;
|
1237
|
-
VALUE arg1, arg2, arg3, rb_width, rb_height;
|
1238
|
-
# ifdef HAVE_RUBY_COCOA
|
1239
|
-
static VALUE rb_cOSXCGContextRef = Qnil;
|
1240
|
-
# endif
|
1241
|
-
|
1242
|
-
rb_scan_args (argc, argv, "21", &arg1, &arg2, &arg3);
|
1243
|
-
|
1244
|
-
if (argc == 2)
|
1245
|
-
{
|
1246
|
-
rb_width = arg1;
|
1247
|
-
rb_height = arg2;
|
1248
|
-
}
|
1249
|
-
else
|
1250
|
-
{
|
1251
|
-
switch (TYPE (arg1))
|
1252
|
-
{
|
1253
|
-
case T_NIL:
|
1254
|
-
break;
|
1255
|
-
case T_STRING:
|
1256
|
-
case T_SYMBOL:
|
1257
|
-
case T_FIXNUM:
|
1258
|
-
format = RVAL2CRFORMAT (arg1);
|
1259
|
-
break;
|
1260
|
-
default:
|
1261
|
-
# ifdef HAVE_RUBY_COCOA
|
1262
|
-
if (NIL_P (rb_cOSXCGContextRef))
|
1263
|
-
rb_cOSXCGContextRef =
|
1264
|
-
rb_const_get (rb_const_get (rb_cObject, rb_intern ("OSX")),
|
1265
|
-
rb_intern ("CGContextRef"));
|
1266
|
-
# endif
|
1267
|
-
|
1268
|
-
# ifdef HAVE_RUBY_COCOA
|
1269
|
-
if (RTEST (rb_obj_is_kind_of (arg1, rb_cOSXCGContextRef)))
|
1270
|
-
{
|
1271
|
-
rbobj_to_nsobj (arg1, &objc_object);
|
1272
|
-
}
|
1273
|
-
else
|
1274
|
-
# endif
|
1275
|
-
{
|
1276
|
-
if (!NIL_P (rb_cairo__cFFIPointer) &&
|
1277
|
-
RTEST (rb_obj_is_kind_of (arg1, rb_cairo__cFFIPointer)))
|
1278
|
-
{
|
1279
|
-
VALUE rb_objc_pointer;
|
1280
|
-
rb_objc_pointer = rb_funcall (arg1,
|
1281
|
-
rb_intern ("address"),
|
1282
|
-
0);
|
1283
|
-
objc_object = NUM2ULONG (rb_objc_pointer);
|
1284
|
-
}
|
1285
|
-
else
|
1286
|
-
{
|
1287
|
-
rb_raise (rb_eArgError,
|
1288
|
-
"invalid argument (expect "
|
1289
|
-
"(width, height), "
|
1290
|
-
"(format, width, height), "
|
1291
|
-
"(cg_context, width, height) or "
|
1292
|
-
"(ffi_pointer, width, height)): %s",
|
1293
|
-
rb_cairo__inspect (rb_ary_new3 (3, arg1, arg2, arg3)));
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
break;
|
1297
|
-
}
|
1298
|
-
|
1299
|
-
rb_width = arg2;
|
1300
|
-
rb_height = arg3;
|
1301
|
-
}
|
1302
|
-
|
1303
|
-
width = NUM2UINT (rb_width);
|
1304
|
-
height = NUM2UINT (rb_height);
|
1305
|
-
|
1306
|
-
if (objc_object == nil)
|
1307
|
-
{
|
1308
|
-
surface = cairo_quartz_surface_create (format, width, height);
|
1309
|
-
}
|
1310
|
-
else
|
1311
|
-
{
|
1312
|
-
context = (CGContextRef)objc_object;
|
1313
|
-
surface =
|
1314
|
-
cairo_quartz_surface_create_for_cg_context (context, width, height);
|
1315
|
-
}
|
1316
|
-
|
1317
|
-
cr_surface_check_status (surface);
|
1318
|
-
DATA_PTR (self) = surface;
|
1319
|
-
if (rb_block_given_p ())
|
1320
|
-
yield_and_finish (self);
|
1321
|
-
return Qnil;
|
1322
|
-
}
|
1323
|
-
|
1324
|
-
static VALUE
|
1325
|
-
cr_quartz_surface_get_cg_context (VALUE self)
|
1326
|
-
{
|
1327
|
-
# ifdef HAVE_RUBY_COCOA
|
1328
|
-
CGContextRef context;
|
1329
|
-
id objc_object;
|
1330
|
-
|
1331
|
-
context = cairo_quartz_surface_get_cg_context (_SELF);
|
1332
|
-
objc_object = (id)context;
|
1333
|
-
return ocid_to_rbobj (Qnil, objc_object);
|
1334
|
-
# else
|
1335
|
-
rb_raise (rb_eNotImpError,
|
1336
|
-
"%s#cg_context requires RubyCocoa",
|
1337
|
-
rb_obj_classname(self));
|
1338
|
-
return Qnil;
|
1339
|
-
# endif
|
1340
|
-
}
|
1341
|
-
#endif
|
1342
|
-
|
1343
1216
|
#ifdef CAIRO_HAS_WIN32_SURFACE
|
1344
1217
|
/* Win32 surface functions */
|
1345
1218
|
|
@@ -1420,10 +1293,10 @@ cr_win32_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1420
1293
|
|
1421
1294
|
if (!surface)
|
1422
1295
|
rb_cairo_check_status (CAIRO_STATUS_INVALID_FORMAT);
|
1423
|
-
|
1296
|
+
rb_cairo_surface_check_status (surface);
|
1424
1297
|
DATA_PTR (self) = surface;
|
1425
1298
|
if (rb_block_given_p ())
|
1426
|
-
|
1299
|
+
rb_cairo__surface_yield_and_finish (self);
|
1427
1300
|
return Qnil;
|
1428
1301
|
}
|
1429
1302
|
|
@@ -1448,7 +1321,7 @@ cr_win32_surface_get_image (VALUE self)
|
|
1448
1321
|
surface = cairo_win32_surface_get_image (_SELF);
|
1449
1322
|
if (!surface)
|
1450
1323
|
return Qnil;
|
1451
|
-
|
1324
|
+
rb_cairo_surface_check_status (surface);
|
1452
1325
|
return CRSURFACE2RVAL (surface);
|
1453
1326
|
}
|
1454
1327
|
# endif
|
@@ -1462,7 +1335,7 @@ static VALUE
|
|
1462
1335
|
cr_svg_surface_restrict_to_version (VALUE self, VALUE version)
|
1463
1336
|
{
|
1464
1337
|
cairo_svg_surface_restrict_to_version (_SELF, RVAL2CRSVGVERSION (version));
|
1465
|
-
|
1338
|
+
rb_cairo_surface_check_status (_SELF);
|
1466
1339
|
return Qnil;
|
1467
1340
|
}
|
1468
1341
|
#endif
|
@@ -1475,41 +1348,12 @@ cr_win32_printing_surface_initialize (VALUE self, VALUE hdc)
|
|
1475
1348
|
cairo_surface_t *surface = NULL;
|
1476
1349
|
|
1477
1350
|
surface = cairo_win32_printing_surface_create (NUM2PTR (hdc));
|
1478
|
-
|
1479
|
-
DATA_PTR (self) = surface;
|
1480
|
-
if (rb_block_given_p ())
|
1481
|
-
yield_and_finish (self);
|
1482
|
-
return Qnil;
|
1483
|
-
}
|
1484
|
-
#endif
|
1485
|
-
|
1486
|
-
#ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
1487
|
-
|
1488
|
-
/* Quartz image surface functions */
|
1489
|
-
static VALUE
|
1490
|
-
cr_quartz_image_surface_initialize (VALUE self, VALUE image_surface)
|
1491
|
-
{
|
1492
|
-
cairo_surface_t *surface;
|
1493
|
-
|
1494
|
-
surface = cairo_quartz_image_surface_create (RVAL2CRSURFACE (image_surface));
|
1495
|
-
cr_surface_check_status (surface);
|
1351
|
+
rb_cairo_surface_check_status (surface);
|
1496
1352
|
DATA_PTR (self) = surface;
|
1497
1353
|
if (rb_block_given_p ())
|
1498
|
-
|
1354
|
+
rb_cairo__surface_yield_and_finish (self);
|
1499
1355
|
return Qnil;
|
1500
1356
|
}
|
1501
|
-
|
1502
|
-
static VALUE
|
1503
|
-
cr_quartz_image_surface_get_image (VALUE self)
|
1504
|
-
{
|
1505
|
-
cairo_surface_t *surface;
|
1506
|
-
|
1507
|
-
surface = cairo_quartz_image_surface_get_image (_SELF);
|
1508
|
-
if (!surface)
|
1509
|
-
return Qnil;
|
1510
|
-
cr_surface_check_status (surface);
|
1511
|
-
return CRSURFACE2RVAL (surface);
|
1512
|
-
}
|
1513
1357
|
#endif
|
1514
1358
|
|
1515
1359
|
#ifdef CAIRO_HAS_SCRIPT_SURFACE
|
@@ -1559,10 +1403,10 @@ cr_script_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1559
1403
|
else
|
1560
1404
|
surface = cairo_script_surface_create (device, content, width, height);
|
1561
1405
|
|
1562
|
-
|
1406
|
+
rb_cairo_surface_check_status (surface);
|
1563
1407
|
DATA_PTR (self) = surface;
|
1564
1408
|
if (rb_block_given_p ())
|
1565
|
-
|
1409
|
+
rb_cairo__surface_yield_and_finish (self);
|
1566
1410
|
return Qnil;
|
1567
1411
|
}
|
1568
1412
|
#endif
|
@@ -1614,10 +1458,10 @@ cr_recording_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1614
1458
|
}
|
1615
1459
|
|
1616
1460
|
surface = cairo_recording_surface_create (content, &extents);
|
1617
|
-
|
1461
|
+
rb_cairo_surface_check_status (surface);
|
1618
1462
|
DATA_PTR (self) = surface;
|
1619
1463
|
if (rb_block_given_p ())
|
1620
|
-
|
1464
|
+
rb_cairo__surface_yield_and_finish (self);
|
1621
1465
|
return Qnil;
|
1622
1466
|
}
|
1623
1467
|
|
@@ -1629,7 +1473,7 @@ cr_recording_surface_get_ink_extents (VALUE self)
|
|
1629
1473
|
|
1630
1474
|
surface = _SELF;
|
1631
1475
|
cairo_recording_surface_ink_extents (surface, &x, &y, &width, &height);
|
1632
|
-
|
1476
|
+
rb_cairo_surface_check_status (surface);
|
1633
1477
|
return rb_ary_new3 (4,
|
1634
1478
|
rb_float_new (x), rb_float_new (y),
|
1635
1479
|
rb_float_new (width), rb_float_new (height));
|
@@ -1644,7 +1488,7 @@ cr_recording_surface_get_extents (VALUE self)
|
|
1644
1488
|
|
1645
1489
|
surface = _SELF;
|
1646
1490
|
cairo_recording_surface_get_extents (surface, &extents);
|
1647
|
-
|
1491
|
+
rb_cairo_surface_check_status (surface);
|
1648
1492
|
return rb_ary_new3 (4,
|
1649
1493
|
rb_float_new (extents.x),
|
1650
1494
|
rb_float_new (extents.y),
|
@@ -1691,10 +1535,10 @@ cr_gl_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1691
1535
|
|
1692
1536
|
surface = cairo_gl_surface_create (device, content, width, height);
|
1693
1537
|
|
1694
|
-
|
1538
|
+
rb_cairo_surface_check_status (surface);
|
1695
1539
|
DATA_PTR (self) = surface;
|
1696
1540
|
if (rb_block_given_p ())
|
1697
|
-
|
1541
|
+
rb_cairo__surface_yield_and_finish (self);
|
1698
1542
|
return Qnil;
|
1699
1543
|
}
|
1700
1544
|
|
@@ -1738,10 +1582,10 @@ cr_gl_texture_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1738
1582
|
width,
|
1739
1583
|
height);
|
1740
1584
|
|
1741
|
-
|
1585
|
+
rb_cairo_surface_check_status (surface);
|
1742
1586
|
DATA_PTR (self) = surface;
|
1743
1587
|
if (rb_block_given_p ())
|
1744
|
-
|
1588
|
+
rb_cairo__surface_yield_and_finish (self);
|
1745
1589
|
return Qnil;
|
1746
1590
|
}
|
1747
1591
|
|
@@ -1752,7 +1596,7 @@ cr_gl_surface_set_size (VALUE self, VALUE width, VALUE height)
|
|
1752
1596
|
|
1753
1597
|
surface = _SELF;
|
1754
1598
|
cairo_gl_surface_set_size (surface, NUM2INT (width), NUM2INT (height));
|
1755
|
-
|
1599
|
+
rb_cairo_surface_check_status (surface);
|
1756
1600
|
return Qnil;
|
1757
1601
|
}
|
1758
1602
|
|
@@ -1775,7 +1619,7 @@ cr_gl_surface_swap_buffers (VALUE self)
|
|
1775
1619
|
|
1776
1620
|
surface = _SELF;
|
1777
1621
|
cairo_gl_surface_swapbuffers (surface);
|
1778
|
-
|
1622
|
+
rb_cairo_surface_check_status (surface);
|
1779
1623
|
return Qnil;
|
1780
1624
|
}
|
1781
1625
|
#endif
|
@@ -1788,11 +1632,11 @@ cr_tee_surface_initialize (VALUE self, VALUE master)
|
|
1788
1632
|
cairo_surface_t *surface = NULL;
|
1789
1633
|
|
1790
1634
|
surface = cairo_tee_surface_create (RVAL2CRSURFACE (master));
|
1791
|
-
|
1635
|
+
rb_cairo_surface_check_status (surface);
|
1792
1636
|
DATA_PTR (self) = surface;
|
1793
1637
|
rb_iv_set (self, "surfaces", rb_ary_new3 (1, master));
|
1794
1638
|
if (rb_block_given_p ())
|
1795
|
-
|
1639
|
+
rb_cairo__surface_yield_and_finish (self);
|
1796
1640
|
return Qnil;
|
1797
1641
|
}
|
1798
1642
|
|
@@ -1803,7 +1647,7 @@ cr_tee_surface_add (VALUE self, VALUE target)
|
|
1803
1647
|
|
1804
1648
|
surface = _SELF;
|
1805
1649
|
cairo_tee_surface_add (surface, RVAL2CRSURFACE (target));
|
1806
|
-
|
1650
|
+
rb_cairo_surface_check_status (surface);
|
1807
1651
|
rb_ary_push (rb_iv_get (self, "surfaces"), target);
|
1808
1652
|
return Qnil;
|
1809
1653
|
}
|
@@ -1839,7 +1683,7 @@ cr_tee_surface_remove (VALUE self, VALUE target_or_index)
|
|
1839
1683
|
target = cairo_tee_surface_index (surface, NUM2INT (index));
|
1840
1684
|
}
|
1841
1685
|
cairo_tee_surface_remove (surface, target);
|
1842
|
-
|
1686
|
+
rb_cairo_surface_check_status (surface);
|
1843
1687
|
|
1844
1688
|
rb_surfaces = rb_iv_get (self, "surfaces");
|
1845
1689
|
for (i = 0; i < RARRAY_LEN (rb_surfaces); i++)
|
@@ -1867,8 +1711,8 @@ cr_tee_surface_array_reference (VALUE self, VALUE index)
|
|
1867
1711
|
surface = _SELF;
|
1868
1712
|
index = rb_Integer (index);
|
1869
1713
|
target = cairo_tee_surface_index (surface, NUM2UINT (index));
|
1870
|
-
|
1871
|
-
|
1714
|
+
rb_cairo_surface_check_status (surface);
|
1715
|
+
rb_cairo_surface_check_status (target);
|
1872
1716
|
return CRSURFACE2RVAL (target);
|
1873
1717
|
}
|
1874
1718
|
#endif
|
@@ -1910,10 +1754,10 @@ cr_xml_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
1910
1754
|
|
1911
1755
|
surface = cairo_xml_surface_create (device, content, width, height);
|
1912
1756
|
|
1913
|
-
|
1757
|
+
rb_cairo_surface_check_status (surface);
|
1914
1758
|
DATA_PTR (self) = surface;
|
1915
1759
|
if (rb_block_given_p ())
|
1916
|
-
|
1760
|
+
rb_cairo__surface_yield_and_finish (self);
|
1917
1761
|
return Qnil;
|
1918
1762
|
}
|
1919
1763
|
#endif
|
@@ -2125,12 +1969,6 @@ Init_cairo_surface (void)
|
|
2125
1969
|
/* Quartz surface */
|
2126
1970
|
rb_cCairo_QuartzSurface =
|
2127
1971
|
rb_define_class_under (rb_mCairo, "QuartzSurface", rb_cCairo_Surface);
|
2128
|
-
#ifdef RB_CAIRO_HAS_QUARTZ_SURFACE
|
2129
|
-
rb_define_method (rb_cCairo_QuartzSurface, "initialize",
|
2130
|
-
cr_quartz_surface_initialize, -1);
|
2131
|
-
rb_define_method (rb_cCairo_QuartzSurface, "cg_context",
|
2132
|
-
cr_quartz_surface_get_cg_context, 0);
|
2133
|
-
#endif
|
2134
1972
|
|
2135
1973
|
/* Win32 surface */
|
2136
1974
|
rb_cCairo_Win32Surface =
|
@@ -2171,12 +2009,6 @@ Init_cairo_surface (void)
|
|
2171
2009
|
/* Quartz image surface */
|
2172
2010
|
rb_cCairo_QuartzImageSurface =
|
2173
2011
|
rb_define_class_under (rb_mCairo, "QuartzImageSurface", rb_cCairo_Surface);
|
2174
|
-
#ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE
|
2175
|
-
rb_define_method (rb_cCairo_QuartzImageSurface, "initialize",
|
2176
|
-
cr_quartz_image_surface_initialize, 1);
|
2177
|
-
rb_define_method (rb_cCairo_QuartzImageSurface, "image",
|
2178
|
-
cr_quartz_image_surface_get_image, 0);
|
2179
|
-
#endif
|
2180
2012
|
|
2181
2013
|
/* script surface */
|
2182
2014
|
rb_cCairo_ScriptSurface =
|