| Herd Software Development
|=
DaVinci Graphics Library
|==
DaVinci Documentation Home Search Order


Leonardo: The StretchDIB2DIBBlt function

Copies a rectangular section of a source DIB into a destination DIB in much the same way as the Windows API function StretchDIBits, with the additional ability to resize the output during the copy. Windows provides StretchDIBits and StretchBlt as built-in resizing/mirroring functions for bitmaps, outputting the result onto an HDC. Large zoom factors, upward or downward, will cause these functions to fail in Windows 3.1.

BOOL FAR PASCAL StretchDIB2DIBBlt(
HDIB hdibDst,
int xDst,
int yDst,
int dxDst,
int dyDst,
HDIB hdibSrc,
int xSrc,
int ySrc,
int dxSrc,
int dySrc)

hdibDst Handle of the target DIB at 1, 4, 8, 16, 24, 32 or 48 bit color depth.

xDst, yDst Lower left xy coordinates of the bounding rectangle in the target DIB

dxDst, dyDst Width and height of the bounding rectangle of the target DIB

hdibSrc Handle of the source DIB at 1, 4, 8, 16, 24 or 32 bit color depth.

The handle of the source DIB remains valid after this operation.

xDst, yDst Lower left xy coordinate of the bounding rectangle in the source DIB

dxDst, dyDst Width and height of the rectangular area to be copied from the source DIB

Returns

Returns non-0 if successful.

Remarks

This function is based on Leonardo's TransformDIB function. TransformDIB offers more flexibility and permits the use of callback procedures for such things as progress bars.

Memory requirements

StretchDIB2DIBBLT requires little memory for its own purposes. Memory requirements for the function are determined primarily by the sizes of the input and output DIBs.

DIBs at 1 bit color depth can be processed directly so that main memory requirements are low. Approximately 500KB of memory is required for the two DIBs needed in the rotation of a full-page monochrome fax document image.

Computation speed

The speed of this function is almost exclusively determined by the size of the destination rectange defined by dxDst and dyDst. The output of a large image in a small window can therefore be done quite rapidly.

Remarks

DIB downscaling operations performed using ScaleToGray will often result in higher output quality.

this function may be used to copy image data in CMYK color space. Both source and destination DIB can be RGB or CMYK color space in any combination. If source and destination DIBs are both in CMYK color space, no conversion to RGB is applied and there is no loss in image quality.

Optimization

DaVinci Professional contains optimized routines for enhanced performance in the following special cases: