Added circle shape
This commit is contained in:
@@ -6,6 +6,7 @@ module Squib
|
||||
# @example
|
||||
# rect x: 0, y: 0, width: 825, height: 1125, radius: 25
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:API.md#label-Specifying+Ranges Specifying Ranges}
|
||||
# @option opts x [Integer] (0) the x-coordinate to place
|
||||
# @option opts y [Integer] (0) the y-coordinate to place
|
||||
# @option opts width [Integer] the width of the rectangle.
|
||||
@@ -27,6 +28,30 @@ module Squib
|
||||
opts[:fill_color], opts[:stroke_color], opts[:stroke_width])
|
||||
end
|
||||
end
|
||||
|
||||
# Draw a circle centered at the given coordinates
|
||||
#
|
||||
# @example
|
||||
# circle x: 0, y: 0, radius: 100
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:API.md#label-Specifying+Ranges Specifying Ranges}
|
||||
# @option opts x [Integer] (0) the x-coordinate to place
|
||||
# @option opts y [Integer] (0) the y-coordinate to place
|
||||
# @option opts radius [Integer] (100) radius of the circle
|
||||
# @option opts fill_color [String] ('#0000') the color with which to fill the rectangle
|
||||
# @option opts stroke_color [String] (:black) the color with which to stroke the outside of the rectangle
|
||||
# @option opts stroke_width [Decimal] (2.0) the width of the outside stroke
|
||||
# @return [nil] intended to be void
|
||||
# @api public
|
||||
def circle(opts = {})
|
||||
opts = {radius: 100}.merge(opts)
|
||||
opts = needs(opts, [:range, :x, :y, :circle_radius, :layout,
|
||||
:fill_color, :stroke_color, :stroke_width])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].circle(opts[:x], opts[:y], opts[:radius],
|
||||
opts[:fill_color], opts[:stroke_color], opts[:stroke_width])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user