예제 #1
0
        /// <summary>
        /// Gets a <see cref="Bitmap"/> given an array and mip index.
        /// </summary>
        /// <param name="ArrayIndex">The index of the surface/array. Cubemaps will have 6</param>
        /// <param name="MipLevel">The index of the mip level.</param>
        /// <returns></returns>
        public Bitmap GetBitmap(int ArrayLevel = 0, int MipLevel = 0, int DepthLevel = 0)
        {
            uint width  = Math.Max(1, Width >> MipLevel);
            uint height = Math.Max(1, Height >> MipLevel);

            byte[] data = GetImageData(ArrayLevel, MipLevel, DepthLevel);

            Console.WriteLine($"data {data.Length}");
            data = Platform.DecodeImage(this, data, width, height, ArrayLevel, MipLevel);
            Console.WriteLine($"data2 {data.Length}");

            Console.WriteLine($"OutputFormat {Platform.OutputFormat}");

            if (Platform.OutputFormat != TexFormat.RGBA8_UNORM)
            {
                data = DecodeBlock(data, width, height, Platform.OutputFormat);
            }
            else if (Platform is DefaultSwizzle || Platform is TegraX1Swizzle || Platform is WiiUSwizzle)
            {
                data = ImageUtility.ConvertBgraToRgba(data);
            }

            return(BitmapExtension.CreateBitmap(data, (int)width, (int)height));
        }
예제 #2
0
 public static System.Drawing.Bitmap DecodeBlockToBitmap(byte[] Input, int Width, int Height, PICASurfaceFormat picaFormat)
 {
     return(BitmapExtension.CreateBitmap(ImageUtility.ConvertBgraToRgba(DecodeBlock(Input, Width, Height, picaFormat)),
                                         Width, Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb));
 }