Exemple #1
0
        public static (DecodedImage, byte[]) Decode(byte[] buffer, RenderedImage compressedImage)
        {
            int width  = compressedImage.Width,
                height = compressedImage.Height,
                stride = compressedImage.Stride;

            if (buffer == null || buffer.Length < width * stride)
            {
                buffer = new byte[width * stride];
            }
            LZ4Codec.Decode(
                compressedImage.Buffer, 0, compressedImage.Buffer.Length,
                buffer, 0, buffer.Length);
            if (width * 4 != stride)
            {
                for (var line = 0; line < height; line++)
                {
                    Array.Copy(buffer, line * stride,
                               buffer, line * width * 4, width * 4);
                }
            }
            return(new DecodedImage {
                Width = width, Height = height, Buffer = buffer
            }, buffer);
        }
Exemple #2
0
        public unsafe RenderedImage Render(int width, int height, int milliSec)
        {
            ruminoid_rendercore.RuminoidRcRenderFrame(_this, width, height, milliSec);
            var result = ruminoid_rendercore.RuminoidRcGetResult(_this);

            var image = new RenderedImage {
                Width = result.Width, Height = result.Height, Stride = result.Stride
            };

            image.Buffer = new byte[result.CompressedSize];
            Marshal.Copy((IntPtr)result.Buffer, image.Buffer, 0, (int)result.CompressedSize);

            return(image);
        }
Exemple #3
0
 private bool Equals(RenderedImage other)
 {
     return(Width == other.Width && Height == other.Height && Stride == other.Stride && Equals(Buffer, other.Buffer));
 }