void MakeClassicTextures(Bitmap bmp)
        {
            int  elemSize = bmp.Width / 16;
            Size size     = new Size(tileSize, tileSize);

            terrainBmp    = new Bitmap(tileSize * 2, tileSize);
            terrainPixels = new FastBitmap(terrainBmp, true, false);

            // Precompute the scaled background
            using (FastBitmap src = new FastBitmap(bmp, true, true)) {
                Drawer2DExt.DrawScaledPixels(src, terrainPixels, size,
                                             new Rectangle(2 * elemSize, 0, elemSize, elemSize),
                                             new Rectangle(tileSize, 0, tileSize, tileSize), 128, 64);
                Drawer2DExt.DrawScaledPixels(src, terrainPixels, size,
                                             new Rectangle(1 * elemSize, 0, elemSize, elemSize),
                                             new Rectangle(0, 0, tileSize, tileSize), 96, 96);
            }
        }
        public void RedrawBackground(FastBitmap dst)
        {
            if (Window.Minimised)
            {
                return;
            }
            Rectangle rect = new Rectangle(X + border, Y + border, Width - border * 2, Height - border * 2);

            if (Window.ClassicMode)
            {
                FastColour foreCol = Active ? new FastColour(126, 136, 191) : new FastColour(111, 111, 111);
                Drawer2DExt.DrawNoise(dst, rect, foreCol, 8);
            }
            else
            {
                FastColour foreCol = Active ? LauncherSkin.ButtonForeActiveCol : LauncherSkin.ButtonForeCol;
                Drawer2DExt.FastClear(dst, rect, foreCol);
            }
        }
示例#3
0
        void ClearTile(int x, int y, int width, int height, int srcX,
                       byte scaleA, byte scaleB, FastBitmap dst)
        {
            if (x >= Width || y >= Height)
            {
                return;
            }
            Rectangle srcRect = new Rectangle(srcX, 0, elemSize, elemSize);
            const int tileSize = 48;
            Size      size = new Size(tileSize, tileSize);
            int       xOrig = x, xMax = x + width, yMax = y + height;

            for ( ; y < yMax; y += tileSize)
            {
                for (x = xOrig; x < xMax; x += tileSize)
                {
                    int x2 = Math.Min(x + tileSize, Math.Min(xMax, Width));
                    int y2 = Math.Min(y + tileSize, Math.Min(yMax, Height));

                    Rectangle dstRect = new Rectangle(x, y, x2 - x, y2 - y);
                    Drawer2DExt.DrawScaledPixels(terrainPixels, dst, size, srcRect, dstRect, scaleA, scaleB);
                }
            }
        }