class Glimmer::LibUI::Shape::Polygon
Public Instance Methods
draw(area_draw_params)
click to toggle source
Calls superclass method
Glimmer::LibUI::Shape#draw
# File lib/glimmer/libui/shape/polygon.rb, line 31 def draw(area_draw_params) alternating_x_y_array = point_array.to_a.compact.flatten unless alternating_x_y_array.empty? ::LibUI.draw_path_new_figure(path_proxy.libui, alternating_x_y_array[0], alternating_x_y_array[1]) ((alternating_x_y_array.size - 2) / 2).times do |n| point_alternating_x_y_index = n * 2 ::LibUI.draw_path_line_to(path_proxy.libui, alternating_x_y_array[point_alternating_x_y_index + 2], alternating_x_y_array[point_alternating_x_y_index + 3]) end ::LibUI.draw_path_close_figure(path_proxy.libui) end super end
perfect_shape()
click to toggle source
# File lib/glimmer/libui/shape/polygon.rb, line 44 def perfect_shape perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array) if perfect_shape_dependencies != @perfect_shape_dependencies point_array = @perfect_shape_dependencies = perfect_shape_dependencies path_shapes = [point_array.first] path_shapes += point_array.drop(1).map { |point| PerfectShape::Line.new(points: [point]) } @perfect_shape = PerfectShape::Path.new(closed: true, shapes: path_shapes) end @perfect_shape end