parent
7eb19cb562
commit
3af8a16816
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,46 @@
|
||||
package xyz.wbsite.jmacro.base;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.sikuli.script.Location;
|
||||
|
||||
/**
|
||||
* 色值坐标点
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ColorLocation extends Location {
|
||||
|
||||
/**
|
||||
* 颜色值
|
||||
*/
|
||||
private String hexColor;
|
||||
|
||||
/**
|
||||
* @param x 坐标
|
||||
* @param y 坐标
|
||||
* @param hexColor rgb值 例如#FFFFFF
|
||||
*/
|
||||
public ColorLocation(int x, int y, String hexColor) {
|
||||
super(x, y);
|
||||
this.hexColor = hexColor;
|
||||
}
|
||||
|
||||
public ColorLocation(int x, int y, int hexColor) {
|
||||
super(x, y);
|
||||
this.hexColor = "#" + Integer.toHexString(hexColor);
|
||||
}
|
||||
|
||||
public String getHexColor() {
|
||||
return hexColor;
|
||||
}
|
||||
|
||||
public void setHexColor(String hexColor) {
|
||||
this.hexColor = hexColor;
|
||||
}
|
||||
|
||||
public int getHexColorInt() {
|
||||
return Integer.parseInt(StrUtil.removePrefix(hexColor, "#"), 16);
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package xyz.wbsite.jmacro.base;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* 色值坐标点
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ViewColor extends ViewPoint {
|
||||
|
||||
/**
|
||||
* 颜色值
|
||||
*/
|
||||
private int color;
|
||||
|
||||
/**
|
||||
* @param x 坐标
|
||||
* @param y 坐标
|
||||
* @param hexColor rgb值 例如#FFFFFF
|
||||
*/
|
||||
public ViewColor(int x, int y, String hexColor) {
|
||||
super(x, y);
|
||||
this.color = Integer.parseInt(StrUtil.removePrefix(hexColor, "#"), 16);
|
||||
}
|
||||
|
||||
public ViewColor(int x, int y, int color) {
|
||||
super(x, y);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public String getHexColor() {
|
||||
return "#" + Integer.toHexString(color);
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package xyz.wbsite.jmacro.base;
|
||||
|
||||
/**
|
||||
* 视口区域
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 1.8
|
||||
*/
|
||||
public class ViewRect {
|
||||
|
||||
private int left;
|
||||
private int top;
|
||||
private int right;
|
||||
private int bottom;
|
||||
|
||||
/**
|
||||
* 相似度
|
||||
*/
|
||||
private double similar;
|
||||
|
||||
public ViewRect() {
|
||||
}
|
||||
|
||||
public ViewRect(int left, int top, int right, int bottom) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
public ViewRect(int left, int top, int right, int bottom, double similar) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
this.similar = similar;
|
||||
}
|
||||
|
||||
public int getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(int left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public int getTop() {
|
||||
return top;
|
||||
}
|
||||
|
||||
public void setTop(int top) {
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public int getRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setRight(int right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public int getBottom() {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
public void setBottom(int bottom) {
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.right - this.left + 1;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.bottom - this.top + 1;
|
||||
}
|
||||
|
||||
public ViewPoint getCenter() {
|
||||
return new ViewPoint((left + right) / 2, (top + bottom) / 2);
|
||||
}
|
||||
|
||||
public ViewRect offset(int offsetX, int offsetY) {
|
||||
return new ViewRect(this.left + offsetX, this.top + offsetY, this.right + offsetX, this.bottom + offsetY);
|
||||
}
|
||||
|
||||
public ViewRect offsetX(int offsetX) {
|
||||
return new ViewRect(this.left + offsetX, this.top, this.right + offsetX, this.bottom);
|
||||
}
|
||||
|
||||
public ViewRect offsetY(int offsetY) {
|
||||
return new ViewRect(this.left, this.top + offsetY, this.right, this.bottom + offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ViewRect{" +
|
||||
"left=" + left +
|
||||
", top=" + top +
|
||||
", right=" + right +
|
||||
", bottom=" + bottom +
|
||||
'}';
|
||||
}
|
||||
}
|
Loading…
Reference in new issue