Update image parse code.

This commit is contained in:
soukoku
2015-02-19 22:30:13 -05:00
parent eef0b9db92
commit 9ba2b0d0e0
10 changed files with 284 additions and 182 deletions

View File

@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Permissions;
@@ -140,26 +141,28 @@ namespace NTwain
/// <summary>
/// Gets the bitmap from the <see cref="NativeData"/> if it's an image.
/// Gets the image stream from the <see cref="NativeData"/> if it's an image.
/// </summary>
/// <returns></returns>
public Image GetNativeImage()
public Stream GetNativeImageStream()
{
Image image = null;
Stream retVal = null;
if (NativeData != IntPtr.Zero)
{
if (ImageTools.IsDib(NativeData))
{
image = ImageTools.ReadBitmapImage(NativeData);
retVal = ImageTools.GetBitmapStream(NativeData);
}
else if (ImageTools.IsTiff(NativeData))
{
image = ImageTools.ReadTiffImage(NativeData);
retVal = ImageTools.GetTiffStream(NativeData);
}
}
return image;
return retVal; ;
}
}
}