public PaletteTile(TileInfo tileInfo, double widthAndHeight)
     : this(tileInfo.Id, widthAndHeight, tileInfo.Rgb)
 {
     Bitmap = tileInfo.TileBitmap;
     BitmapImage = ImageHelper.ToBitmapImage(Bitmap);
     SetBytes();
 }
        private static void LoadContainer()
        {
            var directory = new DirectoryInfo("Tiles");

            var avgColorCalculator = new AvgColorCalculator();
            var i = 0;
            foreach (var tileImageFile in directory.GetFiles("*.jpg", SearchOption.TopDirectoryOnly))
            {
                var bitmap = new Bitmap(tileImageFile.FullName);

                /*            // hard code, because tile images has white surrounding area
                            var tileBitmap = new Bitmap(240, 240);
                            var g = Graphics.FromImage(tileBitmap);
                            g.DrawImage(bitmap, 0, 0, new Rectangle(145, 145, 240, 240), GraphicsUnit.Pixel);
                            tileBitmap.Save(string.Format("{0}.jpg", i));
                            i++;
                            //
            */
                var tileInfo = new TileInfo {TileBitmap = bitmap};
                tileInfo.Rgb = avgColorCalculator.Calculate(bitmap);
                tileInfo.Id = i++;
                TileBase.Add(tileInfo.Id, tileInfo);
            }
        }
 private static ColumnDefinition CreateTileColumn(TileInfo tileInfo)
 {
     return new ColumnDefinition();
 }