Quantcast
Channel: Saraff.Twain.NET
Viewing all articles
Browse latest Browse all 419

Updated Wiki: Strongly typed accessing to a capabilities

$
0
0

Strongly typed accessing to a capabilities

The Saraff.Twain.NET support strongly typed accessing to a capabilities that specified in a TWAIN 2.3 Specification.
Follow two interfaces provide accessing to a capabilities.

publicinterface ICapability<T> {
    Twain32.Enumeration Get();
    T GetCurrent();
    T GetDefault();
    void Set(T value);
    void SetConstraint(T value);
    void SetConstraint(params T[] value);
    void SetConstraint(Twain32.Range value);
    void SetConstraint(Twain32.Enumeration value);
    void Reset();
    TwQC IsSupported();
    bool IsSupported(TwQC operation);
}

publicinterface ICapability2<T> {
    Twain32.Enumeration Get();
    object[] GetCurrentArray();
    object[] GetDefaultArray();
    void Set(T value);
    void Set(params T[] value);
    void SetConstraint(T value);
    void SetConstraint(params T[] value);
    void SetConstraint(Twain32.Range value);
    void SetConstraint(Twain32.Enumeration value);
    void Reset();
    TwQC IsSupported();
    bool IsSupported(TwQC operation);
}

Below shown samples of using some capabilities.

//Brightnessif((this._twain32.Capabilities.Brightness.IsSupported(TwQC.Set))!=0) {
    this._twain32.Capabilities.Brightness.Set(100f); //Allowed Values: -1000f to +1000f; Default Value: 0f;
}

//Contrastif((this._twain32.Capabilities.Contrast.IsSupported(TwQC.Set))!=0) {
    this._twain32.Capabilities.Contrast.Set(-200f); //Allowed Values: -1000f to +1000f; Default Value: 0f;
}

//Feeder & Duplexif((this._twain32.Capabilities.Duplex.IsSupported(TwQC.GetCurrent))!=0) {
    if(this._twain32.Capabilities.Duplex.GetCurrent()!=TwDX.None) {
        if((this._twain32.Capabilities.FeederEnabled.IsSupported(TwQC.Set))!=0) {
            this._twain32.Capabilities.FeederEnabled.Set(true);

            if((this._twain32.Capabilities.DuplexEnabled.IsSupported(TwQC.Set))!=0) {
                this._twain32.Capabilities.DuplexEnabled.Set(true);
            }
            this._twain32.Capabilities.XferCount.Set(-1);
        }
    }
}


Viewing all articles
Browse latest Browse all 419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>