Method: Fleximage::Operator::Base#symbol_to_blending_mode

Defined in:
lib/fleximage/operator/base.rb

#symbol_to_blending_mode(mode) ⇒ Object

Convert a symbol to an RMagick blending mode.

The blending mode governs how the overlay gets composited onto the image. You can get some funky effects with modes like :copy_cyan or :screen. For a full list of blending modes checkout the RMagick documentation (www.simplesystems.org/RMagick/doc/constants.html#CompositeOperator). To use a blend mode remove the CompositeOp form the name and “unserscorize” the rest. For instance, MultiplyCompositeOp becomes :multiply, and CopyBlackCompositeOp becomes :copy_black.



156
157
158
159
160
# File 'lib/fleximage/operator/base.rb', line 156

def symbol_to_blending_mode(mode)
  "Magick::#{mode.to_s.camelize}CompositeOp".constantize
rescue NameError
  raise ArgumentError, ":#{mode} is not a valid blending mode."
end