TBarCode Library 11  TBarCode Library 11
ERRCODE _stdcall BCGetOptimalBitmapSize ( t_BarCode pBarCode,
LPRECT  pRect,
LONG  nScaleX,
LONG  nScaleY 

Returns the optimal size of a bitmap for given bar code settings.

The optimal bitmap size depends on the number of horizontal bar/space modules and also on the number of vertical rows (multi-row or matrix codes). The default height for linear codes can be preset by the pRect->bottom parameter. This function also takes the DPI property into account. You can use the returned values as input for the save image functions.

This function calculates the bar code size for a rotation of 0 degrees.
If a quiet zone is set, it is considered automatically by GetOptimalBitmapSize. But note that only quiet zones given in modules or pixels can be handled. The other units lead to an error because a device context would be needed for a proper bitmap size calculation. If you apply the results for a rotated bar code of 90° or 270° you have to exchange width and height.
See also:
BCSetDPI(), BCSaveImage(), BCSaveImageToBuffer(), BCBitmapToFile(), BCBitmapToMemory()
[in]pBarCodePointer to barcode structure.
[in,out]pRect[in] The size of the bounding rectangle without HRT (for barcode orientation of 0 degrees) in Pixels. [out] The size of the optimal bitmap including HRT (if any) in Pixels.
[in]nScaleXHorizontal scaling factor.
[in]nScaleYVertical scaling factor.
Return values:
ERRCODEErrOk (0) in case of success. Non-zero if error occurred.