static Bitmap RenderNoiseBmp(int w, int h) { Bitmap bmp = new Bitmap(w, h); BitmapBuffer buff = new BitmapBuffer(bmp); buff.Lock(); var noise = new Noise(Environment.TickCount); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { uint color = 0x00ffffff; color |= (uint)(noise.GetNoise(x / (double)w * 2, y / (double)h * 2, 0) * 255) << 24; buff[x, y] = color; } buff.Unlock(); return bmp; }
static Bitmap RenderTerrainBmp(TerrainTile[,] tiles) { int w = tiles.GetLength(0); int h = tiles.GetLength(1); Bitmap bmp = new Bitmap(w, h); BitmapBuffer buff = new BitmapBuffer(bmp); buff.Lock(); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { buff[x, y] = TileTypes.terrainColor[tiles[x, y].Terrain]; } buff.Unlock(); return bmp; }
static Bitmap RenderMoistBmp(TerrainTile[,] tiles) { int w = tiles.GetLength(0); int h = tiles.GetLength(1); Bitmap bmp = new Bitmap(w, h); BitmapBuffer buff = new BitmapBuffer(bmp); buff.Lock(); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { uint color = 0x00ffffff; color |= (uint)(tiles[x, y].Moisture * 255) << 24; buff[x, y] = color; } buff.Unlock(); return bmp; }