Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform #9

Open
vovin-lonshin opened this issue Feb 14, 2014 · 1 comment
Open

Transform #9

vovin-lonshin opened this issue Feb 14, 2014 · 1 comment

Comments

@vovin-lonshin
Copy link

can not use the transform "style" to do things like rotation and scaling.
I forked and added code to "write_style(style)"
It works with text but still need to test with other objects
exp:
File.open("test.svg", "w") do |f|
Rasem::SVGImage.new(100, 100, f) do |f|
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "O", :font_family=>"Akho Desire", "font-size"=>24
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "I", :font_family=>"Akho Will", "font-size"=>24
text 50+(-10+(rand(20))), 50+(-10+(rand(20))), "A", :font_family=>"Akho Believe", "font-size"=>24, :transform=>" matrix(0,1,-1,0,0,0)"
end
end

@vovin-lonshin
Copy link
Author

tested with other objects, and it was not working at all.
updated the code to fix that bug in my code.
transform now works with all objects, even groups.
but everything, except text, losses the default_style, so you have to include stroke style:
exp:
File.open("test.svg", "w") do |f|
Rasem::SVGImage.new(100, 100, f) do |f|
group :stroke=>"black", :transform=>" matrix(0,1,-1,0,0,0)" do
circle 20, 20, 5
circle 50, 50, 5
line 20, 20, 50, 50, :stroke=>"blue"
end
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant