Example #1
0
        /// <summary>
        /// Draws another bitmap into this image using straight-up pixel data.
        /// Not as fast as the Graphics.DrawImage();
        /// </summary>
        /// <param name="img">The source image.</param>
        /// <param name="x">x location in pixels.</param>
        /// <param name="y">y location in pixels.</param>
        public void DrawImage(Bitmap img, int x, int y)
        {
            FastBitmap fastSource = new FastBitmap(img);

            fastSource.LockImage();
            for (int y0 = y; y0 < _image.Height; ++y0)
            {
                if (y0 == Height)
                {
                    continue;
                }
                for (int x0 = x; x0 < _image.Width; ++x0)
                {
                    if (x0 == Width)
                    {
                        continue;
                    }
                    SetPixel(x0, y0, fastSource.GetPixel(x0 - x, y0 - y));
                }
            }
            fastSource.UnlockImage();
        }