rsvg2 3.1.6-x86-mingw32 → 3.1.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5338da7fcfa74c917b92e4e65b42d0acfac9bc2
4
- data.tar.gz: 0adf78558c57260f7c8d95d046baf954ea2a7bfe
3
+ metadata.gz: 57b807185441fc06f66e0e572ed0428dea895eaa
4
+ data.tar.gz: 0c9bcc6ebe0f62dd0525bf2515b446079d61d223
5
5
  SHA512:
6
- metadata.gz: 3d6b99cabb45eebd98f6b2652490f168bc03b5b4e5715e4c9322dc3fe61196955a6b5eb66cfaa3252299285b7afc48426e4c6f05d7decb158578ef6f5528d499
7
- data.tar.gz: 340a067f522659e636c0cc70cee07322d9395bed69277c5fa33c09f70e5e2178826e7db56a401901c8f12633136665355a292c9084f0df15d678089b5e2e03b1
6
+ metadata.gz: b239b52431a0c006df159e9c6b045c714ac92bc6e0042bf086e83f78aaa3d1cbba8e93088555165ed5eea21cae254eaf25eac9a4811494d13982d9f525ad9b0a
7
+ data.tar.gz: 1771764bde70546d6714d8ee52110c9f43e2fe185f4fb6ffc1af79a3b4f67f77ffba152e64b7c712b0832b02bd0fa51a7d6cdcdc34c7ff87686faaa90dcd425f
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2010-2015 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2010-2017 Ruby-GNOME2 Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,11 @@ require 'gnome2-raketask'
22
22
  package_task = GNOME2::Rake::PackageTask.new do |package|
23
23
  package.summary = "Ruby/Rsvg is a Ruby binding of librsvg-2.x."
24
24
  package.description = "Ruby/Rsvg is a Ruby binding of librsvg-2.x."
25
- package.dependency.gem.runtime = [["cairo", ">= 1.12.8"], "gdk_pixbuf2"]
25
+ package.dependency.gem.runtime = [
26
+ ["cairo", ">= 1.12.8"],
27
+ "gdk_pixbuf2",
28
+ "cairo-gobject",
29
+ ]
26
30
  package.windows.packages = []
27
31
  package.windows.dependencies = []
28
32
  package.windows.build_dependencies = [
@@ -30,9 +34,12 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
30
34
  "gobject-introspection",
31
35
  "pango",
32
36
  "gdk_pixbuf2",
37
+ "cairo-gobject",
33
38
  ]
34
39
  package.windows.gobject_introspection_dependencies = [
40
+ "pango",
35
41
  "gdk_pixbuf2",
42
+ "cairo-gobject",
36
43
  ]
37
44
  package.cross_compiling do |spec|
38
45
  if /mingw|mswin/ =~ spec.platform.to_s
data/lib/rsvg2.rb CHANGED
@@ -18,6 +18,7 @@ require "gobject-introspection"
18
18
  require "glib2"
19
19
  require "gio2"
20
20
  require "gdk_pixbuf2"
21
+ require "cairo-gobject"
21
22
  require "cairo"
22
23
 
23
24
  base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gtk2'
4
+ require 'rsvg2'
5
+
6
+ if ARGV.size != 1
7
+ puts "usage: #{$0} input.svg"
8
+ exit(-1)
9
+ end
10
+
11
+ input = ARGV.shift
12
+
13
+ handle = Rsvg::Handle.new(:path => input)
14
+ width, height = handle.dimensions.to_a
15
+
16
+ window = Gtk::Window.new
17
+ window.set_default_size(width, height)
18
+ area = Gtk::DrawingArea.new
19
+
20
+ window.signal_connect(:destroy) do
21
+ Gtk.main_quit
22
+ end
23
+
24
+ area.signal_connect(:expose_event) do |widget, event|
25
+ context = widget.window.create_cairo_context
26
+ window_width, window_height = widget.window.size
27
+ context.scale(window_width.to_f / width, window_height.to_f / height)
28
+ context.render_rsvg_handle(handle)
29
+ end
30
+
31
+ window.add(area)
32
+ window.show_all
33
+
34
+ Gtk.main
data/sample/svg2.rb ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ svg2.rb - Ruby/RSVG sample script.
4
+
5
+ Copyright (c) 2006-2017 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+ =end
8
+
9
+ require 'tempfile'
10
+ require "rsvg2"
11
+
12
+ if ARGV.size < 2
13
+ puts "usage: #{$0} input.svg output [scale_ratio]"
14
+ exit(-1)
15
+ end
16
+
17
+ input, output, ratio = ARGV
18
+ ratio ||= 1.0
19
+ ratio = ratio.to_f
20
+
21
+ output_type = File.extname(output)[1..-1].downcase
22
+ output_type = "jpeg" if /jpg/ =~ output_type
23
+
24
+ def to_pixbuf(input, ratio)
25
+ handle = nil
26
+ Dir.chdir(File.dirname(File.expand_path(input))) do
27
+ handle = Rsvg::Handle.new(:path => input)
28
+ end
29
+ dim = handle.dimensions
30
+ width = dim.width * ratio
31
+ height = dim.height * ratio
32
+ surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height)
33
+ cr = Cairo::Context.new(surface)
34
+ cr.scale(ratio, ratio)
35
+ cr.render_rsvg_handle(handle)
36
+ temp = Tempfile.new("svg2")
37
+ cr.target.write_to_png(temp.path)
38
+ cr.target.finish
39
+ GdkPixbuf::Pixbuf.new(:file => temp.path)
40
+ end
41
+
42
+ pixbuf = to_pixbuf(input, ratio)
43
+ if pixbuf.nil?
44
+ puts "Is it a SVG file?: #{input}"
45
+ exit(-1)
46
+ end
47
+ puts "saving to #{output}(#{pixbuf.width}x#{pixbuf.height})..."
48
+ pixbuf.save(output, output_type)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsvg2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cairo
@@ -30,28 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.6
33
+ version: 3.1.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.6
40
+ version: 3.1.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: cairo-gobject
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.7
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.7
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pango
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: 3.1.6
61
+ version: 3.1.7
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 3.1.6
68
+ version: 3.1.7
55
69
  description: Ruby/Rsvg is a Ruby binding of librsvg-2.x.
56
70
  email: ruby-gnome2-devel-en@lists.sourceforge.net
57
71
  executables: []
@@ -66,6 +80,8 @@ files:
66
80
  - lib/rsvg2/handle.rb
67
81
  - lib/rsvg2/loader.rb
68
82
  - lib/rsvg2/version.rb
83
+ - sample/svg-viewer.rb
84
+ - sample/svg2.rb
69
85
  - test/rsvg2-test-utils.rb
70
86
  - test/run-test.rb
71
87
  - test/test-handle.rb