0
我尝试画在整个图像的多个斜线(让他们之间有一个空格)绘制多个对角线我用这个代码来绘制水平线和垂直线:爪哇 - 对一个BufferedImage
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条对角线),希望您能帮助我。
谢谢。
这是输出:[链接](http://imageshack.com/a/img593/2373/xu0f.png) 但我需要像这样:[链接](http://imageshack.com/a/img38/8007/rhf.bmp) 在哪里我可以决定我需要多少行 –