コード例 #1
0
    static byte[] Write(IImageEncoder encoder, uint[] palette, IReadOnlyTexture <byte> existing, int frameNum)
    {
        var frame  = existing.Regions[frameNum];
        var buffer = new ReadOnlyImageBuffer <byte>(
            frame.Width,
            frame.Height,
            existing.Width,
            existing.PixelData.Slice(frame.PixelOffset, frame.PixelLength));

        Image <Rgba32> image = ImageSharpUtil.ToImageSharp(buffer, palette);
        var            bytes = FormatUtil.BytesFromStream(stream => encoder.Encode(image, stream));

        return(bytes);
    }
コード例 #2
0
        static byte[] Write(IImageEncoder encoder, uint[] palette, IReadOnlyTexture <byte> existing)
        {
            var image = ImageSharpUtil.PackSpriteSheet(palette, existing.Regions.Count, existing.GetRegionBuffer);

            return(FormatUtil.BytesFromStream(stream => encoder.Encode(image, stream)));
        }