Class: Morandi::Operation::Colourify
- Inherits:
-
ImageOperation
- Object
- ImageOperation
- Morandi::Operation::Colourify
- Defined in:
- lib/morandi/operation/colourify.rb
Overview
Colourify Operation Apply tint to image with variable strength Supports filter, alpha
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
Instance Method Summary collapse
- #alpha ⇒ Object
- #bluetone(pixbuf) ⇒ Object
- #call(pixbuf) ⇒ Object
- #greyscale(pixbuf) ⇒ Object (also: #bw)
- #null(pixbuf) ⇒ Object (also: #full, #colour)
- #sepia(pixbuf) ⇒ Object
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
11 12 13 |
# File 'lib/morandi/operation/colourify.rb', line 11 def filter @filter end |
Instance Method Details
#alpha ⇒ Object
13 14 15 |
# File 'lib/morandi/operation/colourify.rb', line 13 def alpha @alpha || 255 end |
#bluetone(pixbuf) ⇒ Object
21 22 23 |
# File 'lib/morandi/operation/colourify.rb', line 21 def bluetone(pixbuf) MorandiNative::PixbufUtils.tint(pixbuf, -10, 5, 25, alpha) end |
#call(pixbuf) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/morandi/operation/colourify.rb', line 36 def call(pixbuf) if @filter && respond_to?(@filter) __send__(@filter, pixbuf) else pixbuf # Default is nothing end end |
#greyscale(pixbuf) ⇒ Object Also known as: bw
31 32 33 |
# File 'lib/morandi/operation/colourify.rb', line 31 def greyscale(pixbuf) MorandiNative::PixbufUtils.tint(pixbuf, 0, 0, 0, alpha) end |
#null(pixbuf) ⇒ Object Also known as: full, colour
25 26 27 |
# File 'lib/morandi/operation/colourify.rb', line 25 def null(pixbuf) pixbuf end |
#sepia(pixbuf) ⇒ Object
17 18 19 |
# File 'lib/morandi/operation/colourify.rb', line 17 def sepia(pixbuf) MorandiNative::PixbufUtils.tint(pixbuf, 25, 5, -25, alpha) end |