Class: DotDiff::Image::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/dotdiff/image/container.rb

Instance Method Summary collapse

Constructor Details

#initialize(baseimg_file, newimg_file) ⇒ Container

Returns a new instance of Container.



6
7
8
9
# File 'lib/dotdiff/image/container.rb', line 6

def initialize(baseimg_file, newimg_file)
  @baseimg_file = baseimg_file
  @newimg_file = newimg_file
end

Instance Method Details

#both_images_same_dimensions?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/dotdiff/image/container.rb', line 11

def both_images_same_dimensions?
  base_image.width == new_image.width &&
    base_image.height == new_image.height
end

#dimensions_mismatch_msgObject



20
21
22
23
24
25
26
# File 'lib/dotdiff/image/container.rb', line 20

def dimensions_mismatch_msg
  "    Images are not the same dimensions to be compared\n    Base file: \#{base_image.width}x\#{base_image.height}\n    New file:  \#{new_image.width}x\#{new_image.height}\n  MSG\nend\n"

#total_pixelsObject



16
17
18
# File 'lib/dotdiff/image/container.rb', line 16

def total_pixels
  base_image.width * base_image.height
end