WebPFrameBlock

WebPFrameBlock(RasterImage)

Yeni bir örneğini başlatırWebPFrameBlock

sınıf.

public WebPFrameBlock(RasterImage rasterImage)
ParametreTipTanım
rasterImageRasterImageRaster görüntü.

Ayrıca bakınız


WebPFrameBlock(int, int)

Yeni bir örneğini başlatırWebPFrameBlock sınıf.

public WebPFrameBlock(int width, int height)
ParametreTipTanım
widthInt32Genişlik.
heightInt32Yükseklik.

Örnekler

Bu örnek, belirtilen seçeneklerle çok çerçeveli bir animasyonlu WebP görüntüsünün nasıl oluşturulacağını gösterir.

[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();

// Varsayılan çerçeve artı 36 + 36 ek çerçeve.
createOptions.AnimLoopCount = 36 + 36 + 1;

// 100x100 piksellik bir WebP görüntüsü oluşturun.
using (Aspose.Imaging.FileFormats.Webp.WebPImage webPImage = new Aspose.Imaging.FileFormats.Webp.WebPImage(100, 100, createOptions))
{
    // İlk daire kırmızı
    Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);

    // İkinci daire siyah
    Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);

    // Kırmızı yay şeklinin açısını kademeli olarak artırın.
    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);
    }

    // Siyah yayın açısını kademeli olarak artırın ve kırmızı yayı silin.
    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);
    }

    // Bir WebP dosyasına kaydet
    webPImage.Save(dir + "output.webp");
}

Ayrıca bakınız