class Vissen::Output::Filter::Gamma

Applies gamma correction to the given PixelGrid.

Attributes

value[R]

@return [Float] the gamma correction value.

Public Class Methods

new(*args, value: 2.2) click to toggle source

@param args (see Filter) @param value [Float] the gamma correction value.

Calls superclass method Vissen::Output::Filter::new
# File lib/vissen/output/filter/gamma.rb, line 15
def initialize(*args, value: 2.2)
  super(*args)

  @value = value

  freeze
end

Public Instance Methods

apply(pixel_buffer) click to toggle source

Applies the filter to the given pixel cloud.

@see Filter @param pixel_buffer [PixelBuffer] the pixel buffer to perform the

filter operation on.
# 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