mirror of
https://github.com/soukoku/ntwain.git
synced 2025-12-01 10:54:08 +08:00
Initial move from old twain-in-dotnet.
This commit is contained in:
44
NTwain/Triplets/DGImage/DGImage.CieColor.cs
Normal file
44
NTwain/Triplets/DGImage/DGImage.CieColor.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class CieColor : OpBase
|
||||
{
|
||||
internal CieColor(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to report the currently active parameters to be used in
|
||||
/// converting acquired color data into CIE XYZ.
|
||||
/// </summary>
|
||||
/// <param name="cieColor">Color data.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(out TWCieColor cieColor)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.CieColor, Message.Get);
|
||||
cieColor = new TWCieColor();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, cieColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
37
NTwain/Triplets/DGImage/DGImage.ExtImageInfo.cs
Normal file
37
NTwain/Triplets/DGImage/DGImage.ExtImageInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ExtImageInfo : OpBase
|
||||
{
|
||||
internal ExtImageInfo(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(TWExtImageInfo info)
|
||||
{
|
||||
Session.VerifyState(7, 7, DataGroups.Image, DataArgumentType.ExtImageInfo, Message.Get);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
NTwain/Triplets/DGImage/DGImage.GrayResponse.cs
Normal file
56
NTwain/Triplets/DGImage/DGImage.GrayResponse.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class GrayResponse : OpBase
|
||||
{
|
||||
internal GrayResponse(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// The Reset operation causes the Source to use its "identity response curve." The identity
|
||||
/// curve causes no change in the values of the captured data when it is applied.
|
||||
/// </summary>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Reset(out TWGrayResponse response)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.GrayResponse, Message.Reset);
|
||||
response = new TWGrayResponse();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to transform any grayscale data according to the response
|
||||
/// curve specified.
|
||||
/// </summary>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Set(TWGrayResponse response)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.GrayResponse, Message.Set);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
NTwain/Triplets/DGImage/DGImage.IccProfile.cs
Normal file
44
NTwain/Triplets/DGImage/DGImage.IccProfile.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class IccProfile : OpBase
|
||||
{
|
||||
internal IccProfile(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation provides the application with the ICC profile associated with the image which is
|
||||
/// about to be transferred (state 6) or is being transferred (state 7).
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(ref TWMemory profile)
|
||||
{
|
||||
Session.VerifyState(6, 7, DataGroups.Image, DataArgumentType.IccProfile, Message.Get);
|
||||
profile = new TWMemory();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataArgumentType.IccProfile, Message.Get, ref profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
NTwain/Triplets/DGImage/DGImage.ImageFileXfer.cs
Normal file
43
NTwain/Triplets/DGImage/DGImage.ImageFileXfer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageFileXfer : OpBase
|
||||
{
|
||||
internal ImageFileXfer(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation is used to initiate the transfer of an image from the Source to the application via
|
||||
/// the disk-file transfer mechanism. It causes the transfer to begin.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get()
|
||||
{
|
||||
Session.VerifyState(6, 6, DataGroups.Image, DataArgumentType.ImageFileXfer, Message.Get);
|
||||
IntPtr z = IntPtr.Zero;
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataGroups.Image, DataArgumentType.ImageFileXfer, Message.Get, ref z);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
NTwain/Triplets/DGImage/DGImage.ImageInfo.cs
Normal file
38
NTwain/Triplets/DGImage/DGImage.ImageInfo.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ImageInfo : OpBase
|
||||
{
|
||||
internal ImageInfo(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(out TWImageInfo info)
|
||||
{
|
||||
Session.VerifyState(6, 7, DataGroups.Image, DataArgumentType.ImageInfo, Message.Get);
|
||||
info = new TWImageInfo();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
NTwain/Triplets/DGImage/DGImage.ImageLayout.cs
Normal file
58
NTwain/Triplets/DGImage/DGImage.ImageLayout.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class ImageLayout : OpBase
|
||||
{
|
||||
internal ImageLayout(TwainSession session) : base(session) { }
|
||||
|
||||
public ReturnCode Get(out TWImageLayout layout)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.ImageLayout, Message.Get);
|
||||
layout = new TWImageLayout();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, layout);
|
||||
}
|
||||
|
||||
public ReturnCode GetDefault(out TWImageLayout layout)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.ImageLayout, Message.GetDefault);
|
||||
layout = new TWImageLayout();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.GetDefault, layout);
|
||||
}
|
||||
|
||||
public ReturnCode Reset(out TWImageLayout layout)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.ImageLayout, Message.Reset);
|
||||
layout = new TWImageLayout();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, layout);
|
||||
}
|
||||
|
||||
public ReturnCode Set(TWImageLayout layout)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.ImageLayout, Message.Set);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
NTwain/Triplets/DGImage/DGImage.ImageMemFileXfer.cs
Normal file
44
NTwain/Triplets/DGImage/DGImage.ImageMemFileXfer.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageMemFileXfer : OpBase
|
||||
{
|
||||
internal ImageMemFileXfer(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation is used to initiate the transfer of an image from the Source to the application via
|
||||
/// the Memory-File transfer mechanism.
|
||||
/// </summary>
|
||||
/// <param name="xfer">The xfer.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(TWImageMemXfer xfer)
|
||||
{
|
||||
Session.VerifyState(6, 6, DataGroups.Image, DataArgumentType.ImageMemFileXfer, Message.Get);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, xfer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
43
NTwain/Triplets/DGImage/DGImage.ImageMemXfer.cs
Normal file
43
NTwain/Triplets/DGImage/DGImage.ImageMemXfer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageMemXfer : OpBase
|
||||
{
|
||||
internal ImageMemXfer(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation is used to initiate the transfer of an image from the Source to the application via
|
||||
/// the Buffered Memory transfer mechanism.
|
||||
/// </summary>
|
||||
/// <param name="xfer">The xfer.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(TWImageMemXfer xfer)
|
||||
{
|
||||
Session.VerifyState(6, 7, DataGroups.Image, DataArgumentType.ImageMemXfer, Message.Get);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, xfer);
|
||||
}
|
||||
}
|
||||
}
|
||||
46
NTwain/Triplets/DGImage/DGImage.ImageNativeXfer.cs
Normal file
46
NTwain/Triplets/DGImage/DGImage.ImageNativeXfer.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
sealed class ImageNativeXfer : OpBase
|
||||
{
|
||||
internal ImageNativeXfer(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// Causes the transfer of an image’s data from the Source to the application, via the Native transfer
|
||||
/// mechanism, to begin. The resulting data is stored in main memory in a single block. The data is
|
||||
/// stored in Picture (PICT) format on the Macintosh and as a device-independent bitmap (DIB)
|
||||
/// under Microsoft Windows. The size of the image that can be transferred is limited to the size of
|
||||
/// the memory block that can be allocated by the Source.
|
||||
/// </summary>
|
||||
/// <param name="handle">The handle.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(ref IntPtr handle)
|
||||
{
|
||||
Session.VerifyState(6, 6, DataGroups.Image, DataArgumentType.ImageNativeXfer, Message.Get);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataGroups.Image, DataArgumentType.ImageNativeXfer, Message.Get, ref handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
82
NTwain/Triplets/DGImage/DGImage.JpegCompression.cs
Normal file
82
NTwain/Triplets/DGImage/DGImage.JpegCompression.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class JpegCompression : OpBase
|
||||
{
|
||||
internal JpegCompression(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// Causes the Source to return the parameters that will be used during the compression of data
|
||||
/// using the JPEG algorithms.
|
||||
/// </summary>
|
||||
/// <param name="compression">The compression.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(out TWJpegCompression compression)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.JpegCompression, Message.Get);
|
||||
compression = new TWJpegCompression();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, compression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Causes the Source to return the power-on default values applied to JPEG-compressed data
|
||||
/// transfers.
|
||||
/// </summary>
|
||||
/// <param name="compression">The compression.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetDefault(out TWJpegCompression compression)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.JpegCompression, Message.GetDefault);
|
||||
compression = new TWJpegCompression();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.GetDefault, compression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the Source to using its power-on default values for JPEG-compressed transfers.
|
||||
/// </summary>
|
||||
/// <param name="compression">The compression.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Reset(out TWJpegCompression compression)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.JpegCompression, Message.Reset);
|
||||
compression = new TWJpegCompression();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, compression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows the application to configure the compression parameters to be used on all future JPEGcompressed
|
||||
/// transfers during the current session. The application should have already
|
||||
/// established that the requested values are supported by the Source.
|
||||
/// </summary>
|
||||
/// <param name="compression">The compression.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Set(TWJpegCompression compression)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.JpegCompression, Message.Set);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, compression);
|
||||
}
|
||||
}
|
||||
}
|
||||
82
NTwain/Triplets/DGImage/DGImage.Palette8.cs
Normal file
82
NTwain/Triplets/DGImage/DGImage.Palette8.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class Palette8 : OpBase
|
||||
{
|
||||
internal Palette8(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to report its current palette information.
|
||||
/// </summary>
|
||||
/// <param name="palette">The palette.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Get(out TWPalette8 palette)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Palette8, Message.Get);
|
||||
palette = new TWPalette8();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, palette);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to report its power-on default palette.
|
||||
/// </summary>
|
||||
/// <param name="palette">The palette.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetDefault(out TWPalette8 palette)
|
||||
{
|
||||
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Palette8, Message.GetDefault);
|
||||
palette = new TWPalette8();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.GetDefault, palette);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation causes the Source to dispose of any current palette it has and to use its default
|
||||
/// palette for the next palette transfer.
|
||||
/// </summary>
|
||||
/// <param name="palette">The palette.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Reset(out TWPalette8 palette)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Palette8, Message.Reset);
|
||||
palette = new TWPalette8();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, palette);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This operation requests that the Source adopt the specified palette for use with all subsequent
|
||||
/// palette transfers. The application should be careful to supply a palette that matches the bit
|
||||
/// depth of the Source. The Source is not required to adopt this palette. The application should be
|
||||
/// careful to check the return value from this operation.
|
||||
/// </summary>
|
||||
/// <param name="palette">The palette.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Set(TWPalette8 palette)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Palette8, Message.Set);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, palette);
|
||||
}
|
||||
}
|
||||
}
|
||||
57
NTwain/Triplets/DGImage/DGImage.RgbResponse.cs
Normal file
57
NTwain/Triplets/DGImage/DGImage.RgbResponse.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System;
|
||||
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
public sealed class RgbResponse : OpBase
|
||||
{
|
||||
internal RgbResponse(TwainSession session) : base(session) { }
|
||||
|
||||
/// <summary>
|
||||
/// Causes the Source to use its "identity" response curves for future RGB transfers. The identity
|
||||
/// curve causes no change in the values of the captured data when it is applied. (Note that
|
||||
/// resetting the curves for RGB data does not reset any curves for other pixel types).
|
||||
/// </summary>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Reset(out TWRgbResponse response)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.RgbResponse, Message.Reset);
|
||||
response = new TWRgbResponse();
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Causes the Source to transform any RGB data according to the response curves specified by the
|
||||
/// application.
|
||||
/// </summary>
|
||||
/// <param name="response">The response.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode Set(TWRgbResponse response)
|
||||
{
|
||||
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.RgbResponse, Message.Set);
|
||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
171
NTwain/Triplets/DGImage/DGImage.cs
Normal file
171
NTwain/Triplets/DGImage/DGImage.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
// The MIT License (MIT)
|
||||
// Copyright (c) 2013 Yin-Chun Wang
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
namespace NTwain.Triplets
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for grouping triplet operations under the Image data group.
|
||||
/// </summary>
|
||||
public sealed class DGImage
|
||||
{
|
||||
TwainSession _session;
|
||||
internal DGImage(TwainSession session)
|
||||
{
|
||||
if (session == null) { throw new ArgumentNullException("session"); }
|
||||
_session = session;
|
||||
}
|
||||
|
||||
CieColor _cieColor;
|
||||
public CieColor CieColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cieColor == null) { _cieColor = new CieColor(_session); }
|
||||
return _cieColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ExtImageInfo _extImgInfo;
|
||||
public ExtImageInfo ExtImageInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_extImgInfo == null) { _extImgInfo = new ExtImageInfo(_session); }
|
||||
return _extImgInfo;
|
||||
}
|
||||
}
|
||||
|
||||
GrayResponse _grayResponse;
|
||||
public GrayResponse GrayResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_grayResponse == null) { _grayResponse = new GrayResponse(_session); }
|
||||
return _grayResponse;
|
||||
}
|
||||
}
|
||||
|
||||
IccProfile _iccProfile;
|
||||
public IccProfile IccProfile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_iccProfile == null) { _iccProfile = new IccProfile(_session); }
|
||||
return _iccProfile;
|
||||
}
|
||||
}
|
||||
|
||||
ImageFileXfer _imgFileXfer;
|
||||
internal ImageFileXfer ImageFileXfer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgFileXfer == null) { _imgFileXfer = new ImageFileXfer(_session); }
|
||||
return _imgFileXfer;
|
||||
}
|
||||
}
|
||||
|
||||
ImageInfo _imgInfo;
|
||||
public ImageInfo ImageInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgInfo == null) { _imgInfo = new ImageInfo(_session); }
|
||||
return _imgInfo;
|
||||
}
|
||||
}
|
||||
|
||||
ImageLayout _imgLayout;
|
||||
public ImageLayout ImageLayout
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgLayout == null) { _imgLayout = new ImageLayout(_session); }
|
||||
return _imgLayout;
|
||||
}
|
||||
}
|
||||
|
||||
ImageMemFileXfer _imgMemFileXfer;
|
||||
internal ImageMemFileXfer ImageMemFileXfer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgMemFileXfer == null) { _imgMemFileXfer = new ImageMemFileXfer(_session); }
|
||||
return _imgMemFileXfer;
|
||||
}
|
||||
}
|
||||
|
||||
ImageMemXfer _imgMemXfer;
|
||||
internal ImageMemXfer ImageMemXfer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgMemXfer == null) { _imgMemXfer = new ImageMemXfer(_session); }
|
||||
return _imgMemXfer;
|
||||
}
|
||||
}
|
||||
|
||||
ImageNativeXfer _imgNativeXfer;
|
||||
internal ImageNativeXfer ImageNativeXfer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_imgNativeXfer == null) { _imgNativeXfer = new ImageNativeXfer(_session); }
|
||||
return _imgNativeXfer;
|
||||
}
|
||||
}
|
||||
|
||||
JpegCompression _jpegComp;
|
||||
public JpegCompression JpegCompression
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_jpegComp == null) { _jpegComp = new JpegCompression(_session); }
|
||||
return _jpegComp;
|
||||
}
|
||||
}
|
||||
|
||||
Palette8 _palette8;
|
||||
public Palette8 Palette8
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_palette8 == null) { _palette8 = new Palette8(_session); }
|
||||
return _palette8;
|
||||
}
|
||||
}
|
||||
|
||||
RgbResponse _rgbResp;
|
||||
public RgbResponse RgbResponse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_rgbResp == null) { _rgbResp = new RgbResponse(_session); }
|
||||
return _rgbResp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user