Class: PDF::Core::GraphicState
- Inherits:
-
Object
- Object
- PDF::Core::GraphicState
- Defined in:
- lib/pdf/core/graphics_state.rb
Overview
NOTE: This class may be a good candidate for a copy-on-write hash.
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.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/pdf/core/graphics_state.rb', line 49 def initialize(previous_state = nil) if previous_state initialize_copy(previous_state) else @color_space = {} @fill_color = '000000' @stroke_color = '000000' @dash = { dash: nil, space: nil, phase: 0 } @cap_style = :butt @join_style = :miter @line_width = 1 end end |
Instance Attribute Details
#cap_style ⇒ Object
Returns the value of attribute cap_style.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def cap_style @cap_style end |
#color_space ⇒ Object
Returns the value of attribute color_space.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def color_space @color_space end |
#dash ⇒ Object
Returns the value of attribute dash.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def dash @dash end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def fill_color @fill_color end |
#join_style ⇒ Object
Returns the value of attribute join_style.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def join_style @join_style end |
#line_width ⇒ Object
Returns the value of attribute line_width.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def line_width @line_width end |
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
46 47 48 |
# File 'lib/pdf/core/graphics_state.rb', line 46 def stroke_color @stroke_color end |
Instance Method Details
#dash_setting ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/pdf/core/graphics_state.rb', line 63 def dash_setting return '[] 0 d' unless @dash[:dash] array = if @dash[:dash].is_a?(Array) @dash[:dash] else [@dash[:dash], @dash[:space]] end "[#{PDF::Core.real_params(array)}] "\ "#{PDF::Core.real(@dash[:phase])} d" end |