Class: Postscript::Model::Operators::Path::Curveto

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/path.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(x1:, y1:, x2:, y2:, x3:, y3:) ⇒ Curveto

Returns a new instance of Curveto.



74
75
76
77
78
79
80
81
82
# File 'lib/postscript/model/operators/path.rb', line 74

def initialize(x1:, y1:, x2:, y2:, x3:, y3:)
  @x1 = x1
  @y1 = y1
  @x2 = x2
  @y2 = y2
  @x3 = x3
  @y3 = y3
  freeze
end

Instance Attribute Details

#x1Object (readonly)

Returns the value of attribute x1.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def x1
  @x1
end

#x2Object (readonly)

Returns the value of attribute x2.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def x2
  @x2
end

#x3Object (readonly)

Returns the value of attribute x3.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def x3
  @x3
end

#y1Object (readonly)

Returns the value of attribute y1.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def y1
  @y1
end

#y2Object (readonly)

Returns the value of attribute y2.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def y2
  @y2
end

#y3Object (readonly)

Returns the value of attribute y3.



73
74
75
# File 'lib/postscript/model/operators/path.rb', line 73

def y3
  @y3
end

Class Method Details

.from_operands(stack) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/postscript/model/operators/path.rb', line 83

def self.from_operands(stack)
  y3 = stack.pop_number
  x3 = stack.pop_number
  y2 = stack.pop_number
  x2 = stack.pop_number
  y1 = stack.pop_number
  x1 = stack.pop_number
  new(x1: x1, y1: y1, x2: x2, y2: y2, x3: x3, y3: y3)
end