Пример #1
0
        private void UpdateImage()
        {
            if (sprite != null)
            {
                Bitmap     b   = new Bitmap(sprite.Width, sprite.Height, PixelFormat.Format32bppArgb);
                BitmapData bmd = b.LockBits(new Rectangle(Point.Empty, b.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                sprite.DrawSprite(bmd, palette, portraitPalette);
                b.UnlockBits(bmd);
                if (tiles != null)
                {
                    using (Pen p = new Pen(Color.Yellow))
                        using (Graphics g = Graphics.FromImage(b))
                        {
                            foreach (Tile t in tiles)
                            {
                                g.DrawRectangle(p, t.Rectangle);
                            }
                        }
                }

                SuspendLayout();
                pictureBox1.SuspendLayout();
                if (pictureBox1.Image != null)
                {
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = null;
                }
                pictureBox1.Image = b;
                pictureBox1.ResumeLayout();
                ResumeLayout(false);
                PerformLayout();
            }
        }
Пример #2
0
 /// <summary>
 /// Draws a sprite.
 /// </summary>
 /// <param name="b">The <see cref="Bitmap"/> object to draw on.</param>
 /// <param name="s">The <see cref="Sprite"/> to draw.</param>
 /// <param name="p">The <see cref="Palette"/> to use to draw the sprite.</param>
 public static void DrawSprite(this Bitmap b, AbstractSprite s, int palette, int portrait)
 {
     s.DrawSprite(b, palette, portrait);
 }
Пример #3
0
 /// <summary>
 /// Draws a sprite.
 /// </summary>
 /// <param name="b">The <see cref="Bitmap"/> object to draw on.</param>
 /// <param name="s">The <see cref="Sprite"/> to draw.</param>
 /// <param name="p">The <see cref="Palette"/> to use to draw the sprite.</param>
 public static void DrawSprite( this Bitmap b, AbstractSprite s, int palette, int portrait )
 {
     s.DrawSprite( b, palette, portrait );
 }