Method: PDF::Writer::Graphics#segment_at

Defined in:
lib/pdf/writer/graphics.rb

#segment_at(x, y, r1, r2 = r1, start = 0, stop = 360, segments = 8) ⇒ Object

Draws an ellipse segment. Draws a closed partial ellipse.

New Point

(x, y)

Subpath

New



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/pdf/writer/graphics.rb', line 301

def segment_at(x, y, r1, r2 = r1, start = 0, stop = 360, segments = 8)
  ellipse2_at(x, y, r1, r2, start, stop, segments)

  start = PDF::Math.deg2rad(start)
  stop  = PDF::Math.deg2rad(stop)

  ax = x + r1 * Math.cos(start)
  ay = y + r2 * Math.sin(start)
  bx = x + r1 * Math.cos(stop)
  by = y + r2 * Math.sin(stop)

  move_to(ax, ay)
  line_to(x, y)
  line_to(bx, by)
  move_to(x, y)
  self
end