module HexaPDF::Content::LineCapStyle

Defines all available line cap styles as constants. Each line cap style is an instance of NamedValue. For use with Content::GraphicsState#line_cap_style.

See: PDF1.7 s8.4.3.3

Constants

BUTT_CAP

Stroke is squared off at the endpoint of a path.

PROJECTING_SQUARE_CAP

The stroke continues half the line width beyond the endpoint of a path.

ROUND_CAP

A semicircular arc is drawn at the endpoint of a path.

Public Class Methods

normalize(style) click to toggle source

Returns the argument normalized to a valid line cap style.

  • 0 or :butt can be used for the BUTT_CAP style.

  • 1 or :round can be used for the ROUND_CAP style.

  • 2 or :projecting_square can be used for the PROJECTING_SQUARE_CAP style.

  • Otherwise an error is raised.

# File lib/hexapdf/content/graphics_state.rb, line 86
def self.normalize(style)
  case style
  when :butt, 0 then BUTT_CAP
  when :round, 1 then ROUND_CAP
  when :projecting_square, 2 then PROJECTING_SQUARE_CAP
  else
    raise ArgumentError, "Unknown line cap style: #{style}"
  end
end