Class: Prawn::GraphicState
- Inherits:
-
Object
- Object
- Prawn::GraphicState
- Defined in:
- lib/prawn/document/graphics_state.rb
Instance Attribute Summary collapse
-
#cap_style ⇒ Object
Returns the value of attribute cap_style.
-
#color_space ⇒ Object
Returns the value of attribute color_space.
-
#dash ⇒ Object
Returns the value of attribute dash.
-
#fill_color ⇒ Object
Returns the value of attribute fill_color.
-
#join_style ⇒ Object
Returns the value of attribute join_style.
-
#line_width ⇒ Object
Returns the value of attribute line_width.
-
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
Instance Method Summary collapse
- #dash_setting ⇒ Object
-
#initialize(previous_state = nil) ⇒ GraphicState
constructor
A new instance of GraphicState.
Constructor Details
#initialize(previous_state = nil) ⇒ GraphicState
Returns a new instance of GraphicState.
47 48 49 50 51 52 53 54 55 |
# File 'lib/prawn/document/graphics_state.rb', line 47 def initialize(previous_state = nil) @color_space = previous_state ? previous_state.color_space.dup : {} @fill_color = previous_state ? previous_state.fill_color : "000000" @stroke_color = previous_state ? previous_state.stroke_color : "000000" @dash = previous_state ? previous_state.dash : { :dash => nil, :space => nil, :phase => 0 } @cap_style = previous_state ? previous_state.cap_style : :butt @join_style = previous_state ? previous_state.join_style : :miter @line_width = previous_state ? previous_state.line_width : 1 end |
Instance Attribute Details
#cap_style ⇒ Object
Returns the value of attribute cap_style.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def cap_style @cap_style end |
#color_space ⇒ Object
Returns the value of attribute color_space.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def color_space @color_space end |
#dash ⇒ Object
Returns the value of attribute dash.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def dash @dash end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def fill_color @fill_color end |
#join_style ⇒ Object
Returns the value of attribute join_style.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def join_style @join_style end |
#line_width ⇒ Object
Returns the value of attribute line_width.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def line_width @line_width end |
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
45 46 47 |
# File 'lib/prawn/document/graphics_state.rb', line 45 def stroke_color @stroke_color end |
Instance Method Details
#dash_setting ⇒ Object
57 58 59 |
# File 'lib/prawn/document/graphics_state.rb', line 57 def dash_setting "[#{@dash[:dash]} #{@dash[:space]}] #{@dash[:phase]} d" end |