SaveArgb32Pixels
RasterImage.SaveArgb32Pixels method
保存 32 位 ARGB 像素。
public void SaveArgb32Pixels(Rectangle rectangle, int[] pixels)
范围 | 类型 | 描述 |
---|---|---|
rectangle | Rectangle | 保存像素的矩形。 |
pixels | Int32[] | 32 位 ARGB 像素阵列。 |
例子
以下示例使用 Aspose.Imaging.RasterImage.SaveArgb32Pixels 方法用黑色像素填充光栅图像的中心区域。
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// 黑色方块
int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.Black.ToArgb();
}
// 在图像中心绘制黑色方块。
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SaveArgb32Pixels(area, pixels);
rasterImage.Save(dir + "sample.SaveArgb32Pixels.png");
}
也可以看看
- struct Rectangle
- class RasterImage
- 命名空间 Aspose.Imaging
- 部件 Aspose.Imaging