Created
September 9, 2010 00:08
-
-
Save rhyhann/571108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# API Showcase | |
svg = Ralphy::Container.new(width:300,height:200) | |
# Drawing a simple circle within a rectangle: | |
# All of Ralphy's classes derive from Nokogiri's | |
circle = Ralphy::Circle.new # Can't be added to svg until all its required arguments are passed (center and radius) | |
rectangle = Ralphy::Rectangle.new # required: center || (top|bottom)-(left|right) position, height, and width | |
rectangle.center = circle.center = svg.center # svg.center is generated | |
circle.center = (rectangle.width = svg.width/2)/2 | |
rectangle.height = svg.height/2 | |
svg += [rectangle, circle] # OR svg << rectangle; svg << circle | |
svg.to_svg # OR svg.to_png, which will use ImageMagick. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment