rsvg2 2.2.4-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +35 -0
- data/Rakefile +69 -0
- data/ext/rsvg2/depend +6 -0
- data/ext/rsvg2/extconf.rb +89 -0
- data/ext/rsvg2/rbrsvg.c +206 -0
- data/ext/rsvg2/rbrsvgdimensiondata.c +194 -0
- data/ext/rsvg2/rbrsvghandle.c +496 -0
- data/ext/rsvg2/rsvg2.def +2 -0
- data/ext/rsvg2/rsvg2.h +70 -0
- data/extconf.rb +49 -0
- data/lib/2.0/rsvg2.so +0 -0
- data/lib/2.1/rsvg2.so +0 -0
- data/lib/2.2/rsvg2.so +0 -0
- data/lib/rsvg2.rb +33 -0
- data/sample/svg-viewer.rb +44 -0
- data/sample/svg2.rb +60 -0
- data/test/rsvg2-test-utils.rb +23 -0
- data/test/run-test.rb +49 -0
- data/test/test-handle.rb +91 -0
- data/vendor/local/bin/croco-0.6-config +87 -0
- data/vendor/local/bin/csslint-0.6.exe +0 -0
- data/vendor/local/bin/libcroco-0.6-3.dll +0 -0
- data/vendor/local/bin/librsvg-2-2.dll +0 -0
- data/vendor/local/bin/rsvg-convert.exe +0 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-additional-sel.h +98 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-attr-sel.h +74 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-cascade.h +74 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-declaration.h +136 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-doc-handler.h +298 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-enc-handler.h +94 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-fonts.h +315 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-input.h +174 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-num.h +127 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-om-parser.h +98 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-parser.h +128 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-parsing-location.h +70 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-prop-list.h +80 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-pseudo.h +64 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-rgb.h +94 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-sel-eng.h +110 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-selector.h +95 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-simple-sel.h +130 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-statement.h +440 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-string.h +76 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-style.h +339 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-stylesheet.h +102 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-term.h +190 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-tknzr.h +115 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-token.h +212 -0
- data/vendor/local/include/libcroco-0.6/libcroco/cr-utils.h +246 -0
- data/vendor/local/include/libcroco-0.6/libcroco/libcroco-config.h +17 -0
- data/vendor/local/include/libcroco-0.6/libcroco/libcroco.h +44 -0
- data/vendor/local/include/librsvg-2.0/librsvg/librsvg-enum-types.h +24 -0
- data/vendor/local/include/librsvg-2.0/librsvg/librsvg-features.h +28 -0
- data/vendor/local/include/librsvg-2.0/librsvg/rsvg-cairo.h +42 -0
- data/vendor/local/include/librsvg-2.0/librsvg/rsvg.h +264 -0
- data/vendor/local/lib/girepository-1.0/Rsvg-2.0.typelib +0 -0
- data/vendor/local/lib/libcroco-0.6.a +0 -0
- data/vendor/local/lib/libcroco-0.6.dll.a +0 -0
- data/vendor/local/lib/libcroco-0.6.la +41 -0
- data/vendor/local/lib/librsvg-2.a +0 -0
- data/vendor/local/lib/librsvg-2.dll.a +0 -0
- data/vendor/local/lib/librsvg-2.la +41 -0
- data/vendor/local/lib/pkgconfig/libcroco-0.6.pc +11 -0
- data/vendor/local/lib/pkgconfig/librsvg-2.0.pc +15 -0
- data/vendor/local/share/gir-1.0/Rsvg-2.0.gir +754 -0
- data/vendor/local/share/gtk-doc/html/libcroco/ch01.html +113 -0
- data/vendor/local/share/gtk-doc/html/libcroco/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/libcroco/index.html +109 -0
- data/vendor/local/share/gtk-doc/html/libcroco/index.sgml +582 -0
- data/vendor/local/share/gtk-doc/html/libcroco/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-additional-sel.html +337 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-attr-sel.html +203 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-cascade.html +240 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-declaration.html +642 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-doc-handler.html +517 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-enc-handler.html +164 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-fonts.html +670 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-input.html +1102 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-num.html +265 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-om-parser.html +380 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-parser.html +913 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-parsing-location.html +205 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-prop-list.html +421 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-pseudo.html +141 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-rgb.html +503 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-sel-eng.html +346 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-selector.html +246 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-simple-sel.html +240 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-statement.html +1408 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-string.html +137 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-style.html +384 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-stylesheet.html +158 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-term.html +304 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-tknzr.html +312 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-token.html +428 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-utils.html +334 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco-libcroco-config.html +80 -0
- data/vendor/local/share/gtk-doc/html/libcroco/libcroco.devhelp2 +511 -0
- data/vendor/local/share/gtk-doc/html/libcroco/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/libcroco/style.css +266 -0
- data/vendor/local/share/gtk-doc/html/libcroco/up.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/RsvgHandle.html +1420 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/annotation-glossary.html +55 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-14.html +55 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-22.html +43 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-32.html +47 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-36.html +46 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-4.html +39 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-8.html +54 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-9.html +53 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-deprecated.html +100 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-full.html +323 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.html +88 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.sgml +106 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/licence.html +57 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/object-tree.html +38 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-2.0.devhelp2 +94 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GIO.html +360 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GdkPixbuf.html +484 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-cairo.html +154 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Version-check-and-feature-tests.html +142 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg.html +57 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/rsvg-2.0/up.png +0 -0
- data/vendor/local/share/license/libcroco/AUTHORS +13 -0
- data/vendor/local/share/license/libcroco/COPYING +481 -0
- data/vendor/local/share/license/libcroco/COPYING.LIB +481 -0
- data/vendor/local/share/license/librsvg/AUTHORS +1 -0
- data/vendor/local/share/license/librsvg/COPYING +340 -0
- data/vendor/local/share/license/librsvg/COPYING.LIB +482 -0
- data/vendor/local/share/man/man1/rsvg-convert.1 +55 -0
- metadata +209 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 029d76f17e6b7a8330e7242f1829ccdb59edff5b
|
4
|
+
data.tar.gz: 0edd32c4a41cc0a24ed51e33e31e72da91cadb5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cb4384ffdd549d6fbb76c781c7a81f2854c7990ce842ee1173f23c070a97b892ef7917b60e3875de2b1bd6017378b334920f4f2e5e17e998e3f1e2485bc927e6
|
7
|
+
data.tar.gz: a97f4063e6f5a6e6ecd8a982d7ffc0e979a89ea8214bda40db71d572d932dfb6070cf07f0cbcefb2f6dc2402e441a92a8d0a1353cf2683a7e3fff8f94334e7f6
|
data/README
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Ruby/RSVG
|
2
|
+
=========
|
3
|
+
|
4
|
+
Ruby/RSVG is a Ruby binding of librsvg.
|
5
|
+
|
6
|
+
Requirements
|
7
|
+
------------
|
8
|
+
|
9
|
+
Ruby: http://www.ruby-lang.org/
|
10
|
+
librsvg [*]: http://librsvg.sourceforge.net/
|
11
|
+
Ruby/GLib2: http://ruby-gnome2.sourceforge.net/
|
12
|
+
Ruby/GdkPixbuf2: http://ruby-gnome2.sourceforge.net/
|
13
|
+
|
14
|
+
[*]: 2.8 or later is requried.
|
15
|
+
|
16
|
+
Install
|
17
|
+
-------
|
18
|
+
|
19
|
+
0. install ruby and librsvg.
|
20
|
+
1. ruby extconf.rb
|
21
|
+
2. make
|
22
|
+
3. su
|
23
|
+
4. make install
|
24
|
+
|
25
|
+
Copying
|
26
|
+
-------
|
27
|
+
Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
|
28
|
+
|
29
|
+
This program is free software.
|
30
|
+
You can distribute/modify this program under the terms of
|
31
|
+
the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
|
32
|
+
|
33
|
+
Project Website
|
34
|
+
---------------
|
35
|
+
http://ruby-gnome2.sourceforge.jp/
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2010-2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
$LOAD_PATH.unshift("./../glib2/lib")
|
20
|
+
require 'gnome2-raketask'
|
21
|
+
|
22
|
+
package_task = GNOME2::Rake::PackageTask.new do |package|
|
23
|
+
package.summary = "Ruby/RSVG is a Ruby binding of librsvg-2.x."
|
24
|
+
package.description = "Ruby/RSVG is a Ruby binding of librsvg-2.x."
|
25
|
+
package.dependency.gem.runtime = [["cairo", ">= 1.12.8"], "gdk_pixbuf2"]
|
26
|
+
package.windows.packages = []
|
27
|
+
package.windows.dependencies = []
|
28
|
+
package.windows.build_dependencies = [
|
29
|
+
"glib2",
|
30
|
+
"gobject-introspection",
|
31
|
+
"pango",
|
32
|
+
"gdk_pixbuf2",
|
33
|
+
]
|
34
|
+
package.windows.gobject_introspection_dependencies = [
|
35
|
+
"gdk_pixbuf2",
|
36
|
+
]
|
37
|
+
package.external_packages = [
|
38
|
+
{
|
39
|
+
:name => "libcroco",
|
40
|
+
:download_site => :gnome,
|
41
|
+
:label => "libcroco",
|
42
|
+
:version => "0.6.8",
|
43
|
+
:compression_method => "xz",
|
44
|
+
:windows => {
|
45
|
+
:configure_args => [
|
46
|
+
"--enable-introspection",
|
47
|
+
],
|
48
|
+
:built_file => "bin/libcroco-0.6-3.dll",
|
49
|
+
},
|
50
|
+
},
|
51
|
+
{
|
52
|
+
:name => "librsvg",
|
53
|
+
:download_site => :gnome,
|
54
|
+
:label => "librsvg",
|
55
|
+
:version => "2.40.6",
|
56
|
+
:compression_method => "xz",
|
57
|
+
:windows => {
|
58
|
+
:configure_args => [
|
59
|
+
"--enable-introspection",
|
60
|
+
],
|
61
|
+
:patches => [
|
62
|
+
],
|
63
|
+
:built_file => "bin/librsvg-2-2.dll",
|
64
|
+
},
|
65
|
+
},
|
66
|
+
]
|
67
|
+
end
|
68
|
+
package_task.define
|
69
|
+
|
data/ext/rsvg2/depend
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
=begin
|
2
|
+
extconf.rb for Ruby/RSVG extention library
|
3
|
+
=end
|
4
|
+
|
5
|
+
require 'pathname'
|
6
|
+
|
7
|
+
base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
|
8
|
+
top_dir = base_dir.parent
|
9
|
+
top_build_dir = Pathname(".").parent.parent.parent.expand_path
|
10
|
+
|
11
|
+
mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
|
12
|
+
version_suffix = ""
|
13
|
+
unless mkmf_gnome2_dir.exist?
|
14
|
+
if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
|
15
|
+
version_suffix = $1
|
16
|
+
mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
21
|
+
|
22
|
+
module_name = "rsvg2"
|
23
|
+
package_id = "librsvg-2.0"
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'mkmf-gnome2'
|
27
|
+
rescue LoadError
|
28
|
+
require 'rubygems'
|
29
|
+
gem 'glib2'
|
30
|
+
require 'mkmf-gnome2'
|
31
|
+
end
|
32
|
+
|
33
|
+
["glib2", "gdk_pixbuf2"].each do |package|
|
34
|
+
directory = "#{package}#{version_suffix}"
|
35
|
+
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
|
36
|
+
add_depend_package(package, "#{directory}/ext/#{package}",
|
37
|
+
top_dir.to_s,
|
38
|
+
:top_build_dir => top_build_dir.to_s,
|
39
|
+
:target_build_dir => build_dir)
|
40
|
+
end
|
41
|
+
|
42
|
+
unless check_cairo(:top_dir => top_dir)
|
43
|
+
exit(false)
|
44
|
+
end
|
45
|
+
|
46
|
+
setup_windows(module_name, base_dir)
|
47
|
+
|
48
|
+
unless required_pkg_config_package(package_id,
|
49
|
+
:debian => "librsvg2-dev",
|
50
|
+
:redhat => "librsvg2-devel",
|
51
|
+
:homebrew => "librsvg",
|
52
|
+
:macports => "librsvg")
|
53
|
+
exit(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
rsvg_header = "librsvg/rsvg.h"
|
57
|
+
have_func("rsvg_set_default_dpi", rsvg_header)
|
58
|
+
have_func("rsvg_set_default_dpi_x_y", rsvg_header)
|
59
|
+
have_func("rsvg_handle_set_dpi", rsvg_header)
|
60
|
+
have_func("rsvg_handle_set_dpi_x_y", rsvg_header)
|
61
|
+
have_func("rsvg_handle_get_metadata", rsvg_header)
|
62
|
+
have_func("rsvg_handle_free", rsvg_header)
|
63
|
+
have_func("rsvg_handle_get_pixbuf_sub", rsvg_header)
|
64
|
+
have_header("librsvg/rsvg-gz.h")
|
65
|
+
have_type("RsvgDimensionData", "librsvg/rsvg.h")
|
66
|
+
|
67
|
+
have_header("librsvg/rsvg-cairo.h")
|
68
|
+
|
69
|
+
create_pkg_config_file("Ruby/RSVG", package_id, nil, "ruby-rsvg2.pc")
|
70
|
+
|
71
|
+
$defs << " -DRUBY_RSVG2_COMPILATION"
|
72
|
+
enum_type_prefix = "librsvg-enum-types"
|
73
|
+
unless have_header("librsvg/#{enum_type_prefix}.h")
|
74
|
+
include_paths = PKGConfig.cflags_only_I("librsvg-2.0")
|
75
|
+
include_path = include_paths.split.find do |x|
|
76
|
+
/librsvg/.match(x)
|
77
|
+
end.sub(/^-I/, "")
|
78
|
+
headers = Dir.glob(File.join(include_path, "librsvg", "*.h"))
|
79
|
+
glib_mkenums(enum_type_prefix, headers, "RSVG_TYPE_", ["librsvg/rsvg.h"])
|
80
|
+
end
|
81
|
+
create_makefile(module_name)
|
82
|
+
|
83
|
+
pkg_config_dir = with_config("pkg-config-dir")
|
84
|
+
if pkg_config_dir.is_a?(String)
|
85
|
+
File.open("Makefile", "ab") do |makefile|
|
86
|
+
makefile.puts
|
87
|
+
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
|
88
|
+
end
|
89
|
+
end
|
data/ext/rsvg2/rbrsvg.c
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005-2006 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2004 Kouhei Sutou <kou@cozmixng.org>
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
* MA 02110-1301 USA
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include "rsvg2.h"
|
24
|
+
|
25
|
+
#define RG_TARGET_NAMESPACE mRSVG
|
26
|
+
|
27
|
+
#define RBRSVG_MAJOR_VERSION RBGLIB_MAJOR_VERSION
|
28
|
+
#define RBRSVG_MINOR_VERSION RBGLIB_MINOR_VERSION
|
29
|
+
#define RBRSVG_MICRO_VERSION RBGLIB_MICRO_VERSION
|
30
|
+
|
31
|
+
void Init_rsvg2(void);
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
rg_s_set_default_dpi(VALUE self, VALUE dpi)
|
35
|
+
{
|
36
|
+
#ifdef HAVE_RSVG_SET_DEFAULT_DPI
|
37
|
+
rsvg_set_default_dpi(NUM2DBL(dpi));
|
38
|
+
#else
|
39
|
+
rb_warning("rsvg_set_default_dpi isn't supported in your librsvg");
|
40
|
+
#endif
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
rg_s_set_default_dpi_x_y(VALUE self, VALUE dpi_x, VALUE dpi_y)
|
46
|
+
{
|
47
|
+
#ifdef HAVE_RSVG_SET_DEFAULT_DPI_X_Y
|
48
|
+
rsvg_set_default_dpi_x_y(NUM2DBL(dpi_x), NUM2DBL(dpi_y));
|
49
|
+
#else
|
50
|
+
rb_warning("rsvg_set_default_dpi_x_y isn't supported in your librsvg");
|
51
|
+
#endif
|
52
|
+
return self;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* Convenience API */
|
56
|
+
static VALUE
|
57
|
+
rg_s_pixbuf_from_file(G_GNUC_UNUSED VALUE self, VALUE file_name)
|
58
|
+
{
|
59
|
+
VALUE rb_pixbuf;
|
60
|
+
GdkPixbuf *pixbuf;
|
61
|
+
GError *error = NULL;
|
62
|
+
|
63
|
+
pixbuf = rsvg_pixbuf_from_file(RVAL2CSTR(file_name), &error);
|
64
|
+
|
65
|
+
if (error) RAISE_GERROR(error);
|
66
|
+
|
67
|
+
rb_pixbuf = GOBJ2RVAL(pixbuf);
|
68
|
+
g_object_unref(pixbuf);
|
69
|
+
return rb_pixbuf;
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
rg_s_pixbuf_from_file_at_zoom(G_GNUC_UNUSED VALUE self, VALUE file_name,
|
74
|
+
VALUE x_zoom, VALUE y_zoom)
|
75
|
+
{
|
76
|
+
VALUE rb_pixbuf;
|
77
|
+
GdkPixbuf *pixbuf;
|
78
|
+
GError *error = NULL;
|
79
|
+
|
80
|
+
pixbuf = rsvg_pixbuf_from_file_at_zoom(RVAL2CSTR(file_name),
|
81
|
+
NUM2DBL(x_zoom),
|
82
|
+
NUM2DBL(y_zoom),
|
83
|
+
&error);
|
84
|
+
|
85
|
+
if (error) RAISE_GERROR(error);
|
86
|
+
|
87
|
+
rb_pixbuf = GOBJ2RVAL(pixbuf);
|
88
|
+
g_object_unref(pixbuf);
|
89
|
+
return rb_pixbuf;
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
rg_s_pixbuf_from_file_at_size(G_GNUC_UNUSED VALUE self, VALUE file_name,
|
94
|
+
VALUE width, VALUE height)
|
95
|
+
{
|
96
|
+
VALUE rb_pixbuf;
|
97
|
+
GdkPixbuf *pixbuf;
|
98
|
+
GError *error = NULL;
|
99
|
+
|
100
|
+
pixbuf = rsvg_pixbuf_from_file_at_size(RVAL2CSTR(file_name),
|
101
|
+
NUM2INT(width),
|
102
|
+
NUM2INT(height),
|
103
|
+
&error);
|
104
|
+
|
105
|
+
if (error) RAISE_GERROR(error);
|
106
|
+
|
107
|
+
rb_pixbuf = GOBJ2RVAL(pixbuf);
|
108
|
+
g_object_unref(pixbuf);
|
109
|
+
return rb_pixbuf;
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
rg_s_pixbuf_from_file_at_max_size(G_GNUC_UNUSED VALUE self, VALUE file_name,
|
114
|
+
VALUE max_width, VALUE max_height)
|
115
|
+
{
|
116
|
+
VALUE rb_pixbuf;
|
117
|
+
GdkPixbuf *pixbuf;
|
118
|
+
GError *error = NULL;
|
119
|
+
|
120
|
+
pixbuf = rsvg_pixbuf_from_file_at_max_size(RVAL2CSTR(file_name),
|
121
|
+
NUM2INT(max_width),
|
122
|
+
NUM2INT(max_height),
|
123
|
+
&error);
|
124
|
+
|
125
|
+
if (error) RAISE_GERROR(error);
|
126
|
+
|
127
|
+
rb_pixbuf = GOBJ2RVAL(pixbuf);
|
128
|
+
g_object_unref(pixbuf);
|
129
|
+
return rb_pixbuf;
|
130
|
+
}
|
131
|
+
|
132
|
+
static VALUE
|
133
|
+
rg_s_pixbuf_from_file_at_zoom_with_max(G_GNUC_UNUSED VALUE self,
|
134
|
+
VALUE file_name,
|
135
|
+
VALUE x_zoom,
|
136
|
+
VALUE y_zoom,
|
137
|
+
VALUE max_width,
|
138
|
+
VALUE max_height)
|
139
|
+
{
|
140
|
+
VALUE rb_pixbuf;
|
141
|
+
GdkPixbuf *pixbuf;
|
142
|
+
GError *error = NULL;
|
143
|
+
|
144
|
+
pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max(RVAL2CSTR(file_name),
|
145
|
+
NUM2DBL(x_zoom),
|
146
|
+
NUM2DBL(y_zoom),
|
147
|
+
NUM2INT(max_width),
|
148
|
+
NUM2INT(max_height),
|
149
|
+
&error);
|
150
|
+
|
151
|
+
if (error) RAISE_GERROR(error);
|
152
|
+
|
153
|
+
rb_pixbuf = GOBJ2RVAL(pixbuf);
|
154
|
+
g_object_unref(pixbuf);
|
155
|
+
return rb_pixbuf;
|
156
|
+
}
|
157
|
+
|
158
|
+
static VALUE
|
159
|
+
rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self)
|
160
|
+
{
|
161
|
+
#ifdef HAVE_LIBRSVG_RSVG_CAIRO_H
|
162
|
+
return Qtrue;
|
163
|
+
#else
|
164
|
+
return Qfalse;
|
165
|
+
#endif
|
166
|
+
}
|
167
|
+
|
168
|
+
void
|
169
|
+
Init_rsvg2(void)
|
170
|
+
{
|
171
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module("RSVG");
|
172
|
+
|
173
|
+
#if LIBRSVG_CHECK_VERSION(2, 9, 0)
|
174
|
+
rsvg_init();
|
175
|
+
atexit(rsvg_term);
|
176
|
+
#endif
|
177
|
+
|
178
|
+
G_DEF_ERROR(RSVG_ERROR, "Error", RG_TARGET_NAMESPACE, rb_eRuntimeError, RSVG_TYPE_ERROR);
|
179
|
+
|
180
|
+
rb_define_const(RG_TARGET_NAMESPACE, "BINDING_VERSION",
|
181
|
+
rb_ary_new3(3,
|
182
|
+
INT2FIX(RBRSVG_MAJOR_VERSION),
|
183
|
+
INT2FIX(RBRSVG_MINOR_VERSION),
|
184
|
+
INT2FIX(RBRSVG_MICRO_VERSION)));
|
185
|
+
|
186
|
+
rb_define_const(RG_TARGET_NAMESPACE, "BUILD_VERSION",
|
187
|
+
rb_ary_new3(3,
|
188
|
+
INT2FIX(LIBRSVG_MAJOR_VERSION),
|
189
|
+
INT2FIX(LIBRSVG_MINOR_VERSION),
|
190
|
+
INT2FIX(LIBRSVG_MICRO_VERSION)));
|
191
|
+
|
192
|
+
RG_DEF_SMETHOD(set_default_dpi, 1);
|
193
|
+
RG_DEF_SMETHOD(set_default_dpi_x_y, 2);
|
194
|
+
|
195
|
+
/* Convenience API */
|
196
|
+
RG_DEF_SMETHOD(pixbuf_from_file, 1);
|
197
|
+
RG_DEF_SMETHOD(pixbuf_from_file_at_zoom, 3);
|
198
|
+
RG_DEF_SMETHOD(pixbuf_from_file_at_size, 3);
|
199
|
+
RG_DEF_SMETHOD(pixbuf_from_file_at_max_size, 3);
|
200
|
+
RG_DEF_SMETHOD(pixbuf_from_file_at_zoom_with_max, 5);
|
201
|
+
|
202
|
+
RG_DEF_SMETHOD_P(cairo_available, 0);
|
203
|
+
|
204
|
+
Init_rsvg_handle(RG_TARGET_NAMESPACE);
|
205
|
+
Init_rsvg_dimensiondata(RG_TARGET_NAMESPACE);
|
206
|
+
}
|
@@ -0,0 +1,194 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005-2006 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2004 Kouhei Sutou <kou@cozmixng.org>
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
* MA 02110-1301 USA
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include "rsvg2.h"
|
24
|
+
|
25
|
+
#ifdef HAVE_TYPE_RSVGDIMENSIONDATA
|
26
|
+
|
27
|
+
#define RG_TARGET_NAMESPACE cDimensionData
|
28
|
+
|
29
|
+
#define RVAL2DIM(obj) ((RsvgDimensionData *)DATA_PTR(obj))
|
30
|
+
|
31
|
+
static VALUE RG_TARGET_NAMESPACE;
|
32
|
+
|
33
|
+
static ID id_closed;
|
34
|
+
static ID id_to_s;
|
35
|
+
|
36
|
+
static VALUE
|
37
|
+
to_s(VALUE obj)
|
38
|
+
{
|
39
|
+
return rb_funcall(obj, id_to_s, 0);
|
40
|
+
}
|
41
|
+
|
42
|
+
static void
|
43
|
+
rb_rsvg_dim_free(RsvgDimensionData *dimp)
|
44
|
+
{
|
45
|
+
if (dimp) {
|
46
|
+
free(dimp);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rb_rsvg_dim_alloc(VALUE klass)
|
52
|
+
{
|
53
|
+
RsvgDimensionData *dimp;
|
54
|
+
return Data_Make_Struct(klass, RsvgDimensionData, 0,
|
55
|
+
rb_rsvg_dim_free, dimp);
|
56
|
+
}
|
57
|
+
|
58
|
+
static VALUE
|
59
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
60
|
+
{
|
61
|
+
VALUE width, height, em, ex;
|
62
|
+
RsvgDimensionData *dimp;
|
63
|
+
|
64
|
+
dimp = RVAL2DIM(self);
|
65
|
+
rb_scan_args(argc, argv, "04", &width, &height, &em, &ex);
|
66
|
+
|
67
|
+
if (!NIL_P(width))
|
68
|
+
dimp->width = NUM2INT(width);
|
69
|
+
if (!NIL_P(height))
|
70
|
+
dimp->height = NUM2INT(height);
|
71
|
+
if (!NIL_P(em))
|
72
|
+
dimp->em = NUM2DBL(em);
|
73
|
+
if (!NIL_P(ex))
|
74
|
+
dimp->ex = NUM2DBL(ex);
|
75
|
+
|
76
|
+
return Qnil;
|
77
|
+
}
|
78
|
+
|
79
|
+
static VALUE
|
80
|
+
rg_width(VALUE self)
|
81
|
+
{
|
82
|
+
return INT2NUM(RVAL2DIM(self)->width);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
rg_set_width(VALUE self, VALUE width)
|
87
|
+
{
|
88
|
+
RVAL2DIM(self)->width = NUM2INT(width);
|
89
|
+
return Qnil;
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
rg_height(VALUE self)
|
94
|
+
{
|
95
|
+
return INT2NUM(RVAL2DIM(self)->height);
|
96
|
+
}
|
97
|
+
|
98
|
+
static VALUE
|
99
|
+
rg_set_height(VALUE self, VALUE height)
|
100
|
+
{
|
101
|
+
RVAL2DIM(self)->height = NUM2INT(height);
|
102
|
+
return Qnil;
|
103
|
+
}
|
104
|
+
|
105
|
+
static VALUE
|
106
|
+
rg_em(VALUE self)
|
107
|
+
{
|
108
|
+
return rb_float_new(RVAL2DIM(self)->em);
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE
|
112
|
+
rg_set_em(VALUE self, VALUE em)
|
113
|
+
{
|
114
|
+
RVAL2DIM(self)->em = NUM2DBL(em);
|
115
|
+
return Qnil;
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
rg_ex(VALUE self)
|
120
|
+
{
|
121
|
+
return rb_float_new(RVAL2DIM(self)->ex);
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
rg_set_ex(VALUE self, VALUE ex)
|
126
|
+
{
|
127
|
+
RVAL2DIM(self)->ex = NUM2DBL(ex);
|
128
|
+
return Qnil;
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE
|
132
|
+
rg_to_a(VALUE self)
|
133
|
+
{
|
134
|
+
return rb_ary_new3(4,
|
135
|
+
rg_width(self),
|
136
|
+
rg_height(self),
|
137
|
+
rg_em(self),
|
138
|
+
rg_ex(self));
|
139
|
+
}
|
140
|
+
|
141
|
+
static VALUE
|
142
|
+
rg_to_s(VALUE self)
|
143
|
+
{
|
144
|
+
VALUE ret;
|
145
|
+
|
146
|
+
ret = rb_str_new2("#<");
|
147
|
+
rb_str_cat2(ret, rb_obj_classname(self));
|
148
|
+
rb_str_cat2(ret, ":");
|
149
|
+
rb_str_concat(ret, rb_funcall(INT2NUM(self), id_to_s, 0));
|
150
|
+
rb_str_cat2(ret, " ");
|
151
|
+
|
152
|
+
rb_str_cat2(ret, "width=");
|
153
|
+
rb_str_concat(ret, to_s(rg_width(self)));
|
154
|
+
rb_str_cat2(ret, ", ");
|
155
|
+
rb_str_cat2(ret, "height=");
|
156
|
+
rb_str_concat(ret, to_s(rg_height(self)));
|
157
|
+
rb_str_cat2(ret, ", ");
|
158
|
+
rb_str_cat2(ret, "em=");
|
159
|
+
rb_str_concat(ret, to_s(rg_em(self)));
|
160
|
+
rb_str_cat2(ret, ", ");
|
161
|
+
rb_str_cat2(ret, "ex=");
|
162
|
+
rb_str_concat(ret, to_s(rg_ex(self)));
|
163
|
+
rb_str_cat2(ret, ">");
|
164
|
+
|
165
|
+
return ret;
|
166
|
+
}
|
167
|
+
#endif
|
168
|
+
|
169
|
+
void
|
170
|
+
Init_rsvg_dimensiondata(VALUE mRSVG)
|
171
|
+
{
|
172
|
+
#ifdef HAVE_TYPE_RSVGDIMENSIONDATA
|
173
|
+
id_closed = rb_intern("closed");
|
174
|
+
id_to_s = rb_intern("to_s");
|
175
|
+
|
176
|
+
RG_TARGET_NAMESPACE = rb_define_class_under(mRSVG, "DimensionData", rb_cObject);
|
177
|
+
|
178
|
+
rb_define_alloc_func(RG_TARGET_NAMESPACE, rb_rsvg_dim_alloc);
|
179
|
+
RG_DEF_METHOD(initialize, -1);
|
180
|
+
|
181
|
+
RG_DEF_METHOD(width, 0);
|
182
|
+
RG_DEF_METHOD(set_width, 1);
|
183
|
+
RG_DEF_METHOD(height, 0);
|
184
|
+
RG_DEF_METHOD(set_height, 1);
|
185
|
+
RG_DEF_METHOD(em, 0);
|
186
|
+
RG_DEF_METHOD(set_em, 1);
|
187
|
+
RG_DEF_METHOD(ex, 0);
|
188
|
+
RG_DEF_METHOD(set_ex, 1);
|
189
|
+
|
190
|
+
RG_DEF_METHOD(to_s, 0);
|
191
|
+
RG_DEF_METHOD(to_a, 0);
|
192
|
+
RG_DEF_ALIAS("to_ary", "to_a");
|
193
|
+
#endif
|
194
|
+
}
|