Sha256: f1b733107c8f1e7ee1c5d3e38cfbba699d0f862ed5ef4dd022e9ed946ef20a5c

Contents?: true

Size: 554 Bytes

Versions: 3

Compression:

Stored size: 554 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 = x_pixels(attributes['rx'])
    @ry = y_pixels(attributes['ry'])

    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

3 entries across 3 versions & 1 rubygems

Version Path
prawn-svg-0.36.0 lib/prawn/svg/elements/ellipse.rb
prawn-svg-0.35.1 lib/prawn/svg/elements/ellipse.rb
prawn-svg-0.35.0 lib/prawn/svg/elements/ellipse.rb