Module: Prawn::Document::GraphicsState
- Included in:
- Prawn::Document
- Defined in:
- lib/prawn/document/graphics_state.rb
Instance Method Summary collapse
-
#restore_graphics_state ⇒ Object
Pops the last saved graphics state off the graphics state stack and restores the state to those values.
-
#save_graphics_state ⇒ Object
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).
Instance Method Details
#restore_graphics_state ⇒ Object
Pops the last saved graphics state off the graphics state stack and restores the state to those values
43 44 45 |
# File 'lib/prawn/document/graphics_state.rb', line 43 def restore_graphics_state add_content "Q" end |
#save_graphics_state ⇒ Object
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
33 34 35 36 37 38 39 |
# File 'lib/prawn/document/graphics_state.rb', line 33 def save_graphics_state add_content "q" if block_given? yield restore_graphics_state end end |