fixed #736: Added option to support transparent region selection in screen recorder

This commit is contained in:
Jaex 2020-03-27 02:54:20 +03:00
parent 250f8a9872
commit f2a6e1f97c
6 changed files with 1755 additions and 1728 deletions

View file

@ -87,6 +87,22 @@ public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions o
return false;
}
public static bool GetRectangleRegionTransparent(out Rectangle rect)
{
using (RegionCaptureTransparentForm regionCaptureTransparentForm = new RegionCaptureTransparentForm())
{
if (regionCaptureTransparentForm.ShowDialog() == DialogResult.OK)
{
rect = regionCaptureTransparentForm.SelectionRectangle;
return true;
}
}
rect = Rectangle.Empty;
return false;
}
public static PointInfo GetPointInfo(RegionCaptureOptions options, Bitmap canvas = null)
{
RegionCaptureOptions newOptions = GetRegionCaptureOptions(options);

View file

@ -219,6 +219,7 @@ private void InitializeComponent()
this.txtUploaderFiltersExtensions = new System.Windows.Forms.TextBox();
this.tpActions = new System.Windows.Forms.TabPage();
this.pActions = new System.Windows.Forms.Panel();
this.lblActionsNote = new System.Windows.Forms.Label();
this.btnActionsDuplicate = new System.Windows.Forms.Button();
this.btnActionsAdd = new System.Windows.Forms.Button();
this.lvActions = new ShareX.HelpersLib.MyListView();
@ -247,7 +248,7 @@ private void InitializeComponent()
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
this.chkOverrideAdvancedSettings = new System.Windows.Forms.CheckBox();
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
this.lblActionsNote = new System.Windows.Forms.Label();
this.cbScreenRecordTransparentRegion = new System.Windows.Forms.CheckBox();
this.tcTaskSettings.SuspendLayout();
this.tpTask.SuspendLayout();
this.cmsDestinations.SuspendLayout();
@ -1405,6 +1406,7 @@ private void InitializeComponent()
// tpScreenRecorder
//
this.tpScreenRecorder.BackColor = System.Drawing.SystemColors.Window;
this.tpScreenRecorder.Controls.Add(this.cbScreenRecordTransparentRegion);
this.tpScreenRecorder.Controls.Add(this.cbScreenRecordTwoPassEncoding);
this.tpScreenRecorder.Controls.Add(this.cbScreenRecordConfirmAbort);
this.tpScreenRecorder.Controls.Add(this.cbScreenRecorderShowCursor);
@ -1905,6 +1907,11 @@ private void InitializeComponent()
resources.ApplyResources(this.pActions, "pActions");
this.pActions.Name = "pActions";
//
// lblActionsNote
//
resources.ApplyResources(this.lblActionsNote, "lblActionsNote");
this.lblActionsNote.Name = "lblActionsNote";
//
// btnActionsDuplicate
//
resources.ApplyResources(this.btnActionsDuplicate, "btnActionsDuplicate");
@ -2114,10 +2121,12 @@ private void InitializeComponent()
this.tttvMain.TreeViewSize = 190;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
//
// lblActionsNote
// cbScreenRecordTransparentRegion
//
resources.ApplyResources(this.lblActionsNote, "lblActionsNote");
this.lblActionsNote.Name = "lblActionsNote";
resources.ApplyResources(this.cbScreenRecordTransparentRegion, "cbScreenRecordTransparentRegion");
this.cbScreenRecordTransparentRegion.Name = "cbScreenRecordTransparentRegion";
this.cbScreenRecordTransparentRegion.UseVisualStyleBackColor = true;
this.cbScreenRecordTransparentRegion.CheckedChanged += new System.EventHandler(this.cbScreenRecordTransparentRegion_CheckedChanged);
//
// TaskSettingsForm
//
@ -2430,5 +2439,6 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown nudAutoIncrementNumber;
private System.Windows.Forms.Button btnAutoIncrementNumber;
private System.Windows.Forms.Label lblActionsNote;
private System.Windows.Forms.CheckBox cbScreenRecordTransparentRegion;
}
}

View file

@ -290,10 +290,11 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
cbScreenRecorderFixedDuration.Checked = nudScreenRecorderDuration.Enabled = TaskSettings.CaptureSettings.ScreenRecordFixedDuration;
nudScreenRecorderDuration.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordDuration);
chkScreenRecordAutoStart.Checked = nudScreenRecorderStartDelay.Enabled = TaskSettings.CaptureSettings.ScreenRecordAutoStart;
cbScreenRecordConfirmAbort.Checked = TaskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort;
nudScreenRecorderStartDelay.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordStartDelay);
cbScreenRecorderShowCursor.Checked = TaskSettings.CaptureSettings.ScreenRecordShowCursor;
cbScreenRecordTwoPassEncoding.Checked = TaskSettings.CaptureSettings.ScreenRecordTwoPassEncoding;
cbScreenRecordTransparentRegion.Checked = TaskSettings.CaptureSettings.ScreenRecordTransparentRegion;
cbScreenRecordConfirmAbort.Checked = TaskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort;
#endregion Screen recorder
@ -1105,6 +1106,11 @@ private void cbScreenRecordTwoPassEncoding_CheckedChanged(object sender, EventAr
TaskSettings.CaptureSettings.ScreenRecordTwoPassEncoding = cbScreenRecordTwoPassEncoding.Checked;
}
private void cbScreenRecordTransparentRegion_CheckedChanged(object sender, EventArgs e)
{
TaskSettings.CaptureSettings.ScreenRecordTransparentRegion = cbScreenRecordTransparentRegion.Checked;
}
private void cbScreenRecordConfirmAbort_CheckedChanged(object sender, EventArgs e)
{
TaskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort = cbScreenRecordConfirmAbort.Checked;

File diff suppressed because it is too large Load diff

View file

@ -115,7 +115,14 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
switch (startMethod)
{
case ScreenRecordStartMethod.Region:
RegionCaptureTasks.GetRectangleRegion(out captureRectangle, taskSettings.CaptureSettings.SurfaceOptions);
if (taskSettings.CaptureSettings.ScreenRecordTransparentRegion)
{
RegionCaptureTasks.GetRectangleRegionTransparent(out captureRectangle);
}
else
{
RegionCaptureTasks.GetRectangleRegion(out captureRectangle, taskSettings.CaptureSettings.SurfaceOptions);
}
break;
case ScreenRecordStartMethod.ActiveWindow:
if (taskSettings.CaptureSettings.CaptureClientArea)

View file

@ -349,6 +349,7 @@ public class TaskSettingsCapture
public float ScreenRecordDuration = 3f;
public bool ScreenRecordTwoPassEncoding = false;
public bool ScreenRecordAskConfirmationOnAbort = false;
public bool ScreenRecordTransparentRegion = false;
#endregion Capture / Screen recorder