Class: Postsvg::Svg::Elements::Ellipse
- Inherits:
-
Postsvg::Svg::Element
- Object
- Postsvg::Svg::Element
- Postsvg::Svg::Elements::Ellipse
- Defined in:
- lib/postsvg/svg/elements/ellipse.rb
Constant Summary collapse
- ELEMENT_NAME =
"ellipse"
Constants inherited from Postsvg::Svg::Element
Postsvg::Svg::Element::REGISTRY
Instance Attribute Summary collapse
-
#cx ⇒ Object
readonly
Returns the value of attribute cx.
-
#cy ⇒ Object
readonly
Returns the value of attribute cy.
-
#fill ⇒ Object
readonly
Returns the value of attribute fill.
-
#rx ⇒ Object
readonly
Returns the value of attribute rx.
-
#ry ⇒ Object
readonly
Returns the value of attribute ry.
-
#stroke ⇒ Object
readonly
Returns the value of attribute stroke.
-
#stroke_paint ⇒ Object
readonly
Returns the value of attribute stroke_paint.
Attributes inherited from Postsvg::Svg::Element
#attributes, #children, #clip_path_id, #transform
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cx:, cy:, rx:, ry:, fill:, stroke_paint:, stroke:, **rest) ⇒ Ellipse
constructor
A new instance of Ellipse.
Methods inherited from Postsvg::Svg::Element
#default_fill, #element_name, register, registry
Constructor Details
#initialize(cx:, cy:, rx:, ry:, fill:, stroke_paint:, stroke:, **rest) ⇒ Ellipse
Returns a new instance of Ellipse.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 12 def initialize(cx:, cy:, rx:, ry:, fill:, stroke_paint:, stroke:, **rest) super(**rest) @cx = cx @cy = cy @rx = rx @ry = ry @fill = fill @stroke_paint = stroke_paint @stroke = stroke end |
Instance Attribute Details
#cx ⇒ Object (readonly)
Returns the value of attribute cx.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def cx @cx end |
#cy ⇒ Object (readonly)
Returns the value of attribute cy.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def cy @cy end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def fill @fill end |
#rx ⇒ Object (readonly)
Returns the value of attribute rx.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def rx @rx end |
#ry ⇒ Object (readonly)
Returns the value of attribute ry.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def ry @ry end |
#stroke ⇒ Object (readonly)
Returns the value of attribute stroke.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def stroke @stroke end |
#stroke_paint ⇒ Object (readonly)
Returns the value of attribute stroke_paint.
10 11 12 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10 def stroke_paint @stroke_paint end |
Class Method Details
.from_node(node) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/postsvg/svg/elements/ellipse.rb', line 23 def self.from_node(node) new(cx: AttributeParser.number(node["cx"], default: 0), cy: AttributeParser.number(node["cy"], default: 0), rx: AttributeParser.number(node["rx"], default: 0), ry: AttributeParser.number(node["ry"], default: 0), fill: Paint.parse(node["fill"]), stroke_paint: Paint.parse(node["stroke"]), stroke: Stroke.parse(node), transform: TransformList.parse(node["transform"]), clip_path_id: Elements.parse_clip_path_id(node["clip-path"]), attributes: Elements.node_attributes(node)) end |