Class: ZPNG::Pixels

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/zpng/pixels.rb

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ Pixels

Returns a new instance of Pixels.



5
6
7
# File 'lib/zpng/pixels.rb', line 5

def initialize image
  @image = image
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/zpng/pixels.rb', line 17

def == other
  self.to_a == other.to_a
end

#eachObject



9
10
11
12
13
14
15
# File 'lib/zpng/pixels.rb', line 9

def each
  @image.height.times do |y|
    @image.width.times do |x|
      yield @image[x,y]
    end
  end
end

#uniqObject



21
22
23
# File 'lib/zpng/pixels.rb', line 21

def uniq
  self.to_a.uniq
end