class Capybara::Screenshot::Diff::Drivers::ChunkyPNGDriver
Public Instance Methods
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 31 def add_black_box(image, _region) image end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 39 def crop(region, i) i.crop(*region.to_top_left_corner_coordinates) end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 59 def draw_rectangles(images, region, (r, g, b), offset: 0) border_color = ChunkyPNG::Color.rgb(r, g, b) border_shadow = ChunkyPNG::Color.rgba(r, g, b, 100) images.map do |image| new_img = image.dup new_img.rect(region.left - offset, region.top - offset, region.right + offset, region.bottom + offset, border_color) new_img.rect(region.left, region.top, region.right, region.bottom, border_shadow) new_img end end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 27 def filter_image_with_median(_image) raise NotImplementedError end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 35 def find_difference_region(comparison) DifferenceRegionFinder.new(comparison, self).perform end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 43 def from_file(filename_or_path) ChunkyPNG::Image.from_file(filename_or_path.to_s) end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 55 def load_image_files(old_file_name, file_name) [old_file_name.binread, file_name.binread] end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 21 def load_images(old_file_name, new_file_name) old_bytes, new_bytes = load_image_files(old_file_name, new_file_name) _load_images(old_bytes, new_bytes) end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 51 def resize_image_to(image, new_width, new_height) image.resample_bilinear(new_width, new_height) end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 71 def same_pixels?(comparison) comparison.new_image == comparison.base_image end
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 47 def save_image_to(image, filename) image.save(filename, :fast_rgba) end
Private Instance Methods
Source
# File lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb, line 77 def _load_images(old_file, new_file) [ChunkyPNG::Image.from_blob(old_file), ChunkyPNG::Image.from_blob(new_file)] end