// Fetches the image we're going to be using as our background, to easier represent how the
        // collision map is going to be.
        public CollisionMapDialogue(GridTile image)
        {
            InitializeComponent();

            if (image == null) return;

            tileToChange = image;

            ImageBrush brush = new ImageBrush(image.Image.Source);
            CollisionMapGrid.Background = brush;

            tempCollisionMap = new int[3][];

            for (int i = 0; i < tempCollisionMap.Length; i++)
            {
                tempCollisionMap[i] = new int[i+3];
            }

            comparisonBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
            LoadCollisionMap();
        }
        // Serializes a grid tile and returns it as such.
        public GridTileSerializable SerializeGridTile(GridTile tile)
        {
            byte[] imageData;

            if (tile.Name == "")
                return new GridTileSerializable(tile.Rotation, tile.Id, null, null);

            // Read the file into a byte array, effectively converting the image in grid tile to a byte array, which we can
            // save in a XML file.
            using (MemoryStream fs = new MemoryStream())
            {
                var encoder = new PngBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create((BitmapSource)tile.Image.Source));
                encoder.Save(fs);
                imageData = fs.GetBuffer();
            }

            return new GridTileSerializable(tile.Rotation, tile.Id, imageData, tile.CollisionMap)
            {
                Row = tile.Row,
                Column = tile.Column,
                CollisionMap = tile.CollisionMap
            };
        }