Module: HexaPDF::Content::LineJoinStyle
- Defined in:
- lib/hexapdf/content/graphics_state.rb
Overview
Defines all available line join styles as constants. Each line join style is an instance of NamedValue, see ::normalize For use with e.g. Canvas#line_join_style.
See: PDF2.0 s8.4.3.4
Constant Summary collapse
- MITER_JOIN =
The outer lines of the two segments continue until they meet at an angle.
Specify as 0 or
:miter
.#>pdf-small-hide canvas.line_join_style(:miter) canvas.line_width(10). polyline(20, 20, 50, 80, 80, 20).stroke canvas.stroke_color("white").line_width(1).line_join_style(:bevel). polyline(20, 20, 50, 80, 80, 20).stroke
NamedValue.new(:miter, 0)
- ROUND_JOIN =
An arc of a circle is drawn around the point where the segments meet.
Specify as 1 or
:round
.#>pdf-small-hide canvas.line_join_style(:round) canvas.line_width(10). polyline(20, 20, 50, 80, 80, 20).stroke canvas.stroke_color("white").line_width(1).line_join_style(:bevel). polyline(20, 20, 50, 80, 80, 20).stroke
NamedValue.new(:round, 1)
- BEVEL_JOIN =
The two segments are finished with butt caps and the space between the ends is filled with a triangle.
Specify as 2 or
:bevel
.#>pdf-small-hide canvas.line_join_style(:bevel) canvas.line_width(10). polyline(20, 20, 50, 80, 80, 20).stroke canvas.stroke_color("white").line_width(1).line_join_style(:bevel). polyline(20, 20, 50, 80, 80, 20).stroke
NamedValue.new(:bevel, 2)
Class Method Summary collapse
-
.normalize(style) ⇒ Object
Returns the argument normalized to a valid line join style, i.e.
Class Method Details
.normalize(style) ⇒ Object
Returns the argument normalized to a valid line join style, i.e. a NamedValue instance.
-
0 or
:miter
can be used for the MITER_JOIN style. -
1 or
:round
can be used for the ROUND_JOIN style. -
2 or
:bevel
can be used for the BEVEL_JOIN style. -
Otherwise an error is raised.
143 144 145 146 147 148 149 150 151 |
# File 'lib/hexapdf/content/graphics_state.rb', line 143 def self.normalize(style) case style when :miter, 0 then MITER_JOIN when :round, 1 then ROUND_JOIN when :bevel, 2 then BEVEL_JOIN else raise ArgumentError, "Unknown line join style: #{style}" end end |