Class: Clogs::Arc
- Inherits:
-
ArtDrawable
- Object
- Shoes::Linkable
- Drawable
- ArtDrawable
- Clogs::Arc
- Defined in:
- lib/clogs/drawables/shapes.rb
Instance Attribute Summary
Attributes inherited from Drawable
#abs_x, #abs_y, #children, #height, #parent, #shoes_linkable_id, #styles, #width, #x, #y
Instance Method Summary collapse
Methods inherited from ArtDrawable
#context_style, #draw_context, #fill_paint, #left, #opaque, #paint, #parent_content_width, #positioned?, #rotation, #stroke_paint, #strokewidth, #top
Methods inherited from Drawable
#add_child, #app, #clickable?, #contains?, #destroy_self, #each_peer, #focus_gained, #focus_lost, #focusable?, for_shoes_class, #hidden?, #initialize, #margin, #needs_layout!, #notify, #on_click, #on_key, #on_mouse_move, #on_release, #paint, #positioned?, #properties_changed, #redraw!, #remove_child, #requested_height, #requested_width, #set_parent, #style
Constructor Details
This class inherits a constructor from Clogs::Drawable
Instance Method Details
#draw(painter, x, y) ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/clogs/drawables/shapes.rb', line 187 def draw(painter, x, y) a1 = style(:angle1).to_f a2 = style(:angle2).to_f sweep = a2 - a1 radius = [@width, @height].min / 2.0 cx = x + @width / 2.0 cy = y + @height / 2.0 painter.draw(fill: fill_paint, stroke: stroke_paint, thickness: strokewidth) do |p| p.move_to(cx, cy) if style(:wedge) p.arc_figure(cx, cy, radius, a1, sweep) unless style(:wedge) p.arc_to(cx, cy, radius, a1, sweep) if style(:wedge) p.close if style(:wedge) end end |