Class: Postsvg::Svg::Elements::Ellipse

Inherits:
Postsvg::Svg::Element show all
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

Attributes inherited from Postsvg::Svg::Element

#attributes, #children, #clip_path_id, #transform

Class Method Summary collapse

Instance Method Summary collapse

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

#cxObject (readonly)

Returns the value of attribute cx.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def cx
  @cx
end

#cyObject (readonly)

Returns the value of attribute cy.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def cy
  @cy
end

#fillObject (readonly)

Returns the value of attribute fill.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def fill
  @fill
end

#rxObject (readonly)

Returns the value of attribute rx.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def rx
  @rx
end

#ryObject (readonly)

Returns the value of attribute ry.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def ry
  @ry
end

#strokeObject (readonly)

Returns the value of attribute stroke.



10
11
12
# File 'lib/postsvg/svg/elements/ellipse.rb', line 10

def stroke
  @stroke
end

#stroke_paintObject (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