| Class | Origami::Graphics::State |
| In: |
sources/parser/graphics/state.rb
|
| Parent: | Object |
| alpha_constant | [RW] | |
| alpha_source | [RW] | |
| blend_mode | [RW] | |
| clipping_path | [RW] | |
| ctm | [RW] | Device-independent parameters. |
| current_path | [R] | |
| dash_pattern | [RW] | |
| line_cap | [RW] | |
| line_join | [RW] | |
| line_width | [RW] | |
| miter_limit | [RW] | |
| nonstroking_color | [RW] | |
| nonstroking_colorspace | [RW] | |
| rendering_intent | [RW] | |
| soft_mask | [RW] | |
| stroke_adjustment | [RW] | |
| stroking_color | [RW] | |
| stroking_colorspace | [RW] | |
| text_state | [RW] |
# File sources/parser/graphics/state.rb, line 51
51: def initialize
52:
53: @stack = []
54: @current_path = []
55: @text_state = Text::State.new
56:
57: self.reset
58: end
# File sources/parser/graphics/state.rb, line 60
60: def reset
61:
62: @ctm = Matrix.identity(3)
63: @clipping_path = nil
64: @stroking_colorspace = @nonstroking_colorspace = Color::Space::DEVICE_GRAY
65: @stroking_color = @nonstroking_color = [ 0.0 ] #black
66: @text_state.reset
67: @line_width = 1.0
68: @line_cap = LineCapStyle::BUTT_CAP
69: @line_join = LineJoinStyle::MITER_JOIN
70: @miter_limit = 10.0
71: @dash_pattern = DashPattern.new([], 0)
72: @rendering_intent = RenderingIntent::RELATIVE_COLORIMETRIC
73: @stroke_adjustment = false
74: @blend_mode = BlendMode::NORMAL
75: @soft_mask = :None
76: @alpha_constant = 1.0
77: @alpha_source = false
78:
79: end
# File sources/parser/graphics/state.rb, line 95
95: def restore
96: raise GraphicsStateError, "Cannot restore context : empty stack" if @stack.empty?
97:
98: @ctm, @clipping_path,
99: @stroking_colorspace, @nonstroking_colorspace,
100: @stroking_color, @nonstroking_color,
101: @text_state, @line_width, @line_cap, @line_join,
102: @miter_limit, @dash_pattern, @rendering_intent,
103: @stroke_adjustment,
104: @blend_mode, @soft_mask, @alpha_constant, @alpha_source = @stack.pop
105: end
# File sources/parser/graphics/state.rb, line 81
81: def save
82: context =
83: [
84: @ctm, @clipping_path,
85: @stroking_colorspace, @nonstroking_colorspace,
86: @stroking_color, @nonstroking_color,
87: @text_state, @line_width, @line_cap, @line_join,
88: @miter_limit, @dash_pattern, @rendering_intent,
89: @stroke_adjustment,
90: @blend_mode, @soft_mask, @alpha_constant, @alpha_source
91: ]
92: @stack.push(context)
93: end