public ScreenColorPicker(TaskSettings taskSettings) { if (taskSettings != null) { surfaceOptions = taskSettings.CaptureSettings.SurfaceOptions; } else { surfaceOptions = new SurfaceOptions(); } InitializeComponent(); colorPicker.DrawCrosshair = true; colorTimer.Tick += colorTimer_Tick; UpdateControls(true); foreach (Control control in Controls) { if (control is NumericUpDown || control is TextBox) { control.DoubleClick += CopyToClipboard; } } }
public Surface(Image backgroundImage = null) { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle); InitializeComponent(); using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } if (backgroundImage != null) { SurfaceImage = backgroundImage; Prepare(); } DrawableObjects = new List<DrawableObject>(); Config = new SurfaceOptions(); timer = new Stopwatch(); borderPen = new Pen(Color.Black); borderDotPen = new Pen(Color.Black, 1); borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Arial", 17, FontStyle.Bold); }
public Surface(Image backgroundImage = null) { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.FixScreenCoordinates(ScreenRectangle); InitializeComponent(); SurfaceImage = backgroundImage; Prepare(); DrawableObjects = new List<DrawableObject>(); Config = new SurfaceOptions(); timer = new Stopwatch(); borderPen = new Pen(Color.DarkBlue); borderDotPen = new Pen(Color.Black, 1); borderDotPen.DashPattern = new float[] { 5, 5 }; borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; borderDotPen2.DashOffset = 5; shadowBrush = new SolidBrush(Color.FromArgb(75, Color.Black)); lightBrush = new SolidBrush(Color.FromArgb(10, Color.Black)); nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Arial", 12, FontStyle.Bold); Shown += new EventHandler(Surface_Shown); KeyUp += new KeyEventHandler(Surface_KeyUp); MouseDoubleClick += new MouseEventHandler(Surface_MouseDoubleClick); }
public Surface(Image backgroundImage = null) { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle); InitializeComponent(); using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } if (backgroundImage != null) { SurfaceImage = backgroundImage; Prepare(); } DrawableObjects = new List <DrawableObject>(); Config = new SurfaceOptions(); timer = new Stopwatch(); borderPen = new Pen(Color.Black); borderDotPen = new Pen(Color.Black, 1); borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Arial", 17, FontStyle.Bold); }
public Surface(Image backgroundImage = null) { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.FixScreenCoordinates(ScreenRectangle); InitializeComponent(); SurfaceImage = backgroundImage; Prepare(); DrawableObjects = new List <DrawableObject>(); Config = new SurfaceOptions(); timer = new Stopwatch(); borderPen = new Pen(Color.DarkBlue); borderDotPen = new Pen(Color.Black, 1); borderDotPen.DashPattern = new float[] { 5, 5 }; borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; borderDotPen2.DashOffset = 5; shadowBrush = new SolidBrush(Color.FromArgb(75, Color.Black)); lightBrush = new SolidBrush(Color.FromArgb(10, Color.Black)); nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Arial", 12, FontStyle.Bold); Shown += new EventHandler(Surface_Shown); KeyUp += new KeyEventHandler(Surface_KeyUp); MouseDoubleClick += new MouseEventHandler(Surface_MouseDoubleClick); }
public RegionCapturePreview(SurfaceOptions surfaceConfig) { InitializeComponent(); screenshot = Screenshot.CaptureFullscreen(); SurfaceConfig = surfaceConfig; pgSurfaceConfig.SelectedObject = SurfaceConfig; }
public RegionCapturePreview(SurfaceOptions surfaceConfig) { InitializeComponent(); screenshot = Screenshot.CaptureFullscreen(); SurfaceConfig = surfaceConfig; cbDrawBorder.Checked = surfaceConfig.DrawBorder; cbDrawChecker.Checked = surfaceConfig.DrawChecker; cbIsFixedSize.Checked = surfaceConfig.IsFixedSize; nudFixedWidth.Value = surfaceConfig.FixedSize.Width; nudFixedHeight.Value = surfaceConfig.FixedSize.Height; cbQuickCrop.Checked = surfaceConfig.QuickCrop; }
public static Image GetRegionImage(Image surfaceImage, GraphicsPath regionFillPath, GraphicsPath regionDrawPath, SurfaceOptions options) { if (regionFillPath != null) { Image img; Rectangle regionArea = Rectangle.Round(regionFillPath.GetBounds()); Rectangle screenRectangle = CaptureHelpers.GetScreenBounds0Based(); Rectangle newRegionArea = Rectangle.Intersect(regionArea, screenRectangle); using (GraphicsPath gp = (GraphicsPath)regionFillPath.Clone()) { MoveGraphicsPath(gp, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = ImageHelpers.CropImage(surfaceImage, newRegionArea, gp); if (options.DrawBorder) { GraphicsPath gpOutline = regionDrawPath ?? regionFillPath; using (GraphicsPath gp2 = (GraphicsPath)gpOutline.Clone()) { MoveGraphicsPath(gp2, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = ImageHelpers.DrawOutline(img, gp2); } } } if (options.DrawChecker) { img = ImageHelpers.DrawCheckers(img); } return img; } return null; }
public static Image GetRegionImage(Image surfaceImage, GraphicsPath regionFillPath, GraphicsPath regionDrawPath, SurfaceOptions options) { if (regionFillPath != null) { Image img; Rectangle regionArea = Rectangle.Round(regionFillPath.GetBounds()); Rectangle screenRectangle = CaptureHelpers.GetScreenBounds0Based(); Rectangle newRegionArea = Rectangle.Intersect(regionArea, screenRectangle); using (GraphicsPath gp = (GraphicsPath)regionFillPath.Clone()) { MoveGraphicsPath(gp, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = ImageHelpers.CropImage(surfaceImage, newRegionArea, gp); if (options.DrawBorder) { GraphicsPath gpOutline = regionDrawPath ?? regionFillPath; using (GraphicsPath gp2 = (GraphicsPath)gpOutline.Clone()) { MoveGraphicsPath(gp2, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = ImageHelpers.DrawOutline(img, gp2); } } } if (options.DrawChecker) { img = ImageHelpers.DrawCheckers(img); } return(img); } return(null); }
public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null) { using (Image fullscreen = Screenshot.CaptureFullscreen()) using (RectangleRegion surface = new RectangleRegion(fullscreen)) { if (surfaceOptions != null) { surface.Config = new SurfaceOptions { MagnifierPixelCount = surfaceOptions.MagnifierPixelCount, MagnifierPixelSize = surfaceOptions.MagnifierPixelSize }; } surface.OneClickMode = true; surface.Prepare(); surface.ShowDialog(); if (surface.Result == SurfaceResult.Region) { PointInfo pointInfo = new PointInfo(); pointInfo.Position = CaptureHelpers.ClientToScreen(surface.OneClickPosition); pointInfo.Color = ((Bitmap)fullscreen).GetPixel(surface.OneClickPosition.X, surface.OneClickPosition.Y); return pointInfo; } } return null; }