The wiasDownSampleBuffer function takes in a buffer of DWORD-aligned pixel data and downsamples it (produces image data of lower resolution) to the specified size and resolution.
HRESULT wiasDownSampleBuffer( LONG lFlags, WIAS_DOWN_SAMPLE_INFO *pInfo );
Specifies a set of flags that determine the behavior of this function. Currently, only the following flag is defined.
|WIAS_GET_DOWNSAMPLED_SIZE_ONLY||Do not copy the downsampled data to the destination buffer. Instead, set the following members of the WIAS_DOWN_SAMPLE_INFO structure: ulDownSampledHeight, ulDownSampleWidth, ulAlignedHeight, ulAlignedWidth.|
Pointer to the WIAS_DOWN_SAMPLE_INFO structure that contains all of the information needed for the downsampling operation.
On success, the function returns S_OK. If the function fails, it returns a standard COM error or one of the WIA_ERROR_XXX errors (described in the Microsoft Windows SDK documentation).
The wiasDownSampleBuffer function can be used in either of the following two ways:
The caller specifies the downsampled (that is, output) width and height by setting the ulDownSampledWidth and ulDownSampledHeight members of the WIA_DOWN_SAMPLE_INFO structure.
The caller sets the ulDownSampledWidth and ulDownSampledHeight members of the WIA_DOWN_SAMPLE_INFO structure to zero, indicating that the function should choose the output width and height.
To see what output width and height values the function chooses, call this function with the lFlags parameter set to WIAS_GET_DOWNSAMPLED_SIZE_ONLY. On return, the ulDownSampledWidth and ulDownSampledHeight members are set to their new values. No downsampling is performed in this case.
Because this function is not able to produce partial output lines, the number of scan lines in the input buffer must be an integer multiple of the scaling factor. For example, suppose the input buffer contains an image sampled at 600 dpi, which you intend to downsample to an equivalent 50 dpi image. In this case, you are scaling down the original image by a factor of 12 (because 600 / 50 = 12). This means that the function must receive 12 input lines for each output line that it produces.
More generally, if the original image has a resolution of Rin dpi, and is to be scaled down to an image with a resolution of Rout dpi, the scale-down factor is Rin / Rout, and the number of lines in the input buffer should be a multiple of Rin / Rout. If the scan head reaches the last band of the original image, and there are too few scan lines in the input buffer to produce an output line, pad the input buffer so that it contains the required number of data lines. Failure to do so causes unpredictable results, and can even result in a driver crash.
|Windows version||Available in Microsoft Windows Me and in Windows XP and later versions of the Windows operating systems.|
|Header||wiamdef.h (include Wiamdef.h)|