public Texture FromBitMap(byte[] data, TextureImporterSettings settings)
        {
            Texture tex = new Texture();

            tex.Height      = (uint)settings.TexHeight;
            tex.Width       = (uint)settings.TexWidth;
            tex.Format      = Format;
            tex.Name        = settings.TexName;
            tex.Path        = "";
            tex.TextureData = new List <List <byte[]> >();

            if (settings.MipCount == 0)
            {
                settings.MipCount = 1;
            }

            ChannelType[] channels = TextureData.SetChannelsByFormat(settings.Format);
            tex.ChannelRed      = channels[0];
            tex.ChannelGreen    = channels[1];
            tex.ChannelBlue     = channels[2];
            tex.ChannelAlpha    = channels[3];
            tex.sparseBinding   = settings.sparseBinding;
            tex.sparseResidency = settings.sparseResidency;
            tex.AccessFlags     = settings.AccessFlags;
            tex.ArrayLength     = settings.arrayLength;
            tex.MipCount        = settings.MipCount;
            tex.Depth           = settings.Depth;
            tex.Dim             = settings.Dim;
            tex.Flags           = settings.Flags;
            tex.TileMode        = settings.TileMode;
            tex.textureLayout   = settings.TextureLayout;
            tex.textureLayout2  = settings.TextureLayout2;
            tex.Swizzle         = settings.Swizzle;
            tex.SurfaceDim      = settings.SurfaceDim;
            tex.SampleCount     = settings.SampleCount;
            tex.Regs            = settings.Regs;
            tex.Pitch           = settings.Pitch;

            tex.MipOffsets = new long[tex.MipCount];

            List <byte[]> arrayFaces = new List <byte[]>();

            if (tex.ArrayLength > 1)
            {
                arrayFaces = DDS.GetArrayFaces(data, tex.ArrayLength);
            }
            else
            {
                arrayFaces.Add(data);
            }

            for (int i = 0; i < tex.ArrayLength; i++)
            {
                List <byte[]> mipmaps = SwizzleSurfaceMipMaps(tex, arrayFaces[i], tex.TileMode);
                tex.TextureData.Add(mipmaps);
                byte[] test = Combine(mipmaps);
                tex.TextureData[i][0] = test;
            }
            return(tex);
        }