# File lib/prawn/document/graphics_state.rb, line 100 def close_graphics_state add_content "Q" end
# File lib/prawn/document/graphics_state.rb, line 124 def graphic_stack state.page.stack end
# File lib/prawn/document/graphics_state.rb, line 128 def graphic_state save_graphics_state unless graphic_stack.current_state graphic_stack.current_state end
Pushes the current graphics state on to the graphics state stack so we can restore it when finished with a change we want to isolate (such as modifying the transformation matrix). Used in pairs with restore_graphics_state or passed a block
Example without a block:
save_graphics_state rotate 30 text "rotated text" restore_graphics_state
Example with a block:
save_graphics_state do rotate 30 text "rotated text" end
# File lib/prawn/document/graphics_state.rb, line 96 def open_graphics_state add_content "q" end
Pops the last saved graphics state off the graphics state stack and restores the state to those values
# File lib/prawn/document/graphics_state.rb, line 115 def restore_graphics_state if graphic_stack.empty? raise Prawn::Errors::EmptyGraphicStateStack, "\n You have reached the end of the graphic state stack" end close_graphics_state graphic_stack.restore_graphic_state end
Generated with the Darkfish Rdoc Generator 2.