# File lib/prawn/document/graphics_state.rb, line 13 def initialize(previous_state = nil) self.stack = [GraphicState.new(previous_state)] end
# File lib/prawn/document/graphics_state.rb, line 29 def current_state stack.last end
# File lib/prawn/document/graphics_state.rb, line 37 def empty? stack.empty? end
# File lib/prawn/document/graphics_state.rb, line 33 def present? stack.size > 0 end
# File lib/prawn/document/graphics_state.rb, line 21 def restore_graphic_state if stack.empty? raise Prawn::Errors::EmptyGraphicStateStack, "\n You have reached the end of the graphic state stack" end stack.pop end
# File lib/prawn/document/graphics_state.rb, line 17 def save_graphic_state(graphic_state = nil) stack.push(GraphicState.new(graphic_state || current_state)) end