Method: HexaPDF::Content::Canvas#fill_stroke

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

#fill_stroke(rule = :nonzero) ⇒ Object

:call-seq:

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

Fills and then strokes the path using the given rule. 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.

Note that any open subpaths are not closed concerning the stroking operation.

Examples:

#>pdf
canvas.stroke_color("hp-orange").line_width(3)
canvas.fill_color("hp-blue").
  polyline(20, 10, 90, 60, 10, 60, 80, 10, 50, 90).
  fill_stroke                 # Note the missing stroke from the top corner

canvas.fill_color("hp-teal").
  polyline(120, 110, 190, 160, 110, 160, 180, 110, 150, 190).
  fill_stroke(:even_odd)      # Note the missing stroke from the top corner

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



1620
1621
1622
1623
1624
# File 'lib/hexapdf/content/canvas.rb', line 1620

def fill_stroke(rule = :nonzero)
  raise_unless_in_path_or_clipping_path
  invoke0(rule == :nonzero ? :B : :'B*')
  self
end