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; }
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 ); }
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); }