/*  <summary>
  *      Initializes a new texture atlas with an empty list of regions.
  *  </summary>
  *  <param name="texture"> <see cref="Texture2D " /> image used to draw on screen.</param>
  *  <param name="width">The width of the texture</param>
  *  <param name="height">The height of the texture</param>
  *  <param name="format">The color format of the Texture</param>
  *  <param name="minFilter">This is the x or min texture filter</param>
  *  <param name="maxFilter">This is the y or max texture filter</param>
  *  <param name="repeat">This is the repeat of the texture</param>
  */
 public TextureAtlas(Texture2D texture, int width, int height, SurfaceFormat format, TextureFilter minFilter, TextureFilter maxFilter, LibGDXAtlasExtender.Model.KeyEnums.Repeat repeat)
 {
     Texture    = texture;
     _regions   = new List <GDXTextureRegion2D>();
     _regionMap = new Dictionary <string, int>();
     Width      = width;
     Height     = height;
     Format     = format;
     MinFilter  = minFilter;
     MaxFilter  = maxFilter;
     Repeat     = repeat;
 }
        protected override List <TextureAtlas> Read(ContentReader reader, List <TextureAtlas> existingInstance)
        {
            String              assetName;
            Texture2D           texture;
            List <TextureAtlas> atlasList = new List <TextureAtlas>();
            int           textureCount    = 0;
            int           subTextCount    = 0;
            TextureAtlas  curAtlas;
            int           textWidth;
            int           textHeight;
            SurfaceFormat format = SurfaceFormat.Bgr32;

            Microsoft.Xna.Framework.Graphics.TextureFilter minFilter = Microsoft.Xna.Framework.Graphics.TextureFilter.Anisotropic;
            Microsoft.Xna.Framework.Graphics.TextureFilter maxFilter = Microsoft.Xna.Framework.Graphics.TextureFilter.Anisotropic;
            LibGDXAtlasExtender.Model.KeyEnums.Repeat      repeat    = LibGDXAtlasExtender.Model.KeyEnums.Repeat.none;
            String buffStr;

            textureCount = reader.ReadInt32();

            for (var i = 0; i < textureCount; i++)
            {
                assetName  = reader.GetRelativeAssetPath(reader.ReadString());
                textWidth  = reader.ReadInt32();
                textHeight = reader.ReadInt32();
                buffStr    = reader.ReadString();
                KeyTypeUtilities.Parse <SurfaceFormat>(buffStr, ref format);
                buffStr = reader.ReadString();
                KeyTypeUtilities.Parse <Microsoft.Xna.Framework.Graphics.TextureFilter>(buffStr, ref minFilter);
                buffStr = reader.ReadString();
                KeyTypeUtilities.Parse <Microsoft.Xna.Framework.Graphics.TextureFilter>(buffStr, ref maxFilter);
                buffStr = reader.ReadString();
                KeyTypeUtilities.Parse <LibGDXAtlasExtender.Model.KeyEnums.Repeat>(buffStr, ref repeat);

                Console.WriteLine("Assset Name: " + assetName);
                texture  = reader.ContentManager.Load <Texture2D>(assetName);
                curAtlas = new TextureAtlas(texture, textWidth, textHeight, format, minFilter, maxFilter, repeat);

                subTextCount = reader.ReadInt32();

                for (int s = 0; s < subTextCount; s++)
                {
                    curAtlas.CreateRegion(reader.ReadString(), reader.ReadBoolean(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(),
                                          reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32());
                }
                Console.WriteLine("Width: {0} Height: {1}", curAtlas.GetRegion(0).Width, curAtlas.GetRegion(0).Height);

                atlasList.Add(curAtlas);
            }

            return(atlasList);
        }