private void CreateSnapshotImage(PhotoInfo originalPhoto)
        {
            int height = (this.imageBuffer + this.imageHeight) + this.imageBuffer;
            int width  = (this.imageBuffer + this.imageWidth) + this.imageBuffer;

            if (Settings.Default.RenderCaption)
            {
                height += this.imageBuffer * 3;
            }
            Bitmap bitmap = new Bitmap(width, height);
            Image  image  = PhotoInfo.ConstrainSize(originalPhoto.SourceBitmap, this.imageWidth, this.imageHeight, true);

            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                PhotoInfo.SetDrawingQuality(graphics);
                graphics.Clear(Color.FromArgb(240, 240, 240));
                graphics.DrawRectangle(new Pen(Brushes.Gray, 3f), 0, 0, bitmap.Width - 1, bitmap.Height - 1);
                switch (ExifSupport.GetExifShort(originalPhoto.SourceBitmap, 0x112, 1))
                {
                case 3:
                    image.RotateFlip(RotateFlipType.Rotate180FlipNone);
                    break;

                case 6:
                    image.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    break;

                case 8:
                    image.RotateFlip(RotateFlipType.Rotate270FlipNone);
                    break;
                }
                graphics.DrawImage(image, this.imageBuffer, this.imageBuffer);
                graphics.DrawRectangle(Pens.LightGray, this.imageBuffer, this.imageBuffer, this.imageWidth - 1, this.imageHeight - 1);
                if (Settings.Default.RenderCaption)
                {
                    this.RenderCaption(originalPhoto, width, graphics);
                }
            }
            originalPhoto.SourceBitmap  = null;
            originalPhoto.WorkingBitmap = bitmap;
        }
        private void DrawImageRotated(PhotoInfo photo)
        {
            int   x     = this.rnd.Next(this._desktopPhotoPile.Width - this.imageWidth);
            int   y     = this.rnd.Next(this._desktopPhotoPile.Height - this.imageHeight);
            float angle = this.rnd.Next(60) - 30;

            using (Graphics graphics = Graphics.FromImage(this._desktopPhotoPile))
            {
                PhotoInfo.SetDrawingQuality(graphics);
                graphics.RotateTransform(angle);
                CompositingMode compositingMode = graphics.CompositingMode;
                graphics.CompositingMode = CompositingMode.SourceOver;
                using (SolidBrush brush = new SolidBrush(Color.FromArgb(70, 30, 30, 30)))
                {
                    int i = 8;
                    //for (int i = 8; i > 0; i--)
                    {
                        graphics.FillRectangle(brush, (int)(x + i), (int)(y + i), (int)(photo.WorkingBitmap.Width - 1), (int)(photo.WorkingBitmap.Height - 1));
                    }
                }
                graphics.CompositingMode = compositingMode;
                graphics.DrawImageUnscaled(photo.WorkingBitmap, x, y);
            }
        }