Method: HexaPDF::Content::Canvas#fill

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

#fill(rule = :nonzero) ⇒ Object

:call-seq:

canvas.fill(rule = :nonzero)    => canvas

Fills the path using the given rule and returns self.

The argument rule may either be :nonzero to use the nonzero winding number rule or :even_odd to use the even-odd rule for determining which regions to fill in. Details on how these rules work are found in the PDF 2.0 spec section 8.5.3.3 or via Internet search.

Any open subpaths are implicitly closed before being filled.

Examples:

#>pdf
canvas.fill_color("hp-blue").
  polyline(20, 10, 90, 60, 10, 60, 80, 10, 50, 90).
  fill

canvas.fill_color("hp-orange").
  polyline(120, 110, 190, 160, 110, 160, 180, 110, 150, 190).
  fill(:even_odd)

See: PDF2.0 s8.5.3.1, s8.5.3.3, #fill_stroke, #close_fill_stroke



1590
1591
1592
1593
1594
# File 'lib/hexapdf/content/canvas.rb', line 1590

def fill(rule = :nonzero)
  raise_unless_in_path_or_clipping_path
  invoke0(rule == :nonzero ? :f : :'f*')
  self
end