Class: Pixelart::Vector::Circle

Inherits:
Shape
  • Object
show all
Defined in:
lib/pixelart/vector.rb

Instance Method Summary collapse

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_magickObject



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_svgObject



15
16
17
# File 'lib/pixelart/vector.rb', line 15

def to_svg
  %Q{<circle cx="#{@cx}" cy="#{@cy}" r="#{@r}" fill="#{@fill}" />}
end