Class: HexaPDF::Type::Annotations::PolygonPolyline
- Inherits:
-
MarkupAnnotation
- Object
- Object
- Dictionary
- HexaPDF::Type::Annotation
- MarkupAnnotation
- HexaPDF::Type::Annotations::PolygonPolyline
- Includes:
- BorderEffect, BorderStyling, InteriorColor, LineEndingStyling
- Defined in:
- lib/hexapdf/type/annotations/polygon_polyline.rb
Overview
This is the base class for the polygon and polyline markup annotations which display either a closed polygon or a polyline inside the annotation rectangle.
The styling is done through methods included by various modules:
-
Changing the line width, line dash pattern and color is done using the method BorderStyling#border_style. While that method allows special styling of the line (like :beveled), only a simple line dash pattern is supported.
-
The border effect can be changed through BorderEffect#border_effect. Note that cloudy borders are not supported.
-
The interior color can be changed through InteriorColor#interior_color.
-
The line ending style can be changed through LineEndingStyling#line_ending_style.
See: PDF2.0 s12.5.6.9, HexaPDF::Type::Annotations::Polyline, HexaPDF::Type::Annotations::Polygon, HexaPDF::Type::MarkupAnnotation
Constant Summary
Constants included from LineEndingStyling
LineEndingStyling::LINE_ENDING_STYLE_MAP, LineEndingStyling::LINE_ENDING_STYLE_REVERSE_MAP
Constants included from DictionaryFields
DictionaryFields::Boolean, DictionaryFields::PDFByteString, DictionaryFields::PDFDate
Instance Attribute Summary
Attributes inherited from Object
#data, #document, #must_be_indirect
Instance Method Summary collapse
-
#vertices(*points) ⇒ Object
:call-seq: annot.vertices => [x0, y0, x1, y1, …] annot.vertices(*points) => annot.
Methods included from LineEndingStyling
Methods included from InteriorColor
Methods included from BorderEffect
Methods included from BorderStyling
Methods inherited from HexaPDF::Type::Annotation
#appearance, #appearance_dict, #contents, #create_appearance, #flags, #must_be_indirect?, #opacity, #regenerate_appearance
Methods included from Utils::BitField
Methods inherited from Dictionary
#[], #[]=, define_field, define_type, #delete, #each, each_field, #empty?, field, #key?, #to_hash, type, #type
Methods inherited from Object
#<=>, #==, #cache, #cached?, #clear_cache, deep_copy, #deep_copy, #document?, #eql?, field, #gen, #gen=, #hash, #indirect?, #initialize, #inspect, make_direct, #must_be_indirect?, #null?, #oid, #oid=, #type, #validate, #value, #value=
Constructor Details
This class inherits a constructor from HexaPDF::Object
Instance Method Details
#vertices(*points) ⇒ Object
:call-seq:
annot.vertices => [x0, y0, x1, y1, ...]
annot.vertices(*points) => annot
Returns the array with the vertices, alternating between horizontal and vertical coordinates, when no argument is given. Otherwise sets the vertices and returns self.
This is the only required setting. Note, however, that without setting the appearance style through convenience methods like #border_style nothing will be shown.
Example:
#>pdf-small
doc.annotations.
create_polyline(doc.pages[0], 20, 20, 30, 70, 80, 60, 40, 30).
regenerate_appearance
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/hexapdf/type/annotations/polygon_polyline.rb', line 95 def vertices(*points) if points.empty? self[:Vertices].to_ary elsif points.length % 2 != 0 raise ArgumentError, "An even number of arguments must be provided" else self[:Vertices] = points self end end |