Example #1
0
        public static int GetWiaFlagPropertyValueString(WiaPropertyId propertyId, Int32 value)
        {
            int foundCount = 0;

            MainForm._flagValuesStrings.Clear();

            foreach (WiaPropertyValuesInfo i in _wiaPropertyValuesInfo)
            {
                if (i.PropertyId == propertyId)
                {
                    foreach (WiaPropertyValues j in i.Values)
                    {
                        if ((value & j.ValueId) == j.ValueId)
                        {
                            MainForm._flagValuesStrings.Add(j.ValueNameString);
                            foundCount++;
                        }
                    }

                    if (foundCount > 0)
                    {
                        return(1);
                    }
                }
            }

            return(0);
        }
Example #2
0
        public static int GetWiaListPropertyValueString(WiaPropertyId propertyId, int value)
        {
            bool found = false;

            foreach (WiaPropertyValuesInfo i in _wiaPropertyValuesInfo)
            {
                if (i.PropertyId == propertyId)
                {
                    foreach (WiaPropertyValues j in i.Values)
                    {
                        if (j.ValueId == value)
                        {
                            _listPropertyValueString = j.ValueNameString;
                            found = true;
                            break;
                        }
                    }

                    if (found == true)
                    {
                        return(1);
                    }
                }
            }
            return(0);
        }
Example #3
0
 public static void FindRelevantPropName(WiaPropertyId propertyId, object value)
 {
     if (propertyId == WiaPropertyId.ScannerDeviceDocumentHandlingSelect)
     {
         UInt32 val = Convert.ToUInt32(value);
         if ((val & (int)WiaScanningModeFlags.Feeder) == (int)WiaScanningModeFlags.Feeder ||
             (val & (int)WiaScanningModeFlags.Flatbed) == (int)WiaScanningModeFlags.Flatbed)
         {
             _propertyName = "Paper Source";
         }
     }
     else
     {
         _propertyName = WiaSession.GetPropertyIdString(propertyId);
     }
 }
Example #4
0
        public static void FindRelevantPropValue(WiaPropertyId propertyId, object value)
        {
            UInt32 val = Convert.ToUInt32(value);

            switch (propertyId)
            {
            case WiaPropertyId.ScannerDevicePages:
            case WiaPropertyId.ItemDepth:
            case WiaPropertyId.ScannerItemXExtent:
            case WiaPropertyId.ScannerItemYExtent:
            case WiaPropertyId.ScannerItemXRes:
            case WiaPropertyId.ScannerItemYRes:
            case WiaPropertyId.ScannerItemXPos:
            case WiaPropertyId.ScannerItemYPos:
            case WiaPropertyId.ScannerItemXScaling:
            case WiaPropertyId.ScannerItemYScaling:
            case WiaPropertyId.ScannerItemBrightness:
            case WiaPropertyId.ScannerItemContrast:
                _propertyValueString = val.ToString();
                break;

            case WiaPropertyId.ScannerDeviceOrientation:
            case WiaPropertyId.ScannerItemRotation:
                switch (val)
                {
                case (int)WiaOrientation.Landscape:
                    _propertyValueString = "Landscape";
                    break;

                case (int)WiaOrientation.Portrait:
                    _propertyValueString = "Portrait";
                    break;

                case (int)WiaOrientation.Rotate180:
                    _propertyValueString = "Rotate 180";
                    break;

                case (int)WiaOrientation.Rotate270:
                    _propertyValueString = "Rotate 270";
                    break;
                }
                break;

            case WiaPropertyId.ScannerDeviceDocumentHandlingSelect:
                switch (val)
                {
                case (int)WiaScanningModeFlags.Feeder:
                    _propertyValueString = "Feeder";
                    break;

                case (int)WiaScanningModeFlags.Flatbed:
                    _propertyValueString = "Flatbed";
                    break;

                case (int)WiaScanningModeFlags.Duplex:
                    _propertyValueString = "Duplex";
                    break;

                case (int)WiaScanningModeFlags.AutoAdvance:
                    _propertyValueString = "Auto Advance";
                    break;

                case (int)WiaScanningModeFlags.FrontFirst:
                    _propertyValueString = "Front First";
                    break;

                case (int)WiaScanningModeFlags.BackFirst:
                    _propertyValueString = "Back First";
                    break;

                case (int)WiaScanningModeFlags.FrontOnly:
                    _propertyValueString = "Front Only";
                    break;

                case (int)WiaScanningModeFlags.BackOnly:
                    _propertyValueString = "Back Only";
                    break;

                case (int)WiaScanningModeFlags.NextPage:
                    _propertyValueString = "Next Page";
                    break;

                case (int)WiaScanningModeFlags.Prefeed:
                    _propertyValueString = "Pre-feed";
                    break;
                }
                break;

            case WiaPropertyId.ScannerItemCurIntent:
                // Check the Image Type check boxes according to the retrieved Image type flags.
                if (val == (int)WiaImageType.Color)
                {
                    _propertyValueString = "Color";
                }
                else if (val == (int)WiaImageType.Grayscale)
                {
                    _propertyValueString = "Grayscale";
                }
                else
                {
                    _propertyValueString = "Text";
                }
                break;

            case WiaPropertyId.ItemCompression:
                switch (val)
                {
                case (int)WiaCompressionMode.None:
                    _propertyValueString = "None";
                    break;

                case (int)WiaCompressionMode.Rle4:
                    _propertyValueString = "RLE4 Compression";
                    break;

                case (int)WiaCompressionMode.Rle8:
                    _propertyValueString = "RLE8 Compression";
                    break;

                case (int)WiaCompressionMode.Group3:
                    _propertyValueString = "Group 3 Compression";
                    break;

                case (int)WiaCompressionMode.Group4:
                    _propertyValueString = "Group 4 Compression";
                    break;

                case (int)WiaCompressionMode.Jpeg:
                    _propertyValueString = "JPEG Compression";
                    break;

                case (int)WiaCompressionMode.Jbig:
                    _propertyValueString = "JBIG compression";
                    break;

                case (int)WiaCompressionMode.Jpeg2000:
                    _propertyValueString = "JPEG 2000 compression";
                    break;

                case (int)WiaCompressionMode.Png:
                    _propertyValueString = "PNG compression";
                    break;
                }
                break;

            case WiaPropertyId.ItemTymed:
                switch (val)
                {
                case (int)WiaTransferMode.Memory:
                    _propertyValueString = "Memory Transfer";
                    break;

                case (int)WiaTransferMode.File:
                    _propertyValueString = "File Transfer";
                    break;
                }
                break;

            case WiaPropertyId.ItemDatatype:
                switch (val)
                {
                case (int)WiaImageDataType.Threshold:
                    _propertyValueString = "Threshold";
                    break;

                case (int)WiaImageDataType.Dither:
                    _propertyValueString = "Dither";
                    break;

                case (int)WiaImageDataType.Grayscale:
                    _propertyValueString = "Grayscale";
                    break;

                case (int)WiaImageDataType.Color:
                    _propertyValueString = "Color";
                    break;

                case (int)WiaImageDataType.ColorThreshold:
                    _propertyValueString = "Color Threshold";
                    break;

                case (int)WiaImageDataType.ColorDither:
                    _propertyValueString = "Color Dither";
                    break;
                }
                break;

            case WiaPropertyId.ItemFormat:
                System.Guid guidFormat = (System.Guid)value;
                GetFormatNameString(guidFormat);
                _propertyValueString = FormatName;
                break;
            }
        }
Example #5
0
 public WiaPropertyValuesInfo(WiaPropertyId propertyId, WiaPropertyValues[] propertyValues)
 {
     _propertyId     = propertyId;
     _propertyValues = propertyValues;
 }