summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Utilities
diff options
context:
space:
mode:
authorsr55 <[email protected]>2019-10-01 19:49:52 +0100
committersr55 <[email protected]>2019-10-01 19:50:27 +0100
commit124f0e52ca6d51acfa849b1f8679126bae9887d6 (patch)
tree350e286f8573008b4427bd9e82c4e5c1f83bf965 /win/CS/HandBrakeWPF/Utilities
parenteb6b180a446dc1cabcf19eef42debca18ef429b8 (diff)
WinGui: Optional support for previewing flip/rotate. #2334
Diffstat (limited to 'win/CS/HandBrakeWPF/Utilities')
-rw-r--r--win/CS/HandBrakeWPF/Utilities/BitmapHelpers.cs39
-rw-r--r--win/CS/HandBrakeWPF/Utilities/SystemInfo.cs1
2 files changed, 40 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Utilities/BitmapHelpers.cs b/win/CS/HandBrakeWPF/Utilities/BitmapHelpers.cs
new file mode 100644
index 000000000..f9856d2aa
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Utilities/BitmapHelpers.cs
@@ -0,0 +1,39 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DelayedActionProcessor.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// An Action processor that supports queueing/delayed action processing.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Utilities
+{
+ using System.Windows.Media;
+ using System.Windows.Media.Imaging;
+
+ public class BitmapHelpers
+ {
+ public static BitmapSource CreateTransformedBitmap(BitmapSource source, int rotation, bool flip)
+ {
+ if ((rotation == 0) && !flip)
+ {
+ return source;
+ }
+
+ TransformedBitmap transformedBitmap = new TransformedBitmap();
+ transformedBitmap.BeginInit();
+ transformedBitmap.Source = source;
+
+ var transformGroup = new TransformGroup();
+ transformGroup.Children.Add(new ScaleTransform(1, flip ? -1 : 1));
+ transformGroup.Children.Add(new RotateTransform(rotation));
+
+ transformedBitmap.Transform = transformGroup;
+ transformedBitmap.EndInit();
+ transformedBitmap.Freeze();
+
+ return (BitmapSource)transformedBitmap;
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs b/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
index ca32b7af4..be7c1827b 100644
--- a/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
+++ b/win/CS/HandBrakeWPF/Utilities/SystemInfo.cs
@@ -82,6 +82,7 @@ namespace HandBrakeWPF.Utilities
foreach (PropertyData pc in share.Properties)
{
+ Console.WriteLine(pc.Name + ": " + pc.Value);
if (!string.IsNullOrEmpty(pc.Name) && pc.Value != null)
{
if (pc.Name.Equals("DriverVersion")) version = pc.Value.ToString();