Class: CompositorNode::Blender

Inherits:
Object
  • Object
show all
Defined in:
lib/compositor_node/blender.rb

Defined Under Namespace

Classes: NoBlendMethodError

Constant Summary collapse

MULTIPLY =
'MULTIPLY'
OVERLAY =
'OVERLAY'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Blender

Returns a new instance of Blender.



10
11
12
13
14
15
16
# File 'lib/compositor_node/blender.rb', line 10

def initialize(options = {})
  @source_a = options[:source_a]
  @source_b = options[:source_b]
  @method = options[:method]
  @x_offset = options[:x_offset] || 0
  @y_offset = options[:y_offset] || 0
end

Instance Attribute Details

#methodObject

Returns the value of attribute method.



3
4
5
# File 'lib/compositor_node/blender.rb', line 3

def method
  @method
end

#source_aObject

Returns the value of attribute source_a.



3
4
5
# File 'lib/compositor_node/blender.rb', line 3

def source_a
  @source_a
end

#source_bObject

Returns the value of attribute source_b.



3
4
5
# File 'lib/compositor_node/blender.rb', line 3

def source_b
  @source_b
end

#x_offsetObject

Returns the value of attribute x_offset.



3
4
5
# File 'lib/compositor_node/blender.rb', line 3

def x_offset
  @x_offset
end

#y_offsetObject

Returns the value of attribute y_offset.



3
4
5
# File 'lib/compositor_node/blender.rb', line 3

def y_offset
  @y_offset
end

Instance Method Details

#executeObject



18
19
20
21
22
23
# File 'lib/compositor_node/blender.rb', line 18

def execute
  image_a = @source_a.execute
  image_b = @source_b.execute

  Engine.blend(image_a, image_b, @x_offset, @y_offset, @method)
end