Method: HexaPDF::Content::Canvas#circle

Defined in:
lib/hexapdf/content/canvas.rb

#circle(cx, cy, radius) ⇒ Object

:call-seq:

canvas.circle(cx, cy, radius)      => canvas

Appends a circle with center (cx, cy) and the given radius (in degrees) to the path as a complete subpath (drawn in counterclockwise direction). The point (center_x + radius, center_y) becomes the new current point. Returns self.

If there is no current path when the method is invoked, a new path is automatically begun.

Examples:

#>pdf
canvas.circle(100, 100, 30)
cp = canvas.current_point
canvas.stroke
canvas.stroke_color("hp-orange").line(*cp, 180, 100).stroke

See: #arc (for approximation accuracy), #ellipse



1285
1286
1287
1288
# File 'lib/hexapdf/content/canvas.rb', line 1285

def circle(cx, cy, radius)
  arc(cx, cy, a: radius)
  close_subpath
end