internal static SpriteInfo Create(MappedImageCollection mappedResult)
        {
            var info = new SpriteInfo();

            var items = mappedResult.MappedImages.Select(item => SpriteItem.Create(item, info)).ToArray();

            return(new SpriteInfo
            {
                Size = new Size(mappedResult.Width, mappedResult.Height),
                Items = items
            });
        }
    internal static SpriteInfo Create( MappedImageCollection mappedResult )
    {

      var info = new SpriteInfo();

      var items = mappedResult.MappedImages.Select( item => SpriteItem.Create( item, info ) ).ToArray();

      return new SpriteInfo
      {
        Size = new Size( mappedResult.Width, mappedResult.Height ),
        Items = items
      };

    }
Exemple #3
0
        private static SpriteInfo CreateSprite(string path)
        {
            var images = Directory.EnumerateFiles(path, "*")
                         .Select(filepath => ImageInfo.Create(filepath))
                         .Where(item => item != null).ToArray();

            if (images.Any() == false)
            {
                return(null);
            }



            var mapper = new MapperOptimalEfficiency <MappedImageCollection>(new Canvas());
            var sprite = mapper.Mapping(images);

            return(SpriteInfo.Create(sprite));
        }
Exemple #4
0
 internal static SpriteItem Create(IMappedImageInfo item, SpriteInfo sprite)
 {
     return(new SpriteItem((ImageInfo)item.ImageInfo, new Point(item.X, item.Y), sprite));
 }
Exemple #5
0
 private SpriteItem(ImageInfo image, Point offset, SpriteInfo sprite)
 {
     ImageInfo  = image;
     Offset     = offset;
     SpriteInfo = sprite;
 }
 internal static SpriteItem Create( IMappedImageInfo item, SpriteInfo sprite )
 {
   return new SpriteItem( (ImageInfo) item.ImageInfo, new Point( item.X, item.Y ), sprite );
 }
 private SpriteItem( ImageInfo image, Point offset, SpriteInfo sprite )
 {
   ImageInfo = image;
   Offset = offset;
   SpriteInfo = sprite;
 }
Exemple #8
0
 public SpriteInfo CreateSprite()
 {
     return(SpriteInfo.Create(this));
 }