Skip to content

Commit 745ec28

Browse files
authored
Merge pull request #22 from lucidcode/rotate-flip
Add options to rotate and flip the video feed
2 parents b44173e + c54b2bd commit 745ec28

4 files changed

Lines changed: 117 additions & 67 deletions

File tree

Halovision/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.3.1.0")]
36-
[assembly: AssemblyFileVersion("1.3.1.0")]
35+
[assembly: AssemblyVersion("1.3.2.0")]
36+
[assembly: AssemblyFileVersion("1.3.2.0")]

Halovision/VisionForm.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
212212
pbDisplay.Image.Dispose();
213213
}
214214
videoBitmap = (Bitmap)eventArgs.Frame.Clone();
215+
if (cmbRotateFlip.Text != "RotateNoneFlipNone")
216+
{
217+
RotateFlipType rotateFlipType;
218+
if (Enum.TryParse(cmbRotateFlip.Text, out rotateFlipType))
219+
{
220+
videoBitmap.RotateFlip(rotateFlipType);
221+
}
222+
}
215223
pbDisplay.Image = videoBitmap;
216224
}));
217225
}
@@ -250,6 +258,7 @@ private void LoadSettings()
250258
defaultSettings += "<Classifier>None</Classifier>";
251259
defaultSettings += "<WaveForm>Triangle</WaveForm>";
252260
defaultSettings += "<Volume>0</Volume>";
261+
defaultSettings += "<RotateFlip>RotateNoneFlipNone</RotateFlip>";
253262
defaultSettings += "</Plugin>";
254263
defaultSettings += "</LucidScribeData>";
255264
File.WriteAllText(settingsFilePath, defaultSettings);
@@ -313,6 +322,15 @@ private void LoadSettings()
313322
cmbWaveForm.Text = "Triangle";
314323
}
315324

325+
if (xmlSettings.DocumentElement.SelectSingleNode("//RotateFlip") != null)
326+
{
327+
cmbRotateFlip.Text = xmlSettings.DocumentElement.SelectSingleNode("//RotateFlip").InnerText;
328+
}
329+
else
330+
{
331+
cmbRotateFlip.Text = "RotateFlip";
332+
}
333+
316334
if (xmlSettings.DocumentElement.SelectSingleNode("//TopMost") != null && xmlSettings.DocumentElement.SelectSingleNode("//TopMost").InnerText == "0")
317335
{
318336
chkTopMost.Checked = false;
@@ -396,6 +414,16 @@ private void LoadSettings()
396414
{
397415
chkAuralize.Checked = true;
398416
}
417+
418+
if (xmlSettings.DocumentElement.SelectSingleNode("//Width") != null)
419+
{
420+
this.Width = Convert.ToInt32(xmlSettings.DocumentElement.SelectSingleNode("//Width").InnerText);
421+
}
422+
423+
if (xmlSettings.DocumentElement.SelectSingleNode("//Height") != null)
424+
{
425+
this.Height = Convert.ToInt32(xmlSettings.DocumentElement.SelectSingleNode("//Height").InnerText);
426+
}
399427
}
400428

401429
private void cmbDevices_SelectedIndexChanged(object sender, EventArgs e)
@@ -962,6 +990,8 @@ private void SaveSettings()
962990
settings += "<EyeMoveMax>" + eyeMoveMaxInput.Value + "</EyeMoveMax>";
963991
settings += "<IdleTicks>" + idleTicksInput.Value + "</IdleTicks>";
964992
settings += "<Volume>" + VolumeTrackBar.Value + "</Volume>";
993+
settings += "<Width>" + this.Width + "</Width>";
994+
settings += "<Height>" + this.Height + "</Height>";
965995
settings += "<IgnorePercentage>" + cmbIgnorePercentage.Text + "</IgnorePercentage>";
966996

967997
if (chkCopyFromScreen.Checked)
@@ -984,6 +1014,7 @@ private void SaveSettings()
9841014

9851015
settings += "<Classifier>" + cmbClassifier.Text + "</Classifier>";
9861016
settings += "<WaveForm>" + cmbWaveForm.Text + "</WaveForm>";
1017+
settings += "<RotateFlip>" + cmbRotateFlip.Text + "</RotateFlip>";
9871018

9881019
if (chkTopMost.Checked)
9891020
{
@@ -1167,5 +1198,15 @@ private void VolumeTrackBar_Scroll(object sender, EventArgs e)
11671198
}
11681199
SaveSettings();
11691200
}
1201+
1202+
private void cmbRotateFlip_SelectedIndexChanged(object sender, EventArgs e)
1203+
{
1204+
SaveSettings();
1205+
}
1206+
1207+
private void VisionForm_ResizeEnd(object sender, EventArgs e)
1208+
{
1209+
SaveSettings();
1210+
}
11701211
}
11711212
}

0 commit comments

Comments
 (0)