Class Origami::Graphics::Path
In: sources/parser/graphics/path.rb
Parent: Object

Methods

add_segment   close!   is_closed?   new  

Classes and Modules

Module Origami::Graphics::Path::Segment
Class Origami::Graphics::Path::Line

Attributes

current_point  [RW] 
segments  [R] 

Public Class methods

[Source]

    # File sources/parser/graphics/path.rb, line 76
76:       def initialize
77:         @segments = []
78:         @current_point = nil
79:         @closed = false
80:       end

Public Instance methods

[Source]

     # File sources/parser/graphics/path.rb, line 95
 95:       def add_segment(seg)
 96:         raise GraphicsStateError, "Cannot modify closed subpath" if is_closed?
 97: 
 98:         @segments << seg
 99:         @current_point = seg.to
100:       end

[Source]

    # File sources/parser/graphics/path.rb, line 86
86:       def close!
87:         from = @current_point
88:         to = @segments.first.from
89:         
90:         @segments << Line.new(from, to)
91:         @segments.freeze
92:         @closed = true
93:       end

[Source]

    # File sources/parser/graphics/path.rb, line 82
82:       def is_closed?
83:         @closed
84:       end

[Validate]