Class: CompositorNode::Cropper
- Inherits:
-
Object
- Object
- CompositorNode::Cropper
- Defined in:
- lib/compositor_node/cropper.rb
Defined Under Namespace
Classes: MissingDimensionCropError
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#source ⇒ Object
Returns the value of attribute source.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x_offset ⇒ Object
Returns the value of attribute x_offset.
-
#y_offset ⇒ Object
Returns the value of attribute y_offset.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ Cropper
constructor
A new instance of Cropper.
Constructor Details
#initialize(options = {}) ⇒ Cropper
Returns a new instance of Cropper.
8 9 10 11 12 13 14 |
# File 'lib/compositor_node/cropper.rb', line 8 def initialize( = {}) @source = [:source] @width = [:width] @height = [:height] @x_offset = [:x_offset] || 0 @y_offset = [:y_offset] || 0 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
4 5 6 |
# File 'lib/compositor_node/cropper.rb', line 4 def height @height end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'lib/compositor_node/cropper.rb', line 4 def source @source end |
#width ⇒ Object
Returns the value of attribute width.
4 5 6 |
# File 'lib/compositor_node/cropper.rb', line 4 def width @width end |
#x_offset ⇒ Object
Returns the value of attribute x_offset.
4 5 6 |
# File 'lib/compositor_node/cropper.rb', line 4 def x_offset @x_offset end |
#y_offset ⇒ Object
Returns the value of attribute y_offset.
4 5 6 |
# File 'lib/compositor_node/cropper.rb', line 4 def y_offset @y_offset end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 |
# File 'lib/compositor_node/cropper.rb', line 16 def execute raise MissingDimensionCropError unless @width && @height Engine.crop(@source.execute, @x_offset, @y_offset, @width, @height) end |