Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sibblingz/swf_to_svg
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Chu committed Feb 13, 2010
2 parents 61b0718 + ab8699c commit 9cd89de
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
Binary file modified beehive.swf
Binary file not shown.
2 changes: 1 addition & 1 deletion models/shape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Shape

def to_svg
path = shape_records.map{|record| record.to_svg(self) }.join(' ')
"<?xml version='1.0' standalone='no'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width='10cm' height='10cm' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg' version='1.1'>#{path}</svg>"
"<?xml version='1.0' standalone='no'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width='50cm' height='50cm' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg' version='1.1'>#{path}</svg>"
end

def to_txt
Expand Down
11 changes: 8 additions & 3 deletions models/shape_records/style_change_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ def to_svg( shape )
# there isn't always a "path" when we move...
if state_move_to
return_val = "<path "
if state_fill_style_1
fill_style = shape.fill_styles[fill_style_1 - 1]
color = fill_style.color
return_val += "fill-style-1='rgb(#{color.r}, #{color.g}, #{color.b})' "
end

if state_fill_style_0
fill_style = shape.fill_styles[fill_style_0 - 1]
color = fill_style.color
return_val += "fill='rgb(#{color.r}, #{color.g}, #{color.b})' "
return_val += "fill-style-0='rgb(#{color.r}, #{color.g}, #{color.b})'"
end

return_val += "stroke='red' stroke-width='0' d='
M#{move_delta_x/20.0},#{move_delta_y/20.0}"
return_val += " fill='none' stroke='black' stroke-width='0.5' d='M#{move_delta_x/20.0},#{move_delta_y/20.0}"

if shape.shape_records.first != self
return_val = "' />" + return_val
Expand Down
12 changes: 6 additions & 6 deletions tags/tag_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ def define_shape( tag_length, f, version )

# d = get_dictionary
# d[ shape_id ] = shape
#
# filename = "output/#{shape_id}.svg"
# puts "writing file #{filename}"
# output = File.open(filename, "w")
# output.write shape.to_svg
# output.close

filename = "output/#{shape_id}.svg"
puts "writing file #{filename}"
output = File.open(filename, "w")
output.write shape.to_svg
output.close
else
tag_length.times do
f.getc
Expand Down

0 comments on commit 9cd89de

Please sign in to comment.