Class: Morandi::Colourify
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
Instance Method Summary collapse
- #alpha ⇒ Object
- #bluetone(pixbuf) ⇒ Object
- #call(image, pixbuf) ⇒ Object
- #greyscale(pixbuf) ⇒ Object (also: #bw)
-
#initialize(op, alpha = 255) ⇒ Colourify
constructor
A new instance of Colourify.
- #null(pixbuf) ⇒ Object (also: #full, #colour)
- #sepia(pixbuf) ⇒ Object
Methods inherited from ImageOp
Constructor Details
#initialize(op, alpha = 255) ⇒ Colourify
Returns a new instance of Colourify.
268 269 270 271 272 |
# File 'lib/morandi/image-ops.rb', line 268 def initialize(op, alpha=255) super() @op = op @alpha = alpha end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
267 268 269 |
# File 'lib/morandi/image-ops.rb', line 267 def op @op end |
Instance Method Details
#alpha ⇒ Object
274 275 276 |
# File 'lib/morandi/image-ops.rb', line 274 def alpha @alpha || 255 end |
#bluetone(pixbuf) ⇒ Object
282 283 284 |
# File 'lib/morandi/image-ops.rb', line 282 def bluetone(pixbuf) PixbufUtils.tint(pixbuf, -10, 5, 25, alpha) end |
#call(image, pixbuf) ⇒ Object
297 298 299 300 301 302 303 |
# File 'lib/morandi/image-ops.rb', line 297 def call(image, pixbuf) if @op and respond_to?(@op) __send__(@op, pixbuf) else pixbuf # Default is nothing end end |
#greyscale(pixbuf) ⇒ Object Also known as: bw
292 293 294 |
# File 'lib/morandi/image-ops.rb', line 292 def greyscale(pixbuf) PixbufUtils.tint(pixbuf, 0, 0, 0, alpha) end |
#null(pixbuf) ⇒ Object Also known as: full, colour
286 287 288 |
# File 'lib/morandi/image-ops.rb', line 286 def null(pixbuf) pixbuf end |
#sepia(pixbuf) ⇒ Object
278 279 280 |
# File 'lib/morandi/image-ops.rb', line 278 def sepia(pixbuf) PixbufUtils.tint(pixbuf, 25, 5, -25, alpha) end |