Class: Axon::BilinearScaler

Inherits:
Scaler
  • Object
show all
Includes:
BilinearScaling, Image, Enumerable
Defined in:
lib/axon/bilinear_scaler.rb

Instance Attribute Summary

Attributes inherited from Scaler

#height, #width

Instance Method Summary collapse

Methods included from Image

#crop, #fit, #scale_bilinear, #scale_nearest_neighbor, #to_jpeg, #to_png, #write_jpeg, #write_png

Methods included from BilinearScaling

#interpolate_scanline

Methods inherited from Scaler

#color_model, #components, #initialize

Constructor Details

This class inherits a constructor from Axon::Scaler

Instance Method Details

#eachObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/axon/bilinear_scaler.rb', line 7

def each
  source_y = 0
  destination_y = 0
  sample_y = 0

  each_scanline_with_next do |sl1, sl2|
    while sample_y.to_i == source_y
      yield interpolate_scanline(sl1, sl2, sample_y)

      destination_y += 1
      sample_y = destination_y / @height_ratio
    end
    
    source_y += 1
  end
end