implement circle arc feature, no tests

This commit is contained in:
Clarence "Sparr" Risher
2017-03-10 22:48:21 -05:00
committed by Andy Meneely
parent 599e363e38
commit 573a1e9e30
4 changed files with 34 additions and 5 deletions
+3 -1
View File
@@ -16,7 +16,9 @@ module Squib
cx2: 0 , cy2: 0,
inner_radius: 50, outer_radius: 100,
radius: 100,
n: 5, }
n: 5,
arc_start: 0, arc_end: 2 * Math::PI, arc_ccw: false, arc_close: false,
}
end
def self.expanding_parameters
+1 -1
View File
@@ -25,7 +25,7 @@ module Squib
:operator=, :show_page, :clip, :transform, :mask, :create_pango_layout,
:antialias=, :curve_to, :matrix, :matrix=, :identity_matrix, :pango_layout_path,
:stroke_preserve, :target, :new_path, :fill_preserve, :close_path,
:set_line_join, :set_line_cap, :set_dash
:set_line_join, :set_line_cap, :set_dash, :arc, :arc_negative
# :nodoc:
# @api private
+9 -2
View File
@@ -18,8 +18,15 @@ module Squib
def circle(box, draw)
x, y, r = box.x, box.y, box.radius
use_cairo do |cc|
cc.move_to(x + r, y)
cc.circle(x, y, r)
# cc.move_to(x + r, y)
if box.arc_ccw
cc.arc_negative(x, y, r, box.arc_start, box.arc_end)
else
cc.arc(x, y, r, box.arc_start, box.arc_end)
end
if box.arc_close
cc.close_path();
end
cc.fill_n_stroke(draw)
end
end