Class: Kracker::Zooka::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/kracker/zooka/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Image

Returns a new instance of Image.



8
9
10
11
# File 'lib/kracker/zooka/image.rb', line 8

def initialize(data)
  @data = data
  compute_image_summary
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



5
6
7
# File 'lib/kracker/zooka/image.rb', line 5

def alpha
  @alpha
end

#blueObject

Returns the value of attribute blue.



5
6
7
# File 'lib/kracker/zooka/image.rb', line 5

def blue
  @blue
end

#blue_totalObject

Returns the value of attribute blue_total.



6
7
8
# File 'lib/kracker/zooka/image.rb', line 6

def blue_total
  @blue_total
end

#brightnessObject

Returns the value of attribute brightness.



5
6
7
# File 'lib/kracker/zooka/image.rb', line 5

def brightness
  @brightness
end

#brightness_totalObject

Returns the value of attribute brightness_total.



6
7
8
# File 'lib/kracker/zooka/image.rb', line 6

def brightness_total
  @brightness_total
end

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/kracker/zooka/image.rb', line 4

def data
  @data
end

#greenObject

Returns the value of attribute green.



5
6
7
# File 'lib/kracker/zooka/image.rb', line 5

def green
  @green
end

#green_totalObject

Returns the value of attribute green_total.



6
7
8
# File 'lib/kracker/zooka/image.rb', line 6

def green_total
  @green_total
end

#pixelsObject

Returns the value of attribute pixels.



4
5
6
# File 'lib/kracker/zooka/image.rb', line 4

def pixels
  @pixels
end

#redObject

Returns the value of attribute red.



5
6
7
# File 'lib/kracker/zooka/image.rb', line 5

def red
  @red
end

#red_totalObject

Returns the value of attribute red_total.



6
7
8
# File 'lib/kracker/zooka/image.rb', line 6

def red_total
  @red_total
end

Instance Method Details

#display_image_infoObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kracker/zooka/image.rb', line 13

def display_image_info
  puts '-'*22
  puts "  Width:  #{@data.width}"
  puts "  Height: #{@data.height}"
  puts "  Avg. Red:    #{@red}"
  puts "  Avg. Green:  #{@green}"
  puts "  Avg. Blue:   #{@blue}"
  puts "  Total Red:   #{@red_total}"
  puts "  Total Green: #{@green_total}"
  puts "  Total Blue:  #{@blue_total}"
  puts '-'*22
end