public void draw(Graphics g) { //定义棋子圆心 int xPos = col * 20 + 15; int yPos = row * 20 + 15; Graphics2D g2d = (Graphics2D) g; RadialGradientPaint paint = null; Color[] c = { Color.WHITE, Color.BLACK }; float[] f = { 0f, 1f }; int x = xPos + 3; int y = yPos - 3; if (color == Color.WHITE) { paint = new RadialGradientPaint(x, y, BANJING * 3, f, c); } else { paint = new RadialGradientPaint(x, y, BANJING, f, c); } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);//KEY_ANTIALIASING抗锯齿提示键。VALUE_ANTIALIAS_ON抗锯齿提示值——使用抗锯齿模式完成呈现。 g2d.setPaint(paint); g2d.fillOval(xPos - BANJING / 2, yPos - BANJING / 2, BANJING, BANJING);//public abstract void fillOval(int x,int y,int width,int height)。 }
时间: 2024-02-14 14:18:48 浏览: 110
基于Horn-Schunck光流场提取的车辆跟踪检测算法matlab仿真,包含仿真操作录像,代码中文注释
_HOST_BUF_SIZE) {
len = JTAG_HOST_BUF_SIZE;
}
struct jtag_ioctrl_read read;
memset(&read, 0, sizeof(read));
read.data = jtag->buf;
read.size = len;
read.timeout = jtag这段代码是用于在Java中绘制一个棋子的方法。它使用了Java的Graphics2D类和Radial->cfg.timeout;
read.retry = jtag->cfg.retry;
int ret = ioctl(jtag_dev_fd, JTAG_IOCTRL_READGradientPaint类来实现棋子的渐变效果。具体来说,它根据棋子的颜色设置不, &read);
if (ret != 0) {
return false;
}
memcpy(data + index, jtag->buf同的渐变半径,然后使用fillOval方法绘制一个圆形棋子。最后,使用抗锯齿, len);
index += len;
}
return true;
}
bool jtag_host_write_read(jtag_host_t *jtag,模式完成呈现,使得棋子看起来更加平滑。
阅读全文