Class: Pixelart::Vector::Circle
Instance Method Summary collapse
-
#initialize(cx, cy, r, fill:) ⇒ Circle
constructor
A new instance of Circle.
- #to_magick ⇒ Object
- #to_svg ⇒ Object
Constructor Details
#initialize(cx, cy, r, fill:) ⇒ Circle
Returns a new instance of Circle.
8 9 10 11 12 13 |
# File 'lib/pixelart/vector.rb', line 8 def initialize( cx, cy, r, fill: ) @cx = cx @cy = cy @r = r @fill = fill end |
Instance Method Details
#to_magick ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pixelart/vector.rb', line 19 def to_magick ## circle ## give the center and any point on the perimeter (boundary) px = @cx+@r py = @cy "-fill '#{@fill}' -draw 'circle #{@cx},#{@cy},#{px},#{py}'" end |
#to_svg ⇒ Object
15 16 17 |
# File 'lib/pixelart/vector.rb', line 15 def to_svg %Q{<circle cx="#{@cx}" cy="#{@cy}" r="#{@r}" fill="#{@fill}" />} end |