Bos*_*sak 11 .net c# image image-processing
我有一个tileset,但所有的tile都在一个图像中.我希望得到某种位图或图像数组中的每个图块.是否有某种方法可以做到这一点?
Dam*_*ith 23
使用Bitmap.Clone(Rectangle,PixelFormat),这里我们可以设置新图像的PixelFormat和矩形的大小
// Create a Bitmap object from a file.
Bitmap myBitmap = new Bitmap("Grapes.jpg");
// Clone a portion of the Bitmap object.
Rectangle cloneRect = new Rectangle(0, 0, 100, 100);
System.Drawing.Imaging.PixelFormat format =
myBitmap.PixelFormat;
Bitmap cloneBitmap = myBitmap.Clone(cloneRect, format);
// Draw the cloned portion of the Bitmap object.
e.Graphics.DrawImage(cloneBitmap, 0, 0);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15882 次 |
| 最近记录: |