[英]Error with miter limit in Graphics2D.draw
我有以下代码:
BufferedImage off_Image = new BufferedImage(2000, 8000, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = off_Image.createGraphics();
graphics.setColor(Color.white);
graphics.fillRect(0, 0, off_Image.getWidth(), off_Image.getHeight());
graphics.setColor(Color.black);
graphics.setStroke(new BasicStroke(125, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10));
GeneralPath currentPath = new GeneralPath();
currentPath.moveTo(1788.32, 7450.98);
currentPath.lineTo(1767.5, 5898);
currentPath.lineTo(1767.5, 5897.84);
currentPath.curveTo(1758.14, 5894.52, 1751.96, 5893.82, 1748.82, 5893.91);
currentPath.lineTo(435.867, 5893.91);
graphics.draw(currentPath);
有人可以告诉我为什么会这样吗? 曲线的起点与其第一个控制点之间的角度不应足够尖锐,以至于不能像这样斜切。
我还注意到,将curveTo之前的lineTo更改为:
currentPath.lineTo(1767.5, 5899);
解决问题。 这不会改变斜接的长度,所以我也对为什么这样有效感到困惑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.