我试图在Windows窗体中裁剪图像(C#)。我是用直角做的。但我想用曲线分开它。
将单个图像分割为3x3图像,然后放入9个不同的图像框中。这是我目前的代码:
Image img = pictureBox1.Image;
int widththird = (int)((double)img.Width / 3.0 + 0.5);
int heightthird = (int)((double)img.Height / 3.0 + 0.5);
Bitmap[,] bmps = new Bitmap[3, 3];
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
bmps[i, j] = new Bitmap(widththird, heightthird);
Graphics g = Graphics.FromImage(bmps[i,j]);
g.DrawImage(img, new Rectangle(0, 0, widththird, heightthird), new
Rectangle(j * widththird, i * heightthird, widththird, heightthird),
GraphicsUnit.Pixel);
g.Dispose();
}
}
pictureBox2.Image = bmps[0, 0];
pictureBox3.Image = bmps[0, 1];
pictureBox4.Image = bmps[0, 2];
pictureBox5.Image = bmps[1, 0];
pictureBox6.Image = bmps[1, 1];
pictureBox7.Image = bmps[1, 2];
pictureBox8.Image = bmps[2, 0];
pictureBox9.Image = bmps[2, 1];
pictureBox10.Image = bmps[2, 2];
问:如何使用曲线裁剪/拆分图像并导出碎片?
我的输出:
我希望它像这样裁剪: