phantom_svg 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6580bef212ec7f4f1d43dc3405e0243b95ae9fd
4
- data.tar.gz: 11c27a5533bb0c7ae2e05f95cc1782878d4200fb
3
+ metadata.gz: bef19b043049de58cbe8f6f6b1760f25415760d7
4
+ data.tar.gz: 42612111601ec34a3383ff81909a95c2e403397b
5
5
  SHA512:
6
- metadata.gz: 17d4cdb9a98c7aa7e9397fb1ddae4ab4370b375de8f703252e1022b9067aff5cca3966054b7493be1eef64e7d5f5c0f1dd17792cdcdbd5d68a6d0e541901e621
7
- data.tar.gz: fd59d981ca5e03034e333f8586d130114e9b35b886f5e172b6f78abefe384ac0602cc665359f4df2344f4b84621a6b60255365a99eec5c9325879d933bf76fb6
6
+ metadata.gz: 42c97170d698d23a0adba93a12f9fe6e8f0021b5a0d10b4f10e5bbda198354a072747f2f5fb7ed8e17cec461564eeb006bdf91ccb2dd83b1229f9c382e506229
7
+ data.tar.gz: 61dc006678e0d5524381c1d198fcd1b1638032cac52342671bf31ddf0a31b698b88d4aa67041a948f061ca53b4e4ea93d0a8b504e5e6bbd73eb8dfc8c762acd4
@@ -1,6 +1,7 @@
1
1
  require 'rexml/document'
2
2
  require 'RMagick'
3
3
  require 'rsvg2'
4
+ require 'base64'
4
5
 
5
6
  require_relative '../frame'
6
7
  require_relative 'abstract_image_reader'
@@ -35,8 +36,8 @@ module Phantom
35
36
  frame.width = "#{img.columns}px"
36
37
  frame.height = "#{img.rows}px"
37
38
  frame.viewbox.set_from_text("0 0 #{img.columns} #{img.rows}")
38
- frame.surfaces = create_surfaces(path, img.columns, img.rows)
39
- frame.duration = img.delay * 10.0 unless img.delay.nil?
39
+ frame.surfaces = create_surfaces(img)
40
+ frame.duration = img.delay * 0.1 unless img.delay.nil?
40
41
  frame.namespaces = {
41
42
  'xmlns' => 'http://www.w3.org/2000/svg',
42
43
  'xlink' => 'http://www.w3.org/1999/xlink'
@@ -47,15 +48,15 @@ module Phantom
47
48
  end
48
49
 
49
50
  # Create surfaces.
50
- def create_surfaces(path, width, height)
51
- bin = File.binread(path)
52
- base64 = [bin].pack('m')
51
+ def create_surfaces(img)
52
+ img.format = 'PNG'
53
+ base64 = Base64.encode64(img.to_blob)
53
54
 
54
55
  image = REXML::Element.new('image')
55
56
  image.add_attributes(
56
- 'width' => width,
57
- 'height' => height,
58
- 'xlink:href' => "data:image/gif;base64,#{base64}"
57
+ 'width' => img.columns,
58
+ 'height' => img.rows,
59
+ 'xlink:href' => "data:image/png;base64,#{base64}"
59
60
  )
60
61
 
61
62
  [image]
data/phantom_svg.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = 'phantom_svg'
4
- s.version = '1.0.5'
5
- s.license = 'LGPL-3.0'
4
+ s.version = '1.1.0'
5
+ s.license = 'LGPL-3'
6
6
  s.summary = 'Hight end SVG manipulation tools for Ruby'
7
7
  s.description = 'Hight end SVG manipulation tools for Ruby.\n' \
8
8
  'Includes chained keyframe generation, (A)PNG conversion and more.'
9
- s.authors = ['Rika Yoshida', 'Rei Kagetsuki', 'Naoki Iwakawa']
9
+ s.authors = ['Rika Yoshida', 'Naoki Iwakawa', 'Rei Kagetsuki']
10
10
  s.email = 'info@genshin.org'
11
11
  s.homepage = 'http://github.com/Genshin/phantom_svg'
12
12
 
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantom_svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rika Yoshida
8
- - Rei Kagetsuki
9
8
  - Naoki Iwakawa
9
+ - Rei Kagetsuki
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-03 00:00:00.000000000 Z
13
+ date: 2014-10-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cairo
@@ -162,7 +162,7 @@ files:
162
162
  - spec/spec_helper.rb
163
163
  homepage: http://github.com/Genshin/phantom_svg
164
164
  licenses:
165
- - LGPL-3.0
165
+ - LGPL-3
166
166
  metadata: {}
167
167
  post_install_message:
168
168
  rdoc_options: []
@@ -248,4 +248,3 @@ test_files:
248
248
  - spec/images/test_raster.png
249
249
  - spec/phantom/svg_spec.rb
250
250
  - spec/spec_helper.rb
251
- has_rdoc: