Class: Vissen::Output::Filter::Gamma
- Inherits:
-
Object
- Object
- Vissen::Output::Filter::Gamma
- Includes:
- Vissen::Output::Filter
- Defined in:
- lib/vissen/output/filter/gamma.rb
Overview
Applies gamma correction to the given PixelGrid.
Instance Attribute Summary collapse
-
#value ⇒ Float
readonly
The gamma correction value.
Attributes included from Vissen::Output::Filter
Instance Method Summary collapse
-
#apply(pixel_buffer) ⇒ Object
Applies the filter to the given pixel cloud.
-
#initialize(*args, value: 2.2) ⇒ Gamma
constructor
A new instance of Gamma.
Constructor Details
#initialize(*args, value: 2.2) ⇒ Gamma
Returns a new instance of Gamma.
15 16 17 18 19 20 21 |
# File 'lib/vissen/output/filter/gamma.rb', line 15 def initialize(*args, value: 2.2) super(*args) @value = value freeze end |
Instance Attribute Details
#value ⇒ Float (readonly)
Returns the gamma correction value.
11 12 13 |
# File 'lib/vissen/output/filter/gamma.rb', line 11 def value @value end |
Instance Method Details
#apply(pixel_buffer) ⇒ Object
Applies the filter to the given pixel cloud.
28 29 30 31 32 33 34 |
# File 'lib/vissen/output/filter/gamma.rb', line 28 def apply(pixel_buffer) pixel_buffer.each do |pixel| pixel.r = pixel.r**@value pixel.g = pixel.g**@value pixel.b = pixel.b**@value end end |