phantom_svg 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phantom/parser/png_writer.rb +10 -7
- data/phantom_svg.gemspec +1 -1
- data/spec/phantom/svg_spec.rb +45 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed311e5c5b6787b8984e939a0cd48a2ec06671e
|
4
|
+
data.tar.gz: fe58f330e16bc38f061a3465a35ba2ce889398b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0701c8cb58da9f3a988d8f85d4bcf84fac1819ce9a44c7c10de085b69d23c81c0f652416b4b24e28cf45bd2a73e54a174837ae1c66026eb0c5f5ab8f788a7d1
|
7
|
+
data.tar.gz: a151651bbb47d559781c53e3d1b6fc9e00bdb3acb448650cb224374f0fd6575369c722356240664dda2b1cd27bbdf65cfb4d44ddc4a45d2783100ec8f4e2168f
|
@@ -44,13 +44,16 @@ module Phantom
|
|
44
44
|
Parser::SVGWriter.new.write("#{path}.svg", frame)
|
45
45
|
|
46
46
|
handle = RSVG::Handle.new_from_file("#{path}.svg")
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height) do |surface|
|
48
|
+
Cairo::Context.new(surface) do |context|
|
49
|
+
context.scale(width.to_f / handle.dimensions.width,
|
50
|
+
height.to_f / handle.dimensions.height)
|
51
|
+
context.render_rsvg_handle(handle)
|
52
|
+
surface.write_to_png("#{path}.png")
|
53
|
+
surface.finish
|
54
|
+
end
|
55
|
+
end
|
56
|
+
handle.close
|
54
57
|
end
|
55
58
|
end # class PNGWriter
|
56
59
|
end # module Parser
|
data/phantom_svg.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'phantom_svg'
|
4
|
-
s.version = '1.1.
|
4
|
+
s.version = '1.1.6'
|
5
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' \
|
data/spec/phantom/svg_spec.rb
CHANGED
@@ -600,4 +600,49 @@ describe Phantom::SVG::Base do
|
|
600
600
|
@loader.save_svg(destination)
|
601
601
|
end
|
602
602
|
end
|
603
|
+
|
604
|
+
# describe 'leak test' do
|
605
|
+
# before(:all) do
|
606
|
+
# @source_dir = SPEC_SOURCE_DIR
|
607
|
+
# @destination_dir = SPEC_TEMP_DIR
|
608
|
+
# end
|
609
|
+
|
610
|
+
# it 'save_apng' do
|
611
|
+
# source = "#{@source_dir}/gradation_test/animation.json"
|
612
|
+
# destination = "#{@destination_dir}/leak_test.png"
|
613
|
+
|
614
|
+
# loop_count = 300
|
615
|
+
# print_interval = (loop_count / 100).to_i
|
616
|
+
# cr_interval = (loop_count / 10).to_i
|
617
|
+
|
618
|
+
# loader = Phantom::SVG::Base.new(source)
|
619
|
+
|
620
|
+
# loop_count.times do |i|
|
621
|
+
# loader.save_apng(destination)
|
622
|
+
|
623
|
+
# GC.start
|
624
|
+
|
625
|
+
# print '.' if ((i+1) % print_interval) == 0
|
626
|
+
# print '|' if ((i+1) % cr_interval) == 0
|
627
|
+
# end
|
628
|
+
# end
|
629
|
+
|
630
|
+
# # it 'simple test' do
|
631
|
+
# # source = "#{@source_dir}/gradation_test/0.svg"
|
632
|
+
|
633
|
+
# # loop_count = 5000
|
634
|
+
# # print_interval = (loop_count / 100).to_i
|
635
|
+
# # cr_interval = (loop_count / 10).to_i
|
636
|
+
|
637
|
+
# # loop_count.times do |i|
|
638
|
+
# # handle = RSVG::Handle.new_from_file(source)
|
639
|
+
# # handle.close
|
640
|
+
|
641
|
+
# # GC.start
|
642
|
+
|
643
|
+
# # print '.' if ((i+1) % print_interval) == 0
|
644
|
+
# # print '|' if ((i+1) % cr_interval) == 0
|
645
|
+
# # end
|
646
|
+
# # end
|
647
|
+
# end
|
603
648
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantom_svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rika Yoshida
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cairo
|