Ejemplo n.º 1
0
        public Bitmap GetBitmap()
        {
            var bmp = new Bitmap(Width, Height);

            switch (TextureFormat)
            {
            case TextureFormat.Invalid:
                break;

            case TextureFormat.Etc1:
            case TextureFormat.Etc1A4:
                for (int y = 0; y < Height; y++)
                {
                    Etc.GetEtc1RasterData(Data, new Size(Width, Height), y, HasAlpha, bmp, 0);
                }
                break;

            default:
                GetPlainRasterData(bmp);
                break;
            }
            return(bmp);
        }
Ejemplo n.º 2
0
        public byte[] GetRGBA()
        {
            var data = new byte[Width * Height * 4];

            switch (TextureFormat)
            {
            case TextureFormat.Invalid:
                break;

            case TextureFormat.Etc1:
            case TextureFormat.Etc1A4:
                for (int y = 0; y < Height; y++)
                {
                    Etc.GetEtc1RasterData(Data, new Size(Width, Height), y, HasAlpha, data, 0);
                }
                break;

            default:
                GetPlainRasterData(ref data);
                break;
            }
            return(data);
        }
Ejemplo n.º 3
0
        public static uint GetPixelSize(TextureFormat textureFormat, int width, int height)
        {
            switch (textureFormat)
            {
            case TextureFormat.Rgba8:
                return((uint)(4 * width * height));

            case TextureFormat.Rgb8:
                return((uint)(3 * width * height));

            case TextureFormat.Rgb5551:
            case TextureFormat.Rgb565:
            case TextureFormat.Rgba4:
            case TextureFormat.La8:
            case TextureFormat.Hilo8:
                return((uint)(2 * width * height));

            case TextureFormat.L8:
            case TextureFormat.A8:
            case TextureFormat.La4:
                return((uint)(1 * width * height));

            case TextureFormat.L4:     //TODO: Verify this is correct
            case TextureFormat.A4:
                return((uint)((1 * width * height) / 2));

            case TextureFormat.Etc1:
                return((uint)Etc.GetEtc1Length(new Size(width, height), false));

            case TextureFormat.Etc1A4:
                return((uint)Etc.GetEtc1Length(new Size(width, height), true));

            default:
                throw new Exception("Unsupported Texture Format " + (int)textureFormat);
            }
        }