示例#1
0
        public static byte[] AsRgba8888(this IImageRead image)
        {
            switch (image.PixelFormat)
            {
            case PixelFormat.Indexed4:
                return(ImageDataHelpers.FromIndexed4ToBitmap32(
                           image.GetData(), image.GetClut(), Rgba));

            case PixelFormat.Indexed8:
                return(ImageDataHelpers.FromIndexed8ToBitmap32(
                           image.GetData(), image.GetClut(), Rgba));

            case PixelFormat.Rgba8888:
                return(ImageDataHelpers.FromBitmap32(image.GetData(), Bgra));

            default:
                throw new ArgumentException($"The pixel format {image.PixelFormat} is not supported.");
            }
        }
示例#2
0
        public void Decode4bppTest()
        {
            var actual = ImageDataHelpers.FromIndexed4ToBitmap32(Data4bpp, Clut4bpp, ImageDataHelpers.RGBA);

            Assert.Equal(ExpectedFrom4bpp, actual);
        }