ru.yandex.qatools.ashot.screentaker.HeadCuttingShootingStrategy Maven / Gradle / Ivy
package ru.yandex.qatools.ashot.screentaker;
import org.openqa.selenium.WebDriver;
import java.awt.image.BufferedImage;
/**
* @author Pavel Zorin
*/
public class HeadCuttingShootingStrategy extends ShootingStrategy {
protected int headerToCut;
public HeadCuttingShootingStrategy(int headerToCut) {
this.headerToCut = headerToCut;
}
@Override
public BufferedImage getScreenshot(WebDriver wd) {
BufferedImage baseImage = simple().getScreenshot(wd);
int h = baseImage.getHeight();
int w = baseImage.getWidth();
return baseImage.getSubimage(0, headerToCut, w, h - headerToCut);
}
}