Class: EideticRML::Styles::PenStyle

Inherits:
Style
  • Object
show all
Includes:
HasColor, HasWidth
Defined in:
lib/erml_styles.rb

Instance Method Summary collapse

Methods included from HasWidth

#units, #width

Methods included from HasColor

#color

Methods inherited from Style

for_name, #from_points, #id, #initialize, #initialize_copy, register

Methods included from EideticRML::Support

#from_units, parse_measurement, parse_measurement_pts, #to_units

Constructor Details

This class inherits a constructor from EideticRML::Styles::Style

Instance Method Details

#apply(writer) ⇒ Object



95
96
97
98
99
100
# File 'lib/erml_styles.rb', line 95

def apply(writer)
  writer.line_color(color)
  writer.line_width([width, 0.001].max, units)
  writer.line_dash_pattern(pattern)
  writer.line_cap_style(cap)
end

#cap(value = nil) ⇒ Object



102
103
104
105
# File 'lib/erml_styles.rb', line 102

def cap(value=nil)
  return @cap || :butt_cap if value.nil?
  @cap = value.to_sym if EideticPDF::LINE_CAP_STYLES.include?(value.to_sym)
end

#pattern(value = nil) ⇒ Object



107
108
109
110
# File 'lib/erml_styles.rb', line 107

def pattern(value=nil)
  return @pattern || :solid if value.nil?
  @pattern = EideticPDF::LINE_PATTERNS[value.to_sym] ? value.to_sym : value.to_s
end