Class: PDF::Core::GraphicStateStack

### Home Classes Methods

### In Files

- lib/pdf/core/graphics_state.rb

### Parent

Object

### Methods

- ::new
- #current_state
- #empty?
- #present?
- #restore_graphic_state
- #save_graphic_state

### Class/Module Index

Quicksearch

- PDF
- PDF::Core
- PDF::Core::Errors
- PDF::Core::FilterList
- PDF::Core::Filters
- PDF::Core::Filters::DCTDecode
- PDF::Core::Filters::FlateDecode
- PDF::Core::GraphicState
- PDF::Core::GraphicStateStack
- PDF::Core::PageGeometry
- PDF::Core::Renderer
- PDF::Core::Stream

No matching classes.

# PDF::Core::GraphicStateStack

### Attributes

stack[RW]

### Public Class Methods

new(previous_state = nil) click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 15
    def initialize(previous_state = nil)
      self.stack = [GraphicState.new(previous_state)]
    end

### Public Instance Methods

current_state() click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 31
    def current_state
      stack.last
    end

empty?() click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 39
    def empty?
      stack.empty?
    end

present?() click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 35
    def present?
      stack.size > 0
    end

restore_graphic_state() click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 23
    def restore_graphic_state
      if stack.empty?
        raise PDF::Core::Errors::EmptyGraphicStateStack,
          "\n You have reached the end of the graphic state stack"
      end
      stack.pop
    end

save_graphic_state(graphic_state = nil) click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 19
    def save_graphic_state(graphic_state = nil)
      stack.push(GraphicState.new(graphic_state || current_state))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.