コード例 #1
0
ファイル: MetaSprite.cs プロジェクト: pwnskar/NESAC
        public Bitmap GetBitmap(NESPalette nesPalette, PaletteSelection paletteSelection, ChrTable chrTable, bool chr8x16)
        {
            Bitmap   bm = new Bitmap(128, 128);
            Graphics g  = Graphics.FromImage(bm);

            g.Clear(nesPalette[paletteSelection[0][0]]);

            for (int i = this.Count - 1; i >= 0; i--)
            {
                OamEntry o = this[i];

                Bitmap b = chrTable.GetBitmap(o.Char, paletteSelection[o.GetPaletteIndex()], nesPalette, chr8x16);
                if (o.VerticalIsFlipped())
                {
                    b.RotateFlip(RotateFlipType.RotateNoneFlipY);
                }
                if (o.HorizontalIsFlipped())
                {
                    b.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }

                g.DrawImage(b, o.X, o.Y);
            }

            return(bm);
        }
コード例 #2
0
        public Bitmap GetPaletteSelectionAsBitmap(PaletteSelection paletteSelection, int paletteSelectionIndex)
        {
            Bitmap   bm = new Bitmap(16 * 4, 16);
            Graphics g  = Graphics.FromImage(bm);

            for (int i = 0; i < paletteSelection[paletteSelectionIndex].Length; i++)
            {
                Bitmap b = this.GetColorAsBitmap(paletteSelection[paletteSelectionIndex][i], 16, 16);

                int x = i * 16;

                g.DrawImage(b, x, 0);
            }

            return(bm);
        }