Class: Glimmer::Gtk::Shape::Polyline
- Inherits:
-
Glimmer::Gtk::Shape
- Object
- Glimmer::Gtk::Shape
- Glimmer::Gtk::Shape::Polyline
- Defined in:
- lib/glimmer/gtk/shape/polyline.rb
Overview
Represents a polyline (an open path consisting of lines)
Constant Summary
Constants inherited from Glimmer::Gtk::Shape
SHAPE_FILL_PROPERTIES, SHAPE_FONT_PROPERTIES, SHAPE_GENERAL_PROPERTIES, SHAPE_STROKE_PROPERTIES
Instance Attribute Summary
Attributes inherited from Glimmer::Gtk::Shape
#args, #block, #clip, #fill, #keyword, #parent, #stroke
Instance Method Summary collapse
Methods inherited from Glimmer::Gtk::Shape
#apply_property, constant_symbol, #content, create, descendant_keyword_constant_map, #draw, #draw_clip, #draw_fill, #draw_font, #draw_stroke, exist?, #initialize, keyword, map_descendant_keyword_constants_for, #method_missing, one_based_color_rgb, #post_add_content, #post_initialize_child, reset_descendant_keyword_constant_map, #respond_to?, set_source_dynamically, shape_class, #window_proxy
Methods included from Transformable
#apply_transforms, #initialize, #rotate, #scale, #translate
Constructor Details
This class inherits a constructor from Glimmer::Gtk::Shape
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::Gtk::Shape
Instance Method Details
#draw_shape(drawing_area_widget, cairo_context) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/glimmer/gtk/shape/polyline.rb', line 65 def draw_shape(, cairo_context) cairo_context.new_path the_points = points the_points.each_with_index do |point, i| if i == 0 cairo_context.move_to(*point) else cairo_context.line_to(*point) end end end |
#points ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/glimmer/gtk/shape/polyline.rb', line 77 def points the_points = [] @args.each_with_index do |arg, i| if i.even? the_points << [arg] else the_points.last << arg end end the_points end |