【发布时间】:2014-02-24 18:05:25
【问题描述】:
我试图在整个图像上绘制多条对角线(在它们之间留一个空间)我使用此代码来绘制水平和垂直线:
for (int z = 1; z < partToCrop; z++) {
Shape hLines = new Line2D.Float(0, cropInPartWidth*z, chunkWidth, cropInPartWidth*z);
Shape vLines = new Line2D.Float(cropInPartHeight*z, 0, cropInPartHeight*z, chunkHeight);
gr.draw(hLines); //gr is a BufferedImage
gr.draw(vLines);
}
在哪里
int partToCrop = 5;
float cropInPartWidth = imgWidth / partToCrop;
float cropInPartHeight = imgHeight / partToCrop;
而且效果很好。现在我需要在整个图像上绘制多条倾斜度为 45° 和 -45° 的对角线(即 4 条对角线),希望你能帮助我。
谢谢。
【问题讨论】: