Class: Prawn::SVG::Elements::Line

Inherits:
Base
  • Object
show all
Includes:
Pathable
Defined in:
lib/prawn/svg/elements/line.rb

Constant Summary

Constants inherited from Base

Base::COMMA_WSP_REGEXP, Base::MissingAttributesError, Base::PAINT_TYPES, Base::SVG_NAMESPACE, Base::SkipElementError, Base::SkipElementQuietly

Constants included from Attributes::Stroke

Attributes::Stroke::CAP_STYLE_TRANSLATIONS, Attributes::Stroke::JOIN_STYLE_TRANSLATIONS

Instance Attribute Summary

Attributes inherited from Base

#attributes, #base_calls, #calls, #document, #parent_calls, #properties, #source, #state

Instance Method Summary collapse

Methods included from Pathable

#bounding_box

Methods inherited from Base

#initialize, #name, #parse_and_apply, #process

Methods included from TransformParser

#parse_transform_attribute

Methods included from PDFMatrix

#load_matrix, #matrix_for_pdf, #rotation_matrix, #scale_matrix, #translation_matrix

Methods included from Attributes::Space

#parse_xml_space_attribute

Methods included from Attributes::Stroke

#parse_stroke_attributes_and_call

Methods included from Attributes::ClipPath

#parse_clip_path_attribute_and_call

Methods included from Attributes::Opacity

#parse_opacity_attributes_and_call

Methods included from Attributes::Transform

#parse_transform_attribute_and_call

Constructor Details

This class inherits a constructor from Prawn::SVG::Elements::Base

Instance Method Details

#applyObject



14
15
16
17
# File 'lib/prawn/svg/elements/line.rb', line 14

def apply
  apply_commands
  apply_markers
end

#parseObject



4
5
6
7
8
9
10
11
12
# File 'lib/prawn/svg/elements/line.rb', line 4

def parse
  # Lines are one dimensional, so cannot be filled.
  computed_properties.fill = Prawn::SVG::Paint.none

  @x1 = x_pixels(attributes['x1'] || 0)
  @y1 = y_pixels(attributes['y1'] || 0)
  @x2 = x_pixels(attributes['x2'] || 0)
  @y2 = y_pixels(attributes['y2'] || 0)
end