Class: PDF::Core::GraphicState

### Home Classes Methods

### In Files

- lib/pdf/core/graphics_state.rb

### Parent

Object

### Methods

- ::new
- #dash_setting

### 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::GraphicState

NOTE: This class may be a good candidate for a copy-on-write hash.

### Attributes

cap_style[RW]
color_space[RW]
dash[RW]
fill_color[RW]
join_style[RW]
line_width[RW]
stroke_color[RW]

### Public Class Methods

new(previous_state = nil) click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 50
    def initialize(previous_state = nil)
      if previous_state
        initialize_copy(previous_state)
      else
        @color_space  = {}
        @fill_color   = "000000"
        @stroke_color = "000000"
        @dash         = { :dash => nil, :space => nil, :phase => 0 }
        @cap_style    = :butt
        @join_style   = :miter
        @line_width   = 1
      end
    end

### Public Instance Methods

dash_setting() click to toggle source

    # File lib/pdf/core/graphics_state.rb, line 64
    def dash_setting
      return "[] 0 d" unless @dash[:dash]

      if @dash[:dash].kind_of?(Array)
        array = @dash[:dash]
      else
        array = [@dash[:dash], @dash[:space]]
      end

      "[#{PDF::Core.real_params(array)}] "+
      "#{PDF::Core.real(@dash[:phase])} d"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.