# File lib/graster/image.rb, line 52 def build_spans on_range # TODO: rewrite in terms of each_row @spans = Array.new @size[1] @size[1].times do |y| spans = [] left = (@size[1]-y-1)*@size[0] start = nil @size[0].times do |x| d = on_range.include?(@pixels[left+x]) if !start && d start = x elsif start && !d spans << [start, x] start = nil end end spans << [start, @size[0]] if start @spans[y] = spans end end