Module: Vissen::Output::Filter

Included in:
Gamma, Quantizer
Defined in:
lib/vissen/output/filter.rb,
lib/vissen/output/filter/gamma.rb,
lib/vissen/output/filter/quantizer.rb

Overview

An output filter is defined as a time invariant operation on a pixel cloud. Upon initialization the filter is given the output context as a chance to precompute some results. The rest of the work is done in ‘#apply` and should not depend on time.

Defined Under Namespace

Classes: Gamma, Quantizer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextContext (readonly)

Returns the filter context.

Returns:

  • (Context)

    the filter context.



11
12
13
# File 'lib/vissen/output/filter.rb', line 11

def context
  @context
end

Instance Method Details

#apply(_pixel_buffer) ⇒ Object

This method should apply the filter to the given ‘PixelBuffer`.

Parameters:

  • _pixel_buffer (PixelBuffer)

    the pixel cloud to which the filter should be applied.

Raises:

  • NotImplementedError if the method is not implemented in the specific ‘Filter` implementation.



30
31
32
# File 'lib/vissen/output/filter.rb', line 30

def apply(_pixel_buffer)
  raise NotImplementedError
end

#initialize(context) ⇒ Object

Parameters:

  • context (Context)

    the context within which the filter will be applied.

Raises:

  • (TypeError)

    if the context is not a ‘Context`.



17
18
19
20
21
# File 'lib/vissen/output/filter.rb', line 17

def initialize(context)
  raise TypeError unless context.is_a? Context

  @context = context
end