Added tiff support.

This commit is contained in:
soukoku
2015-02-18 21:06:07 -05:00
parent b27a9ba4cc
commit daaeb840af
10 changed files with 166 additions and 104 deletions

View File

@@ -7,11 +7,34 @@ using System.Text;
namespace NTwain.Interop
{
// this is a good read
// http://atlc.sourceforge.net/bmp.html
/// <summary>
/// Defines the dimensions and color information for a DIB.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
struct BITMAPINFO
{
/// <summary>
/// Structure that contains information about the dimensions of color format.
/// </summary>
public BITMAPINFOHEADER bmiHeader;
/// <summary>
/// This contains one of the following:
/// 1. An array of RGBQUAD. The elements of the array that make up the color table.
/// 2. An array of 16-bit unsigned integers that specifies indexes into the currently realized logical palette. This use of bmiColors is allowed for functions that use DIBs.
/// The number of entries in the array depends on the values of the biBitCount and biClrUsed members of the BITMAPINFOHEADER structure.
/// </summary>
public IntPtr bmiColors;
};
/// <summary>
/// Structure that contains information about the dimensions and color format of a DIB.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct BITMAPINFOHEADER
struct BITMAPINFOHEADER
{
#region fields
/// <summary>

View File

@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;
using System.Drawing;
namespace NTwain.Interop
{
// this is a good read
// http://atlc.sourceforge.net/bmp.html
/// <summary>
/// Defines the dimensions and color information for a DIB.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct BITMAPINFO
{
/// <summary>
/// Structure that contains information about the dimensions of color format.
/// </summary>
public BITMAPINFOHEADER bmiHeader;
/// <summary>
/// This contains one of the following:
/// 1. An array of RGBQUAD. The elements of the array that make up the color table.
/// 2. An array of 16-bit unsigned integers that specifies indexes into the currently realized logical palette. This use of bmiColors is allowed for functions that use DIBs.
/// The number of entries in the array depends on the values of the biBitCount and biClrUsed members of the BITMAPINFOHEADER structure.
/// </summary>
public IntPtr bmiColors;
};
}

35
NTwain/Interop/TIFF.cs Normal file
View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace NTwain.Interop
{
// this is from twain cs sample
// http://sourceforge.net/projects/twainforcsharp/?source=typ_redirect
/// <summary>
/// The TIFF file header.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TIFFHEADER
{
public ushort u8ByteOrder;
public ushort u16Version;
public uint u32OffsetFirstIFD;
public ushort u16u16IFD;
}
/// <summary>
/// An individual TIFF Tag.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TIFFTAG
{
public ushort u16Tag;
public ushort u16Type;
public uint u32Count;
public uint u32Value;
}
}