GetBackgroundPalettes() публичный Метод

public GetBackgroundPalettes ( ) : Color[][]
Результат Color[][]
Пример #1
0
        public Bitmap GetTileImage(int index)
        {
            if (tileImagesCache[index] != null)
            {
                return(tileImagesCache[index]);
            }

            Bitmap image = new Bitmap(16, 16);

            Graphics g = Graphics.FromImage(image);

            for (int y = 0; y < 2; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    int tileIndex = GetSubTileIndex(index, x, y);
                    int flags     = GetSubTileFlags(index, x, y);

                    int tileOffset = 0x1000 + ((sbyte)tileIndex) * 16;

                    byte[] src = new byte[16];
                    Array.Copy(graphicsState.VramBuffer[1], tileOffset, src, 0, 16);
                    Bitmap subImage = GbGraphics.TileToBitmap(src, GraphicsState.GetBackgroundPalettes()[flags & 7], flags);

                    g.DrawImageUnscaled(subImage, x * 8, y * 8);
                }
            }
            g.Dispose();

//             if (fullCachedImageData == null)
//                 fullCachedImageData = fullCachedImage.LockBits(
//                         new Rectangle(0, 0, fullCachedImage.Width, fullCachedImage.Height),
//                         ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
//             GbGraphics.QuickDraw(fullCachedImageData, image, (index%16)*16, (index/16)*16);
            g = Graphics.FromImage(fullCachedImage);
            g.DrawImageUnscaled(image, (index % 16) * 16, (index / 16) * 16);
            g.Dispose();

            tileImagesCache[index] = image;
            return(image);
        }