summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-01-29 17:19:16 +0000
committerScott <[email protected]>2017-02-03 20:39:34 +0000
commit769725ffcdc1c7950aed604aec6807b20bbe796e (patch)
treef8ce8392670e673992385d4d2428c3c3aa34c3f7 /win/CS/HandBrake.ApplicationServices
parent6aa1b40aead1653b39c93195aed4e920b6b0fcc9 (diff)
WinGui: Remove System.Windows.Forms, PresentationCore, PresentationFramework and WindowsBase from the Services library. This makes the library more portable.
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs27
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs4
3 files changed, 5 insertions, 30 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 14ba10545..0fd5b5260 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -56,8 +56,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\json\Newtonsoft.Json.dll</HintPath>
</Reference>
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core">
@@ -67,7 +65,6 @@
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
- <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -77,7 +74,6 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\ShortName.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index c39ad1534..f803887d1 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -19,7 +19,6 @@ namespace HandBrake.ApplicationServices.Interop
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Timers;
- using System.Windows.Media.Imaging;
using HandBrake.ApplicationServices.Interop.EventArgs;
using HandBrake.ApplicationServices.Interop.Factories;
@@ -269,7 +268,7 @@ namespace HandBrake.ApplicationServices.Interop
/// An image with the requested preview.
/// </returns>
[HandleProcessCorruptedStateExceptions]
- public BitmapImage GetPreview(PreviewSettings settings, int previewNumber)
+ public Bitmap GetPreview(PreviewSettings settings, int previewNumber)
{
SourceTitle title = this.Titles.TitleList.FirstOrDefault(t => t.Index == settings.TitleNumber);
@@ -338,29 +337,9 @@ namespace HandBrake.ApplicationServices.Interop
IntPtr nativeJobPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
Marshal.WriteIntPtr(nativeJobPtrPtr, resultingImageStuct);
HBFunctions.hb_image_close(nativeJobPtrPtr);
- Marshal.FreeHGlobal(nativeJobPtrPtr);
+ Marshal.FreeHGlobal(nativeJobPtrPtr);
- // Create a Bitmap Image for display.
- using (var memoryStream = new MemoryStream())
- {
- try
- {
- bitmap.Save(memoryStream, ImageFormat.Bmp);
- }
- finally
- {
- bitmap.Dispose();
- }
-
- var wpfBitmap = new BitmapImage();
- wpfBitmap.BeginInit();
- wpfBitmap.CacheOption = BitmapCacheOption.OnLoad;
- wpfBitmap.StreamSource = memoryStream;
- wpfBitmap.EndInit();
- wpfBitmap.Freeze();
-
- return wpfBitmap;
- }
+ return bitmap;
}
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
index 3e756d228..910621d81 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
@@ -10,7 +10,7 @@
namespace HandBrake.ApplicationServices.Interop.Interfaces
{
using System;
- using System.Windows.Media.Imaging;
+ using System.Drawing;
using HandBrake.ApplicationServices.Interop.EventArgs;
using HandBrake.ApplicationServices.Interop.Json.Encode;
@@ -100,7 +100,7 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces
/// <returns>
/// An image with the requested preview.
/// </returns>
- BitmapImage GetPreview(PreviewSettings job, int previewNumber);
+ Bitmap GetPreview(PreviewSettings job, int previewNumber);
/// <summary>
/// Pauses the current encode.