class Glimmer::LibUI::Shape::Arc

Public Instance Methods

draw(area_draw_params) click to toggle source
Calls superclass method Glimmer::LibUI::Shape#draw
# File lib/glimmer/libui/shape/arc.rb, line 31
def draw(area_draw_params)
  arc_args = @args.dup
  arc_args[3] = Glimmer::LibUI.degrees_to_radians(arc_args[3])
  arc_args[4] = Glimmer::LibUI.degrees_to_radians(arc_args[4])
  arc_args[5] = Glimmer::LibUI.boolean_to_integer(arc_args[5], allow_nil: false)
  if parent.is_a?(Figure) && parent.x.nil? && parent.y.nil?
    ::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
  else
    if OS.windows? && parent.children.find {|child| child.is_a?(Arc)} == self
      ::LibUI.draw_path_new_figure_with_arc(path_proxy.libui, *arc_args)
    else
      ::LibUI.draw_path_arc_to(path_proxy.libui, *arc_args)
    end
  end
  super
end
perfect_shape() click to toggle source
# File lib/glimmer/libui/shape/arc.rb, line 48
def perfect_shape
  perfect_shape_dependencies = [x_center, y_center, radius, start_angle, sweep, is_negative]
  if perfect_shape_dependencies != @perfect_shape_dependencies
    x_center, y_center, radius, start_angle, sweep, is_negative = @perfect_shape_dependencies = perfect_shape_dependencies
    sign = is_negative ? 1 : -1
    start = is_negative ? (360 - start_angle) : -1*start_angle
    extent = is_negative ? (360 - sweep) : -1*sweep
    @perfect_shape = PerfectShape::Arc.new(
      type: :open,
      center_x: x_center, center_y: y_center,
      radius_x: radius, radius_y: radius,
      start: start, extent: extent
    )
  end
  @perfect_shape
end