/// <summary> /// Capture one Bitmap. /// </summary> /// <param name="region"></param> /// <param name="offset"></param> public async void CaptureImage(Rectangle region, Point offset) { var stream = new MemoryStream(); var bitmap = CaptureService.GetBitmap(region, offset); bitmap.Save(stream, ConfigService.Current.ImageFormat); // Copy bitmap to the clipboard if (!ConfigService.Current.NoImageCopy) { CopyImage(bitmap); } // Generate filename and start the upload(s) var url = await UploadAll(stream, ConfigService.Current.SafeImageExt); // Try to copy URL if (ConfigService.Current.NoImageCopy) { CopyUrl(url); } bitmap.Dispose(); stream.Dispose(); Complete(url != null); // Exits the application }
/// <summary> /// Refresh the background if transparency is disabled. /// </summary> private void RefreshBackground() { if (!ConfigService.Current.NoTransparency) { return; } SetScaling(); var bitmap = CaptureService.GetBitmap(new Rectangle(Point.Empty, screen.Size), screen.Location); BackgroundImage = CaptureService.ResizeBitmap(bitmap, Width, Height); Opacity = 1.0D; }