Skip to content

Commit

Permalink
半自动\手动 填上bufferedImage
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwintangshuai committed Jan 2, 2018
1 parent 5ffe3ed commit cd1b1d7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class BackgroundImage4Panel extends javax.swing.JFrame {

private static int playMode = Constants.MODE_MANUAL;

private static BufferedImage bufferedImage;

/**
* Creates new form NewJFrame
*/
Expand Down Expand Up @@ -160,7 +162,7 @@ private static void manualMode(final int resizedScreenWidth, final int resizedSc
protected void paintComponent(Graphics g) {
super.paintComponent(g);
try {
BufferedImage bufferedImage = ImageIO.read(new File(screenshotPath));
bufferedImage = ImageIO.read(new File(screenshotPath));
BufferedImage newImage = new BufferedImage(resizedScreenWidth, resizedScreenHeight,
bufferedImage.getType());
if (playMode == Constants.MODE_SEMI_AUTO) {
Expand Down Expand Up @@ -198,7 +200,7 @@ public void mouseClicked(MouseEvent e) {
int distance = distance(firstPoint, secondPoint);
System.out.println("distance:" + distance);
isFirst = true;
AdbCaller.longPress(distance * resizedDistancePressTimeRatio, null);// magic
AdbCaller.longPress(distance * resizedDistancePressTimeRatio, bufferedImage);// magic
// number
try {
Thread.sleep(screenshotInterval);// wait for screencap
Expand Down

0 comments on commit cd1b1d7

Please sign in to comment.