Class: RComposite::AdjustmentLayer
- Defined in:
- lib/rcomposite/adjustmentlayer.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Layer
Instance Method Summary collapse
-
#initialize(type, *args, &block) ⇒ AdjustmentLayer
constructor
A new instance of AdjustmentLayer.
- #merge_down(image) ⇒ Object
Methods inherited from Layer
#height, #join_set, #layer_mask, #leave_set, #mode, #offset, #opacity, #rotate, #save_as, #width
Constructor Details
#initialize(type, *args, &block) ⇒ AdjustmentLayer
Returns a new instance of AdjustmentLayer.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rcomposite/adjustmentlayer.rb', line 19 def initialize(type, *args, &block) @type = type @args = args @mode = Normal @offset_x = 0 @offset_y = 0 @opacity_percent = 100 @layer_mask = nil case type when Invert @proc = proc { negate } when Threshold @proc = proc { threshold *args } when Levels @proc = proc { level *args } when Blur @proc = proc { gaussian_blur *args } end @proc = proc { |*args| @proc }.call(*@args) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
17 18 19 |
# File 'lib/rcomposite/adjustmentlayer.rb', line 17 def args @args end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
17 18 19 |
# File 'lib/rcomposite/adjustmentlayer.rb', line 17 def type @type end |
Instance Method Details
#merge_down(image) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rcomposite/adjustmentlayer.rb', line 41 def merge_down(image) @image = image.clone.instance_eval &@proc @image.matte = true super(image) end |