This method retrieves the bit depths supported by the scan device.
Parameters
Name | Explanation |
---|---|
List | An array containing the bit depths supported by the
scan device In C++Builder, pass the number of elements - 1 into the List_Size |
Return Value
When the List parameter is set:
The GetBitDepth method's return value will indicate the number of bit depths supported for the specified PixelType set in the PixelType property. If 0 is returned this would indicate an error and you can confirm the type of error using the ErrorStatus property.
When the List is set to NULL
The GetBitDepth method's return value will indicate the number of elements that need to be used in the List array. However, some scan devices will return all supported bit depths regardless of the PixelType set in the PixelType property. In this case the return value of the GetBitDepth method will be larger than the actual supported number of bit depths.
Explanation
The GetBitDepth method retrieves the bit depths supported by the scan device. To execute this method the DataSourceName property, specifing the scan device, must be set or the scan device must be selected using the Select method. (Note: If the OpenDataSource method has been executed then the DataSourceName property is disabled and the opened scan device will be used).
The supported bit depth retrieved by the GetBitDepth method depends on the value set in the PixelType property. Therefore the PixelType property must also be set. The PixelType property determines the type of scan, either black and white, grayscale, palette color, or RGB color. So, for example, to find out whether your scanner supports 4 bit or 8 bit palette color, you would set the PixelType property to vikScanPixelPalette then execute the GetBitDepth method.
The GetBitDepth method takes the List parameter as arguments. The List is an array that will contain the supported bit depth returned by the GetBitDepth method.
If the GetBitDepth method executes successfully then the returned value will give the number of supported bit depth types for the specified PixelType. To use the example above where the PixelType property is set to vikScanPixelPalette), if the GetBitDepth method returns a value of 2 then we know that the scanner supports two types of bit depths when scanning in palette color. Then by checking the values returned in the List parameter array, we can confirm that these bit depths are actually supported if a 4 and an 8 are returned.
Depending on the scanner being used, it is possible that the range of bitcounts that can be used will differ according to the type of transfer mode used. Because of this, it is recommended that you set the TransferMode property before setting PixelType property.
Prior to executing the GetBitDepth method, you must execute the Initialize method.
If the OpenDataSource method is executed prior to the GetBitDepth method, then while the scan device is open, other applications can not use that scan device and it becomes the exclusive datasource for this execution.
The GetBitDepth method corresponds to the Scan Control's ScanGetBitDepth method in earlier versions of the ImageKit.
Sample Code:
In C++Builder
int Num;
short *List;
Num = VImageKit1->Scan->GetBitDepth(NULL, 0);
if (Num == 0) return;
List = new short[Num];
VImageKit1->Scan->GetBitDepth(List, Num - 1);
//Various processing code
delete[] List;
In Delphi
Num: Integer;
List: array of Smallint;
Num := VImageKit1.Scan.GetBitDepth(PSmallint(nil)^);
if Num = 0 then Exit;
SetLength(List, Num);
VImageKit1.Scan.GetBitDepth(List);
//Various processing code
Differences between the ImageKit7/8/9
When using Delphi, it is not necessary to pass in the number of elements of the List array