提交 3bef2d4e 编写于 作者: 如梦技术's avatar 如梦技术 🐛

代码优化。

上级 179e8ea1
......@@ -38,12 +38,17 @@ public enum CurveInterferenceDraw implements InterferenceDraw {
public void draw(Graphics2D g, int width, int height, Font[] fonts, Random random) {
// 复用上层颜色,width是线宽,float型
g.setStroke(new BasicStroke(1.8F));
int x1 = 5, y1 = CaptchaUtil.randNum(random, 5, height / 2);
int x1 = 5;
int y1 = CaptchaUtil.randNum(random, 5, height / 2);
int maxHeight = height - 5;
int minWidth = width / 4, maxWidth = width / 4 * 3;
int ctrLx1 = CaptchaUtil.randNum(random, minWidth, maxWidth), ctrLy1 = CaptchaUtil.randNum(random, 5, maxHeight);
int ctrLx2 = CaptchaUtil.randNum(random, minWidth, maxWidth), ctrLy2 = CaptchaUtil.randNum(random, 5, maxHeight);
int x2 = width - 5, y2 = CaptchaUtil.randNum(random, height / 2, maxHeight);
int minWidth = width / 4;
int maxWidth = width / 4 * 3;
int ctrLx1 = CaptchaUtil.randNum(random, minWidth, maxWidth);
int ctrLy1 = CaptchaUtil.randNum(random, 5, maxHeight);
int ctrLx2 = CaptchaUtil.randNum(random, minWidth, maxWidth);
int ctrLy2 = CaptchaUtil.randNum(random, 5, maxHeight);
int x2 = width - 5;
int y2 = CaptchaUtil.randNum(random, height / 2, maxHeight);
// 画三次曲线
g.draw(new CubicCurve2D.Double(x1, y1, ctrLx1, ctrLy1, ctrLx2, ctrLy2, x2, y2));
}
......
......@@ -62,15 +62,16 @@ public class AsyncExchange {
call.enqueue(new AsyncCallback(this));
}
void onResponse(HttpResponse httpResponse) {
protected void onResponse(HttpResponse httpResponse) {
responseConsumer.accept(httpResponse);
}
void onSuccessful(HttpResponse httpResponse) {
protected void onSuccessful(HttpResponse httpResponse) {
successConsumer.accept(httpResponse);
}
void onFailure(Request request, IOException e) {
protected void onFailure(Request request, IOException e) {
failedBiConsumer.accept(request, e);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册