Example #1
0
        private void RenderRaster()
        {
            var map = ras.ExportMap();
            int w = map.GetUpperBound(0) + 1, h = map.GetUpperBound(1) + 1;
            var bmp = new Bitmap(w * ScaleFactor, h * ScaleFactor);

            for (var x = 0; x < w; x++)
            {
                for (var y = 0; y < h; y++)
                {
                    var type = map[x, y].TileType;
                    if (type.Id == 0xfe || type.Name == null)
                    {
                        continue;
                    }
                    for (var dx = 0; dx < ScaleFactor; dx++)
                    {
                        for (var dy = 0; dy < ScaleFactor; dy++)
                        {
                            bmp.SetPixel(x * ScaleFactor + dx, y * ScaleFactor + dy,
                                         Color.FromArgb(type.Name.GetHashCode() & 0x00ffffff | (0xff << 24)));
                        }
                    }
                }
            }

            var original = box.Image;

            box.Image = bmp;
            original?.Dispose();
        }
Example #2
0
 public string ExportToJson() => JsonMap.Save(ras.ExportMap());