コード例 #1
0
        public static Bitmap CreatePassableBitmap(this IZone zone, Color passableTileColor, Color islandTileColor = default(Color))
        {
            var skipIsland = islandTileColor.Equals(default(Color));

            var b = zone.CreateBitmap();

            b.WithGraphics(g => g.FillRectangle(new SolidBrush(Color.FromArgb(255, 0, 0, 0)), 0, 0, zone.Size.Width - 1, zone.Size.Height - 1));

            return(b.ForEach((bmp, x, y) =>
            {
                if (zone.Terrain.Blocks[x, y].Island)
                {
                    if (skipIsland)
                    {
                        return;                          //island pixels will be black
                    }
                    bmp.SetPixel(x, y, islandTileColor); //OR optionally the supported color
                    return;
                }

                if (!zone.Terrain.IsPassable(x, y))
                {
                    return;
                }

                bmp.SetPixel(x, y, passableTileColor);
            }));
        }
コード例 #2
0
 private Bitmap CreateAltitudeBitmap()
 {
     return(_zone.CreateBitmap().ForEach((bmp, x, y) =>
     {
         var altitudeValue = (byte)(_zone.Terrain.Altitude.GetAltitudeAsDouble(x, y) / 2048 * 612).Clamp(0, 255);
         var color = Color.FromArgb(altitudeValue, altitudeValue, altitudeValue);
         bmp.SetPixel(x, y, color);
     }));
 }