Sha256: 9c546ed0c0a8df71911e44ff27bbcd52f84625a2867aaa92d571235fa340832f

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 Bytes

Contents

class Prawn::SVG::Elements::Ellipse < Prawn::SVG::Elements::Base
  USE_NEW_ELLIPSE_CALL = Prawn::Document.instance_methods.include?(:ellipse)

  def parse
    require_attributes 'rx', 'ry'

    @x = x(attributes['cx'] || "0")
    @y = y(attributes['cy'] || "0")
    @rx = distance(attributes['rx'], :x)
    @ry = distance(attributes['ry'], :y)

    require_positive_value @rx, @ry
  end

  def apply
    add_call USE_NEW_ELLIPSE_CALL ? "ellipse" : "ellipse_at", [@x, @y], @rx, @ry
  end

  def bounding_box
    [@x - @rx, @y + @ry, @x + @rx, @y - @ry]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prawn-svg-0.24.0 lib/prawn/svg/elements/ellipse.rb
prawn-svg-0.23.1 lib/prawn/svg/elements/ellipse.rb
prawn-svg-0.23.0 lib/prawn/svg/elements/ellipse.rb
prawn-svg-0.22.1 lib/prawn/svg/elements/ellipse.rb