Example #1
0
 internal void CommitTiles(TileCollection tiles)
 {
     using (var tileGraphics = System.Drawing.Graphics.FromImage(tileImage))
     {
         for (int row = 0; row < tiles.Height; ++row)
         {
             for (int col = 0; col < tiles.Width; ++col)
             {
                 if (!tiles[row, col].Updated)
                 {
                     continue;
                 }
                 Bitmap source = Resources.Tiles.Clone(GraphicsUtils.GetGraphicSourceRectangle(tiles[row, col].GraphicsID, GraphicsConstants.TileWidth, Resources.Tiles.Width / GraphicsConstants.TileWidth), Resources.Tiles.PixelFormat);
                 GraphicsUtils.SwapColors(source, tiles[row, col].Palette);
                 tileGraphics.DrawImage(source, new Point(col * GraphicsConstants.TileWidth, row * GraphicsConstants.TileWidth));
                 tiles[row, col].Updated = false;
             }
         }
     }
 }
Example #2
0
 private protected override void UpdatePalette()
 {
     currentImage = sourceImage;
     GraphicsUtils.SwapColors(currentImage, Palette);
 }