diff --git a/NAPS2.Sdk/Scan/BitDepthCaps.cs b/NAPS2.Sdk/Scan/BitDepthCaps.cs index e13066635d..bac91e853b 100644 --- a/NAPS2.Sdk/Scan/BitDepthCaps.cs +++ b/NAPS2.Sdk/Scan/BitDepthCaps.cs @@ -1,10 +1,22 @@ namespace NAPS2.Scan; +/// +/// Represents valid values for ScanOptions.BitDepth as part of PerSourceCaps. +/// public class BitDepthCaps { + /// + /// Whether the scanner supports BitDepth.Color. + /// public bool SupportsColor { get; init; } + /// + /// Whether the scanner supports BitDepth.Grayscale. + /// public bool SupportsGrayscale { get; init; } + /// + /// Whether the scanner supports BitDepth.BlackAndWhite. + /// public bool SupportsBlackAndWhite { get; init; } } \ No newline at end of file diff --git a/NAPS2.Sdk/Scan/DpiCaps.cs b/NAPS2.Sdk/Scan/DpiCaps.cs index 48bad12055..c877d198a9 100644 --- a/NAPS2.Sdk/Scan/DpiCaps.cs +++ b/NAPS2.Sdk/Scan/DpiCaps.cs @@ -2,10 +2,20 @@ namespace NAPS2.Scan; +/// +/// Represents valid values for ScanOptions.Dpi as part of PerSourceCaps. +/// public class DpiCaps { private static readonly int[] TargetCommonValues = [0, 100, 150, 200, 300, 400, 600, 800, 1200, 2400, 4800]; + /// + /// Creates an instance of DpiCaps that allows values in the specified range. + /// + /// The lowest valid DPI value, inclusive. + /// The highest valid DPI value, inclusive. + /// The increment between valid DPI values (must be >0). + /// public static DpiCaps ForRange(int min, int max, int step) { if (step <= 0) return new DpiCaps(); @@ -20,8 +30,14 @@ public static DpiCaps ForRange(int min, int max, int step) }; } + /// + /// Allowed values for ScanOptions.Dpi. + /// public ImmutableList? Values { get; init; } + /// + /// Recommended values for ScanOptions.Dpi to be presented to the user. + /// public ImmutableList? CommonValues { get diff --git a/NAPS2.Sdk/Scan/MetadataCaps.cs b/NAPS2.Sdk/Scan/MetadataCaps.cs index 252a121f60..c02f59f275 100644 --- a/NAPS2.Sdk/Scan/MetadataCaps.cs +++ b/NAPS2.Sdk/Scan/MetadataCaps.cs @@ -1,16 +1,37 @@ namespace NAPS2.Scan; +/// +/// Represents scanner metadata as part of ScanCaps. +/// public class MetadataCaps { + /// + /// For SANE, this is the backend name. + /// public string? DriverSubtype { get; init; } + /// + /// The device manufacturer. + /// public string? Manufacturer { get; init; } + /// + /// The device model name. + /// public string? Model { get; init; } + /// + /// The device serial number. + /// public string? SerialNumber { get; init; } + /// + /// The location note associated with the device. + /// public string? Location { get; init; } + /// + /// The URI for an icon associated with the device. + /// public string? IconUri { get; init; } } \ No newline at end of file diff --git a/NAPS2.Sdk/Scan/PageSizeCaps.cs b/NAPS2.Sdk/Scan/PageSizeCaps.cs index 838b1a9773..5b95777338 100644 --- a/NAPS2.Sdk/Scan/PageSizeCaps.cs +++ b/NAPS2.Sdk/Scan/PageSizeCaps.cs @@ -1,9 +1,18 @@ namespace NAPS2.Scan; +/// +/// Represents valid values for ScanOptions.PageSize as part of PerSourceCaps. +/// public class PageSizeCaps { + /// + /// Gets the size of the full scan area (i.e. maximum page size). + /// public PageSize? ScanArea { get; init; } + /// + /// Determines whether the provided page size fits within the full scan area (with 1% margin of error). + /// public bool Fits(PageSize pageSize) { if (ScanArea == null) diff --git a/NAPS2.Sdk/Scan/PaperSourceCaps.cs b/NAPS2.Sdk/Scan/PaperSourceCaps.cs index 2737a82a85..35acb28b47 100644 --- a/NAPS2.Sdk/Scan/PaperSourceCaps.cs +++ b/NAPS2.Sdk/Scan/PaperSourceCaps.cs @@ -1,12 +1,27 @@ namespace NAPS2.Scan; +/// +/// Represents valid values for ScanOptions.PaperSource as part of ScanCaps. +/// public class PaperSourceCaps { + /// + /// Whether the scanner supports PaperSource.Flatbed. + /// public bool SupportsFlatbed { get; init; } + /// + /// Whether the scanner supports PaperSource.Feeder. + /// public bool SupportsFeeder { get; init; } + /// + /// Whether the scanner supports PaperSource.Duplex. + /// public bool SupportsDuplex { get; init; } + /// + /// Whether the scanner has the ability to detect if paper is in the feeder for use with PaperSource.Auto. + /// public bool CanCheckIfFeederHasPaper { get; init; } } \ No newline at end of file diff --git a/NAPS2.Sdk/Scan/PerSourceCaps.cs b/NAPS2.Sdk/Scan/PerSourceCaps.cs index ec2344dae6..f98e4a7e43 100644 --- a/NAPS2.Sdk/Scan/PerSourceCaps.cs +++ b/NAPS2.Sdk/Scan/PerSourceCaps.cs @@ -2,8 +2,15 @@ namespace NAPS2.Scan; +/// +/// Represents capabilities specific to a single PaperSource as part of ScanCaps. +/// public class PerSourceCaps { + /// + /// Gets an object representing the union of all possible option values allowed by the provided objects. + /// This can be helpful when presenting the user with a single set of possible options for multiple sources. + /// public static PerSourceCaps UnionAll(ICollection caps) { DpiCaps? dpiCaps = null; @@ -45,9 +52,18 @@ public static PerSourceCaps UnionAll(ICollection caps) }; } + /// + /// Valid values for ScanOptions.Dpi. + /// public DpiCaps? DpiCaps { get; init; } + /// + /// Valid values for ScanOptions.BitDepth. + /// public BitDepthCaps? BitDepthCaps { get; init; } + /// + /// Valid values for ScanOptions.PageSize. + /// public PageSizeCaps? PageSizeCaps { get; init; } } \ No newline at end of file diff --git a/NAPS2.Sdk/Scan/ScanCaps.cs b/NAPS2.Sdk/Scan/ScanCaps.cs index 92fe6e5a65..5e5ab7c508 100644 --- a/NAPS2.Sdk/Scan/ScanCaps.cs +++ b/NAPS2.Sdk/Scan/ScanCaps.cs @@ -1,14 +1,33 @@ namespace NAPS2.Scan; +/// +/// Represents scanner capabilities. This includes valid values for scanning options and extra metadata beyond just the +/// device name and id. +/// public class ScanCaps { + /// + /// Metadata for the device. + /// public MetadataCaps? MetadataCaps { get; init; } + /// + /// Valid values for ScanOptions.PaperSource. + /// public PaperSourceCaps? PaperSourceCaps { get; init; } + /// + /// Capabilities specific to the Flatbed paper source. + /// public PerSourceCaps? FlatbedCaps { get; init; } + /// + /// Capabilities specific to the Feeder paper source. + /// public PerSourceCaps? FeederCaps { get; init; } + /// + /// Capabilities specific to the Duplex paper source. + /// public PerSourceCaps? DuplexCaps { get; init; } } \ No newline at end of file