GifFrameBlock

GifFrameBlock(ushort, ushort)

初始化GifFrameBlock类.

public GifFrameBlock(ushort width, ushort height)
范围类型描述
widthUInt16图像宽度。
heightUInt16图像高度。

例子

此示例说明如何创建 GIF 图像并将其保存到文件中。

[C#]

string dir = "c:\\temp\\";

// 创建一个 100x100 像素的 GIF 帧块。
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
{
    // 用红色填充整个块。
    Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(firstBlock);
    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
    gr.FillRectangle(brush, firstBlock.Bounds);

    using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
    {
        gifImage.Save(dir + "output.gif");
    }
}

此示例说明如何使用自定义调色板创建 GIF 图像并将其保存到文件中。

[C#]

string dir = "c:\\temp\\";

// 创建一个 100x100 像素的 GIF 帧块。
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
{
    // 用红色填充整个块。
    Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(firstBlock);
    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
    gr.FillRectangle(brush, firstBlock.Bounds);

    // 使用 4 位调色板来减小图像大小。质量可能会变得更糟。
    Aspose.Imaging.IColorPalette palette = Aspose.Imaging.ColorPaletteHelper.Create4Bit();

    using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock, palette))
    {
        gifImage.Save(dir + "output.gif");
    }
}

以下示例显示如何从单个 GIF 块组成动画 GIF 图像。

[C#]

string dir = "c:\\temp\\";

// 创建一个 100 x 100 像素的 GIF 图片。
// 默认情况下,第一个块是全黑的。
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
    // 第一个圆圈是红色的
    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.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);

        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
        gr.FillPie(brush1, block.Bounds, 0, angle);

        gifImage.AddBlock(block);
    }

    // 逐渐增加黑色弧线的角度,将红色弧线抹去。
    for (int angle = 10; angle <= 360; angle += 10)
    {
        Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);

        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
        gr.FillPie(brush2, block.Bounds, 0, angle);
        gr.FillPie(brush1, block.Bounds, angle, 360 - angle);

        gifImage.AddBlock(block);
    }

    gifImage.Save(dir + "animated_radar.gif");
}

也可以看看


GifFrameBlock(ushort, ushort, ushort, ushort)

初始化GifFrameBlock类.

public GifFrameBlock(ushort left, ushort top, ushort width, ushort height)
范围类型描述
leftUInt16左侧图像位置。
topUInt16顶部图像位置。
widthUInt16图像宽度。
heightUInt16图像高度。

也可以看看


GifFrameBlock(ushort, ushort, ushort, ushort, IColorPalette, bool, bool, byte)

初始化GifFrameBlock类.

public GifFrameBlock(ushort left, ushort top, ushort width, ushort height, 
    IColorPalette colorPalette, bool isPaletteSorted, bool isGifFrameInterlaced, byte bitsPerPixel)
范围类型描述
leftUInt16左侧图像位置。
topUInt16顶部图像位置。
widthUInt16图像宽度。
heightUInt16图像高度。
colorPaletteIColorPalette调色板。
isPaletteSortedBoolean如果设置为真的调色板已排序。
isGifFrameInterlacedBoolean如果设置为真的 GIF 帧是交错的。
bitsPerPixelByte每像素位数。

也可以看看


GifFrameBlock(RasterImage)

初始化GifFrameBlock类.

public GifFrameBlock(RasterImage image)
范围类型描述
imageRasterImage用于初始化帧像素和调色板数据的图像。

也可以看看


GifFrameBlock(RasterImage, ushort, ushort)

初始化GifFrameBlock类.

public GifFrameBlock(RasterImage image, ushort left, ushort top)
范围类型描述
imageRasterImage用于初始化帧像素和调色板数据的图像。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。

也可以看看


GifFrameBlock(RasterImage, ushort, ushort, bool, bool, byte)

初始化GifFrameBlock类.

public GifFrameBlock(RasterImage image, ushort left, ushort top, bool isPaletteSorted, 
    bool isGifFrameInterlaced, byte lzwCodeSize)
范围类型描述
imageRasterImage用于初始化帧像素和调色板数据的图像。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。
isPaletteSortedBoolean如果设置为真的调色板已排序。
isGifFrameInterlacedBoolean如果设置为真的 GIF 帧是交错的。
lzwCodeSizeByte每像素位数。

也可以看看


GifFrameBlock(Stream)

初始化GifFrameBlock类.

public GifFrameBlock(Stream stream)
范围类型描述
streamStream用于从中加载图像并用于初始化帧像素和调色板数据的流。

也可以看看


GifFrameBlock(Stream, ushort, ushort)

初始化GifFrameBlock类.

public GifFrameBlock(Stream stream, ushort left, ushort top)
范围类型描述
streamStream用于从中加载图像并用于初始化帧像素和调色板数据的流。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。

也可以看看


GifFrameBlock(Stream, ushort, ushort, bool, bool, byte)

初始化GifFrameBlock类.

public GifFrameBlock(Stream stream, ushort left, ushort top, bool isPaletteSorted, 
    bool isGifFrameInterlaced, byte lzwCodeSize)
范围类型描述
streamStream用于从中加载图像并用于初始化帧像素和调色板数据的流。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。
isPaletteSortedBoolean如果设置为真的调色板已排序。
isGifFrameInterlacedBoolean如果设置为真的 GIF 帧是交错的。
lzwCodeSizeByte每像素位数。

也可以看看


GifFrameBlock(string)

初始化GifFrameBlock类.

public GifFrameBlock(string path)
范围类型描述
pathString从中加载图像和初始化帧像素和调色板数据的路径。

也可以看看


GifFrameBlock(string, ushort, ushort)

初始化GifFrameBlock类.

public GifFrameBlock(string path, ushort left, ushort top)
范围类型描述
pathString从中加载图像和初始化帧像素和调色板数据的路径。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。

也可以看看


GifFrameBlock(string, ushort, ushort, bool, bool, byte)

初始化GifFrameBlock类.

public GifFrameBlock(string path, ushort left, ushort top, bool isPaletteSorted, 
    bool isGifFrameInterlaced, byte lzwCodeSize)
范围类型描述
pathString从中加载图像和初始化帧像素和调色板数据的路径。
leftUInt16左侧图像位置。
topUInt16顶部图像位置。
isPaletteSortedBoolean如果设置为真的调色板已排序。
isGifFrameInterlacedBoolean如果设置为真的 GIF 帧是交错的。
lzwCodeSizeByte每像素位数。

也可以看看