class Origami::Graphics::State
Attributes
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]
Public Class Methods
new()
click to toggle source
# File lib/origami/graphics/state.rb, line 51 def initialize @stack = [] @current_path = [] @text_state = Text::State.new self.reset end
Public Instance Methods
reset()
click to toggle source
# File lib/origami/graphics/state.rb, line 60 def reset @ctm = Matrix.identity(3) @clipping_path = nil @stroking_colorspace = @nonstroking_colorspace = Color::Space::DEVICE_GRAY @stroking_color = @nonstroking_color = [ 0.0 ] #black @text_state.reset @line_width = 1.0 @line_cap = LineCapStyle::BUTT_CAP @line_join = LineJoinStyle::MITER_JOIN @miter_limit = 10.0 @dash_pattern = DashPattern.new([], 0) @rendering_intent = Color::Intent::RELATIVE @stroke_adjustment = false @blend_mode = Color::BlendMode::NORMAL @soft_mask = :None @alpha_constant = 1.0 @alpha_source = false end
restore()
click to toggle source
# File lib/origami/graphics/state.rb, line 95 def restore raise GraphicsStateError, "Cannot restore context : empty stack" if @stack.empty? @ctm, @clipping_path, @stroking_colorspace, @nonstroking_colorspace, @stroking_color, @nonstroking_color, @text_state, @line_width, @line_cap, @line_join, @miter_limit, @dash_pattern, @rendering_intent, @stroke_adjustment, @blend_mode, @soft_mask, @alpha_constant, @alpha_source = @stack.pop end
save()
click to toggle source
# File lib/origami/graphics/state.rb, line 81 def save context = [ @ctm, @clipping_path, @stroking_colorspace, @nonstroking_colorspace, @stroking_color, @nonstroking_color, @text_state, @line_width, @line_cap, @line_join, @miter_limit, @dash_pattern, @rendering_intent, @stroke_adjustment, @blend_mode, @soft_mask, @alpha_constant, @alpha_source ] @stack.push(context) end