protected virtual Image GenerateTileImage(int x, int y) { Room room = GetRoom(x, y); Bitmap img = room.GetImage(); return(img); }
protected override Image GenerateTileImage(int x, int y) { // Regenerate the "usedDungeonRooms" set when redrawing the whole // image (assumed to be starting at 0,0) if (roomsUsedInDungeons == null || (x == 0 && y == 0)) { roomsUsedInDungeons = Project.GetRoomsUsedInDungeons(); } Room room = GetRoom(x, y); Bitmap orig = room.GetImage(); if (!DarkenUsedDungeonRooms || !roomsUsedInDungeons.Contains(room.Index)) { return(orig); } Bitmap newImage = new Bitmap(orig.Width, orig.Height); const float ratio = (float)1.0 / 4; var matrix = new float[][] { new float[] { ratio, 0, 0, 0, 0 }, new float[] { 0, ratio, 0, 0, 0 }, new float[] { 0, 0, ratio, 0, 0 }, new float[] { 0, 0, 0, 1, 0 }, new float[] { 0, 0, 0, 0, 1 } }; var attributes = new ImageAttributes(); attributes.SetColorMatrix(new ColorMatrix(matrix)); using (Graphics g = Graphics.FromImage(newImage)) { g.DrawImage(orig, new Rectangle(0, 0, orig.Width, orig.Height), 0, 0, orig.Width, orig.Height, GraphicsUnit.Pixel, attributes); } return(newImage); }