Ejemplo n.º 1
0
        public Sprite MapImagesToSprite(IEnumerable<Image> images)
        {
            var imageInfos = images.ToDictionary(i => i, i => new Rectangle(0, 0, i.Width, i.Height));
            var canvas = new Canvas();
            var mapper = new MapperOptimalEfficiency(canvas);
            var sprite = mapper.Mapping(imageInfos);

            return sprite;
        }
Ejemplo n.º 2
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 );

    }
Ejemplo n.º 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));
        }
        public ISortedInventory SortInventory(IList <ISortableItem> items, int inventoryWith)
        {
            SortedInventory result = new SortedInventory(inventoryWith);
            var             canvas = new Canvas();

            Canvas _canvas = new Canvas();

            _canvas.SetCanvasDimensions(inventoryWith, 5);
            var c = _canvas.UnlimitedSize;
            MapperOptimalEfficiency <Sprite> mapper =
                new MapperOptimalEfficiency <Sprite>(_canvas);
            var res = mapper.Mapping(items);

            result.SetHeight(res.Height);

            foreach (var val in res.MappedImages.ToArray())
            {
                result.SortedItems.Add(new SortedItem((ISortableItem)val.ImageInfo, val.X, val.Y));
            }
            return(result);
        }