Commit 95697b5

mo khan <mo@mokhan.ca>
2015-04-08 22:53:13
draw some other shapes.
1 parent 0479c96
Changed files (2)
app
assets
stylesheets
models
app/assets/stylesheets/home.scss
@@ -1,3 +1,8 @@
 // Place all the styles related to the home controller here.
 // They will automatically be included in application.css.
 // You can use Sass (SCSS) here: http://sass-lang.com/
+
+img {
+  width: 1025px;
+  height: 768px;
+}
app/models/image.rb
@@ -1,16 +1,19 @@
 class Image
   def self.find(id)
     svg = Scale::SVG.new(width: "100%", height: "100%")
-    path = Scale::Path.new
-    path.move_to(x: 10, y: 10)
-    10.times do |n|
-      path.horizontal(90, relative: true)
-      path.vertical(90, relative: true)
-      path.horizontal(10, relative: true)
-    end
-    path.close_path
 
-    svg.add(path)
+    svg.add(Scale::Text.new("HELLO WORLD #{id}", x: 250, y: 250, font_size: 55, font_family: "Verdana"))
+    svg.add(Scale::Path.new.tap do |path|
+      path.move_to(x: 20, y: 1)
+      10.times do |n|
+        path.horizontal(rand(50), relative: true)
+        path.vertical(rand(50), relative: true)
+        path.horizontal(rand(50), relative: true)
+      end
+      path.close_path
+    end)
+    svg.add(Scale::Circle.new(r: 10, cx: 100, cy: 100))
+    svg.add(Scale::Rectangle.new(width: 10, height: 100, x: 200, y: 200))
     svg
   end
 end