Class: DYI::Shape::Ellipse
Overview
Constant Summary
GraphicalElement::CLASS_REGEXP
Constants inherited
from Element
Element::ID_REGEXP
Instance Attribute Summary
Attributes inherited from Base
#anchor_href, #anchor_target, #attributes, #clipping, #parent
#css_class
Attributes inherited from Element
#description, #title
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#add_animation, #add_painting_animation, #add_transform_animation, #animate?, #animations, #clear_clipping, #draw_on, #has_marker?, #has_uri_reference?, #root_element?, #root_node?, #rotate, #scale, #set_clipping, #set_clipping_shapes, #set_event, #skew_x, #skew_y, #transform, #translate
#add_css_class, #add_event_listener, #css_classes, #event_listeners, #event_target?, #remove_css_class, #remove_event_listener, #set_event, #to_reused_source
Methods inherited from Element
#canvas, #child_elements, #has_uri_reference?, #id, #id=, #include_external_file?, #inner_id
Constructor Details
#initialize(center, radius_x, radius_y, options = {}) ⇒ Ellipse
Returns a new instance of Ellipse.
574
575
576
577
578
579
|
# File 'lib/dyi/shape/base.rb', line 574
def initialize(center, radius_x, radius_y, options={})
@center = Coordinate.new(center)
@radius_x = Length.new(radius_x).abs
@radius_y = Length.new(radius_y).abs
@attributes = init_attributes(options)
end
|
Class Method Details
.create_on_center_radius(center, radius_x, radius_y, options = {}) ⇒ Object
613
614
615
|
# File 'lib/dyi/shape/base.rb', line 613
def create_on_center_radius(center, radius_x, radius_y, options={})
new(center, radius_x, radius_y, options)
end
|
Instance Method Details
#bottom ⇒ Object
593
594
595
|
# File 'lib/dyi/shape/base.rb', line 593
def bottom
@center.y + @radius_y
end
|
#height ⇒ Object
601
602
603
|
# File 'lib/dyi/shape/base.rb', line 601
def height
@radius_y * 2
end
|
#left ⇒ Object
581
582
583
|
# File 'lib/dyi/shape/base.rb', line 581
def left
@center.x - @radius_x
end
|
#right ⇒ Object
585
586
587
|
# File 'lib/dyi/shape/base.rb', line 585
def right
@center.x + @radius_x
end
|
#top ⇒ Object
589
590
591
|
# File 'lib/dyi/shape/base.rb', line 589
def top
@center.y - @radius_y
end
|
#width ⇒ Object
597
598
599
|
# File 'lib/dyi/shape/base.rb', line 597
def width
@radius_x * 2
end
|
#write_as(formatter, io = $>) ⇒ Object
605
606
607
|
# File 'lib/dyi/shape/base.rb', line 605
def write_as(formatter, io=$>)
formatter.write_ellipse(self, io, &(block_given? ? Proc.new : nil))
end
|