Adding stroke and fill to rect
parent
d34e4729ce
commit
bda920ebe6
|
|
@ -2,12 +2,13 @@ module Squib
|
||||||
class Deck
|
class Deck
|
||||||
|
|
||||||
def rect(range: :all, x: 0, y: 0, width: 825, height: 1125, \
|
def rect(range: :all, x: 0, y: 0, width: 825, height: 1125, \
|
||||||
radius: 0, x_radius: 0, y_radius: 0, color: :black)
|
radius: nil, x_radius: 0, y_radius: 0, \
|
||||||
|
fill_color: '#0000', stroke_color: :black, stroke_width: 2.0)
|
||||||
range = rangeify(range)
|
range = rangeify(range)
|
||||||
color = colorify(color)
|
color = colorify(color)
|
||||||
x_radius,y_radius = radiusify(radius, x_radius, y_radius)
|
x_radius,y_radius = radiusify(radius, x_radius, y_radius)
|
||||||
range.each do |i|
|
range.each do |i|
|
||||||
@cards[i].draw_rectangle(x, y, width, height, x_radius, y_radius, color)
|
@cards[i].draw_rectangle(x, y, width, height, x_radius, y_radius, fill_color, stroke_color, stroke_width)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
module Squib
|
module Squib
|
||||||
class Card
|
class Card
|
||||||
|
|
||||||
def draw_rectangle(x, y, width, height, x_radius, y_radius, color)
|
def draw_rectangle(x, y, width, height, x_radius, y_radius, fill_color, stroke_color, stroke_width)
|
||||||
cc = cairo_context
|
cc = cairo_context
|
||||||
cc.set_source_color(color)
|
|
||||||
cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
|
cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
|
||||||
|
cc.set_source_color(stroke_color)
|
||||||
|
cc.set_line_width(stroke_width);
|
||||||
cc.stroke
|
cc.stroke
|
||||||
|
cc.rounded_rectangle(x, y, width, height, x_radius, y_radius)
|
||||||
|
cc.set_source_color(fill_color)
|
||||||
|
cc.fill
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue