WebPFrameBlock
内容
[
隐藏
]WebPFrameBlock(RasterImage)
班级。
public WebPFrameBlock(RasterImage rasterImage)
范围 | 类型 | 描述 |
---|---|---|
rasterImage | RasterImage | 光栅图像。 |
也可以看看
- class RasterImage
- class WebPFrameBlock
- 命名空间 Aspose.Imaging.FileFormats.Webp
- 部件 Aspose.Imaging
WebPFrameBlock(int, int)
初始化WebPFrameBlock
类.
public WebPFrameBlock(int width, int height)
范围 | 类型 | 描述 |
---|---|---|
width | Int32 | 宽度。 |
height | Int32 | 高度。 |
例子
此示例说明如何使用指定选项创建多帧动画 WebP 图像。
[C#]
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.WebPOptions createOptions = new Aspose.Imaging.ImageOptions.WebPOptions();
createOptions.Lossless = true;
createOptions.Quality = 100f;
createOptions.AnimBackgroundColor = (uint)Aspose.Imaging.Color.Gray.ToArgb();
// 默认帧加上 36 + 36 个附加帧。
createOptions.AnimLoopCount = 36 + 36 + 1;
// 创建一个 100x100 像素的 WebP 图像。
using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(100, 100, createOptions))
{
// 第一个圆圈是红色的
Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
//第二个圆圈是黑色的
Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);
// 逐渐增加红色弧形的角度。
for (int angle = 10; angle <= 360; angle += 10)
{
Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
graphics.FillPie(brush1, block.Bounds, 0, angle);
webPImage.AddBlock(block);
}
// 逐渐增加黑色弧线的角度,将红色弧线抹去。
for (int angle = 10; angle <= 360; angle += 10)
{
Aspose.Imaging.FileFormats.Webp.WebPFrameBlock block = new Aspose.Imaging.FileFormats.Webp.WebPFrameBlock(100, 100);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(block);
graphics.FillPie(brush2, block.Bounds, 0, angle);
graphics.FillPie(brush1, block.Bounds, angle, 360 - angle);
webPImage.AddBlock(block);
}
// 保存到 WebP 文件
webPImage.Save(dir + "output.webp");
}